# @scoped-elements/golden-layout

> Custom Elements that export the [golden-layout](https://github.com/golden-layout/golden-layout) library using the [scoped-elements mixin](https://www.npmjs.com/package/@open-wc/scoped-elements/v/1.0.3)

Latest version **0.2.6** (published 2023-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @scoped-elements/golden-layout
pnpm add @scoped-elements/golden-layout
yarn add @scoped-elements/golden-layout
bun add @scoped-elements/golden-layout
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2023-05-26 |
| First published | 2021-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | guillem.cordoba@gmail.com |
| Maintainers | guillem.cordoba |

## Links

- npm: https://www.npmjs.com/package/@scoped-elements/golden-layout
- npm.io page: https://npm.io/package/@scoped-elements/golden-layout

## Dependencies (3)

- [lit](https://npm.io/package/lit.md) ^2.2.0
- [@lit-labs/context](https://npm.io/package/@lit-labs/context.md) ^0.2.0
- [@lit-labs/observers](https://npm.io/package/@lit-labs/observers.md) ^1.1.0

## Recent versions

- 0.2.6 (latest) — 2023-05-26
- 0.2.5 — 2023-05-26
- 0.2.4 — 2023-05-05
- 0.2.3 — 2023-04-28
- 0.2.2 — 2023-04-28
- 0.2.2-s — 2023-04-28
- 0.2.1 — 2023-04-28
- 0.2.0 — 2023-03-26
- 0.1.8 — 2023-03-23
- 0.1.7 — 2023-03-23
- 0.1.6 — 2023-03-23
- 0.1.5 — 2023-02-24
- 0.1.4 — 2023-02-24
- 0.1.3 — 2023-02-24
- 0.1.2 — 2023-02-21
- … 5 more at https://npm.io/package/@scoped-elements/golden-layout/versions

## README

# @scoped-elements/golden-layout

Custom Elements that export the [golden-layout](https://github.com/golden-layout/golden-layout) library.

The main goals for these bindings is:

1. To be able to use golden-layout without having to define a tree of components in the JS side.
2. To be able to easily define custom elements as the component types for golden-layout.

## Features

- [x] Golden-Layout shows and works correctly.
- [x] Ability to define the tree structure of the initial layout only with HTML.
- [x] Ability to register HTML components.
- [x] Ability to define a custom HTML structure to fit golden-layout in.
- [x] Ability to define drag sources.
- [ ] Ability to save and load state.
- [ ] Ability to customize the settings for golden-layout.
- [ ] Handle edge cases and errors gracefully.
- [ ] Enable Popup.

## Installation

```bash
npm i "https://github.com/scoped-elements/golden-layout"
```

## Usage

```html
<golden-layout id="layout">
  <golden-layout-register component-type="hello">
    <template>
      <div>hi</div>
    </template>
  </golden-layout-register>
  <golden-layout-register component-type="second">
    <template>
      <div>hi second</div>
    </template>
  </golden-layout-register>

  <div style="display: flex; flex-direction: row; flex: 1;">
    <ul>
      <golden-layout-drag-source component-type="hello">
        <li>hii</li>
      </golden-layout-drag-source>
    </ul>

    <golden-layout-root style="flex: 1">
      <golden-layout-row>

        <golden-layout-column>
          <golden-layout-component component-type="hello" title="hi">
          </golden-layout-component>
          <golden-layout-component component-type="second" title="hi">
          </golden-layout-component>
        </golden-layout-column>

        <golden-layout-stack>
          <golden-layout-component component-type="hello" title="hi2">
          </golden-layout-component>
          <golden-layout-component component-type="second" title="hi2">
          </golden-layout-component>
        </golden-layout-stack>

      </golden-layout-row>
    </golden-layout-root>
  </div>
</golden-layout>

<script type="module">
  import {
    GoldenLayout,
    GoldenLayoutRow,
    GoldenLayoutComponent,
    GoldenLayoutRegister,
    GoldenLayoutDragSource,
    GoldenLayoutRoot,
  } from '../dist/index.js';

  customElements.define('golden-layout', GoldenLayout);
  customElements.define('golden-layout-row', GoldenLayoutRow);
  customElements.define('golden-layout-component', GoldenLayoutComponent);
  customElements.define('golden-layout-register', GoldenLayoutRegister);
  customElements.define('golden-layout-root', GoldenLayoutRoot);
  customElements.define('golden-layout-drag-source', GoldenLayoutDragSource);
</script>
```

You can find a full working demo in `demo/index.html`.

## Linting with ESLint, Prettier, and Types

To scan the project for linting errors, run

```bash
npm run lint
```

You can lint with ESLint and Prettier individually as well

```bash
npm run lint:eslint
```

```bash
npm run lint:prettier
```

To automatically fix many linting errors, run

```bash
npm run format
```

You can format using ESLint and Prettier individually as well

```bash
npm run format:eslint
```

```bash
npm run format:prettier
```

## Tooling configs

For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

## Local Demo with `web-dev-server`

```bash
npm start
```

To run a local development server that serves the basic demo located in `demo/index.html`

---
_Source: https://npm.io/package/@scoped-elements/golden-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
