Getting started
mosaicary-kit provides an API client, catalogue components, skin utilities, build conversion and optional 3D viewers. Select the layer that matches the application: a complete catalogue for an embedded browser, independent blocks for an existing layout, or data services for an interface rendered entirely by the host.
Choose an entry point
The package separates data processing from visual components. mosaicary requests resources without registering elements; mosaicary/catalog exposes the components and Catalogue state. The corresponding /define entry points register browser elements as an import side effect. Only the 3D viewer entry points, including mosaicary/react/viewer, bring three.js. React is an optional peer dependency; the plain catalogue does not require it. The table lists public entry points and their principal exports.
import | export | three.js |
|---|---|---|
mosaicary | createClient, MosaicaryError, creditOf, fileOf | — |
mosaicary/catalog | Catalogue, catalogueNamed, defineBlocks, wordsFor | — |
mosaicary/catalog/define | customElements | — |
mosaicary/viewer | defineViewers, blockFilesAt, BlockFiles, Stage | three.js |
mosaicary/viewer/define | mosaicary-skin, mosaicary-build | three.js |
mosaicary/builds | convertBuild, buildFileName, readStructure, writeStructure | — |
mosaicary/skin | readSkin, armsOf, paintSkin, wearFromMosaicary | — |
mosaicary/install | installBlocks · Node | — |
mosaicary/react | MosaicaryCatalog, MosaicaryCards, MosaicaryBuildConverter | — |
mosaicary/react/viewer | MosaicarySkin, MosaicaryBuild | three.js |
mosaicary/vue | isMosaicaryElement | — |
Install the package
The package is MIT-licensed; its source code and issue tracker are on GitHub. Until it is available on npm as mosaicary, install the file of the GitHub release: download it and install it in the application directory, as the commands below do. npm 12 does not install a package from a web address unless --allow-remote=root is given; a downloaded file needs no such option. Browser imports require a bundler such as Vite or webpack, or another mechanism that resolves package specifiers. TypeScript declarations are included. React is an optional peer dependency and is needed only for mosaicary/react and mosaicary/react/viewer.
curl -LO https://github.com/MopicMP/mosaicary-kit/releases/download/v0.2.0/mosaicary-0.2.0.tgz
npm install ./mosaicary-0.2.0.tgzRegister and mount a minimal catalogue
Import mosaicary/catalog/define once in browser code, then mount mosaicary-catalog. The kinds attribute limits the available shelves; size="64" limits skins to dimensions accepted by Mojang. This minimal example already includes search, filters, cards, automatic pagination and attribution. Registration must finish before assigning object properties to custom elements. For React or Vue, continue with Frameworks rather than copying native element syntax without the framework configuration.
<script type="module">
import 'mosaicary/catalog/define';
</script>
<mosaicary-catalog kinds="skins,builds" size="64"></mosaicary-catalog>Check runtime requirements
The client and build conversion work without WebGL; only 3D views require it. mosaicary/install requires Node and filesystem access. Components read the colour behind them and mix their palette from it; browsers without CSS light-dark() receive the dark palette. Public catalogue reads require neither an account nor a developer key. An interface built from the catalogue shows the Mosaicary banner or a visible Mosaicary link; Attribution and licences explains this separately from the package licence.