npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@simpleview/sv-mosaic

v39.2.1

Published

Mosaic UI Library

Downloads

643

Readme

npm version

sv-mosaic

npm install sv-mosaic

Mosaic is a React user interface library designed to create admin interfaces. It is designed to be product agnostic allowing it to be utilized in any manner of Admin interface.

It is built on top of React Material-UI and is it recommended that you pin to the same version that Mosaic is using.

Storybook: https://simpleviewinc.github.io/sv-mosaic/

Changelog - See the latest changes to sv-mosaic.

Usage

  • Add sv-mosaic to your package.json and pin to a specific version.
  • sv-mosaic has a host of peerDependencies which are not bundled into the library in order to minimize the bundle size of those that are using the package. You will need to ensure all of the peerDependencies of the package are satisfied. See the package.json for the current peerDependencies.

Modules should be imported using the specific resource path to avoid unecessarily importing the entire library:

import DataView from "@simpleview/sv-mosaic/components/DataView"

Resources are categorised and made available using the exports key in the library's package.json file. Those resources are:

  • components e.g: import DataView from "@simpleview/sv-mosaic/components/DataView"
    • For components, you should not only reach into the components directory, but also the directory named after component you are looking for.
    • Component-specific types are also available for import from these locations e.g. import DataView, { type DataViewProps } from "@simpleview/sv-mosaic/components/DataView"
  • theme e.g: import theme from "@simpleview/sv-mosaic/theme"
  • transforms e.g: import transform_boolean from "@simpleview/sv-mosaic/transforms"
  • utils e.g import prettyBytes from "@simpleview/sv-mosaic/utils"
  • types e.g import type { MosaicLabelValue } from "@simpleview/sv-mosaic"
    • Types are the only resource that should be imported from the root of the library.
    • Also note that all types are available from a standalone types-only package called @simpleview/sv-mosaic-types. This is useful for applications that need to reference Mosaic types without installing the dependencies that come with the library.

Optimization Guidelines

Optimization Guidelines - Ensure you're properly using Mosaic and React for optimal client-side performance.

Installation

  • Ensure you have sv-kubernetes installed.
  • If you want your windows box to have TypeScript completions of npm packages.
    • Install Node via https://nodejs.org/en/download/, easiest method is the Windows Install 64-bit. It may ask you to restart your box.
    • In windows cmd
      cd d:\PATH\TO\sv-kubernetes\containers\sv-mosaic
      npm install
  • Putty/Shell into sv-kubernetes
    • Install the container
      • sudo sv install sv-mosaic --type=container --branch=develop
    • Run the container
      cd /sv/containers/sv-mosaic
      sudo npm run docker
      yarn start

The service should now be accessible at http://kube.simpleview.io:10000/

Unit Testing

  • Ensure you have sv-mosaic installed per the instructions above.
  • Putty/Shell into sv-kubernetes
    • Run the container
      cd /sv/containers/sv-mosaic
      sudo npm run docker
      yarn test

Component File Structure

Component directories found inside ./containers/mosaic/src/components should follow a strict structure:

  • /components/ - Each exported component have it's own sub-folder in this folder.
    • [Component] - e.g. DataView, DataViewFilterDate
      • index.ts
        • This file File which should re-export the primary component as default. So if in the folder /DataViewFilterDate/ then index.ts should re-export /DataViewFilterDate/DataViewFilterDate.tsx.
        • This file should also export all entities in the [ComponentTypes].ts file. This makes the type definitions usable throughout the project and by external consumers.
      • [Component].tsx - The primary component file.
      • [ComponentTypes].ts - If the component needs to declare it's own typescript Interfaces or Types througout the folder, declare them here.
        • The props for the primary component should always be called [Component]Props, e.g. DataViewProps.
        • All TypeScript type and interface definitions should be unique across the project this way if they are exported, they are guaranteed to be unique. Prefix them with the name of the Component, e.g. DataViewOptions, DataViewColumn.
      • [Component].styled.ts - Optional file containing styled components used to compose the primary and sub components

Good Example Components:

  • /components/Button/
  • /components/LeftNav/
  • /components/CheckboxList/
  • /components/Checkbox/

Publishing

Publishing to NPM and storybook is automated. You do not need to run build, or publish.

  • Whenever a push to master changes the package.json, @simpleview/sv-mosaic and @simpleview/sv-mosaic-types will be published to NPM via the publish github action which runs scripts/conditional-publish
  • Whenever a push to master occurs the storybook is automatically built and pushed to the gh-pages branch via the storybook github action.