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

tangram-layout

v0.0.19

Published

A Vue3 based UI layout engine. Features draggable and resizable. Custom plugin support and variable themes.

Downloads

14

Readme

Tangram-layout, A Vue3 split & drag layout

Tangram-layout

Installation

    npm i tangram-layout

Usage

  1. Import tangram-layout into your project:
// import tangram-layout
import {
  TangramLayout,
  TreeNode,
  PluginObject,
  createTree,
  insertChild,
} from "tangram-layout";
import "/node_modules/tangram-layout/dist/style.css";
//import plugin views
import HelloWorld from "./components/plugins/HelloWorld/HelloWorld.vue";
import HelloWorld2 from "./components/plugins/HelloWorld2/HelloWorld2.vue";
import HelloWorld3 from "./components/plugins/HelloWorld3/HelloWorld3.vue";
  1. Create a initial layout using a tree
// create tree for tangram layout
let layout_tree = createTree();

let node1: TreeNode = {
  ID: "1",
  name: "Pane 1", // title of the pane
  layout: "horizontal", // layout of the pane (horizontal or vertical)
  relativePosition: 1, // relative position of the pane (0: left/top, 1: right/bottom)
  twinID: undefined, // twinID of the pane (if the pane is split, it will have a twin)
  minSize: 0, //pixels
  vNode: "Hello", // name of the component to show in the pane
};
let node2: TreeNode = {
  ID: "2",
  name: "Pane 2",
  layout: "horizontal",
  relativePosition: 1,
  twinID: node1.ID,
  minSize: 0,
  vNode: "Hello",
};
let node3: TreeNode = {
  ID: "3",
  name: "Pane3",
  layout: "horizontal",
  relativePosition: 1,
  twinID: node2.ID,
  minSize: 0,
  vNode: "Hello2",
};
let node4: TreeNode = {
  ID: "4",
  name: "Pane 4",
  layout: "vertical",
  relativePosition: 1,
  twinID: node2.ID,
  minSize: 0,
  vNode: "Hello",
};
insertChild(layout_tree, node1);
insertChild(layout_tree, node2);
insertChild(layout_tree, node3);
insertChild(layout_tree, node4);
  1. Create a plugin Configuration map.
let plugins = new Map<String, PluginObject>();
plugins.set("Hello", {
  name: "Hello",
  component: HelloWorld,
  description: "...",
  version: "xxx",
  author: "...",
});
plugins.set("Hello2", {
  name: "Hello2",
  component: HelloWorld2,
  description: "...",
  version: "xxx",
  author: "...",
});
plugins.set("Hello3", {
  name: "Hello3",
  // async import component
  component: HelloWorld3,
  description: "...",
  version: "xxx",
  author: "...",
});
  1. Add tangram-layout element to your code
<template>
  <TangramLayout :layout="layout_tree" :pluginComponents="plugins" />
</template>

Options

Theme

TangramLayout has two built-in themes light and dark(default). You also can custom your theme by passing a theme to TangramLayout.

<script setup lang='ts'>
...
let theme = ref("");

theme.value="dark"; //built-in dark 
theme.value="light"; //built-in light
theme.value={split: { bgColor: "black" }, // custom theme
             pane: { headerBgColor: "black", bodyBgColor: "gray", color: "yellow" },
            };
</script>
<template>
  <TangramLayout :layout="layout_tree" :pluginComponents="plugins" :theme="theme"  />
</template>

showHeader

You can hide the header of the pane using showHeader.

<template>
  <TangramLayout :layout="layout_tree" :pluginComponents="plugins" :showHeader="false"  />
</template>

showControls

You also can hide the controls of the pane using showControls.

<template>
  <TangramLayout :layout="layout_tree" :pluginComponents="plugins" :showControls="false"  />
</template>