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

@pixore/subdivide

v0.1.7

Published

Layout system inspired by blender's subdive layout

Downloads

67

Readme

Layout system inspired by blender's subdivide layout using React.js

Table of content:

Introduction

Subdivide is based on the layout system created for Blender, in which every area can be split into more areas or be merged with a sibling area.

Installation

npm install @pixore/subdivide

Basic Usage

import React from 'react';
import { render } from 'react-dom';

import Subdivide from '@pixore/subdivide';

const MasterPanel = () => <span>hello world!</span>;

const App = () => {
  return <Subdivide component={MasterPanel} />;
};

render(<App />, document.getElementById('root'));

Note the MasterPanel component, usually, this component should be able to turn into any other panel using a select input or a similar mechanism.

And that's it! You can check more examples in the examples folder

Preservable Layout

The layout is described by a simple object, it can be serializable and use it as the initial state a preservable layout can be achievable:

import React from 'react';
import { render } from 'react-dom';
import Subdivide, {
  ConfigProvider,
  useContainer,
  LayoutState,
} from '../../src';

const MasterPanel = () => <span>Just like you leave it :)</span>;

const getInitialState = () => {
  try {
    const json = localStorage.getItem('state');
    return JSON.parse(json);
  } catch (error) {
    return undefined;
  }
};

const initialState = getInitialState();

const App = () => {
  const onLayoutChange = (state) => {
    localStorage.setItem('state', JSON.stringify(state));
  };

  return (
    <ConfigProvider initialState={initialState} onLayoutChange={onLayoutChange}>
      <Subdivide component={MasterPanel} />
    </ConfigProvider>
  );
};

render(<App />, document.getElementById('root'));

Api

Components

Subdivide

| Prop | Type | Defalt Value | | ------------ | --------------- | ------------ | | component | React.ReactNode | n/a | | width | number | 100% | | height | number | 100% | | top | number | 0 | | left | number | 0 | | selfPosition | boolean | true |

ConfigProvider alias of Config.Provider

| Prop | Type | Defalt Value | | -------------- | ---------------------- | ------------ | | initialState | State | | | onLayoutChange | (state: State) => void | | | classNames | OptionalClassNames | | | cornerSize | number | | | splitRatio | number | |

Hooks

useContainer

Use to access to the container data, and update its state. Check how it's used in the examples: ColorPane, preservable, stats

useConfig

Mostly for internal usage

useClassNames

Mostly for internal usage

Author

👤 Jose Albizures by Pixore

🙏 Thanks!

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2020 Jose Albizures. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator