23.0.0 • Published 22 days ago

element-book v23.0.0

Weekly downloads
-
License
(MIT or CC0 1.0)
Repository
github
Last release
22 days ago

element-book

An element-vir drop-in element for building, testing, and demonstrating a collection of elements (or, in other words, a design system).

Installation

npm i element-book

Terminology

  • Page: a group of pages and / or element examples. Pages can be infinitely nested.
  • Element Example: an individual element example with independent state, styles, title, etc.

Usage

  1. Define element-book pages with defineBookPage:

    import {defineBookPage} from '../data/book-entry/book-page/define-book-page.js';
    
    export const myPage = defineBookPage({
        /** Use `undefined` if your page is at the top level. */
        parent: undefined,
        title: 'My Page',
    });
  2. Inside of a page definition, define an element example:

    import {html} from 'element-vir';
    import {defineBookPage} from '../data/book-entry/book-page/define-book-page.js';
    
    export const myPage = defineBookPage({
        /** Use `undefined` if your page is at the top level. */
        parent: undefined,
        title: 'My Page',
        defineExamples({defineExample}) {
            defineExample({
                title: 'My Example',
                render() {
                    return html`
                        <p>Render your element here.</p>
                    `;
                },
            });
        },
    });
  3. Instantiate an instance of the element book app into your app and pass in all your pages:

    import {defineElementNoInputs, html} from 'element-vir';
    import {ElementBookApp} from '../ui/elements/element-book-app/element-book-app.element.js';
    import {myPage} from './define-page.example.js';
    
    export const MyApp = defineElementNoInputs({
        tagName: 'my-app',
        render() {
            return html`
                <${ElementBookApp.assign({
                    pages: [
                        myPage,
                    ],
                })}></${ElementBookApp}>
            `;
        },
    });

Why not Storybook?

Because Storybook is un-composable, impossible to debug, and full of behind-the-scenes *magic* that you can't backtrack without already understanding the inner workings of Storybook itself. With element-book, it's all just imports that you can directly follow with the TypeScript compiler.

23.0.0

22 days ago

22.2.2

7 months ago

22.2.1

7 months ago

22.2.0

7 months ago

22.1.2

7 months ago

22.1.3

7 months ago

22.1.1

7 months ago

22.1.0

8 months ago

22.0.5

8 months ago

22.0.4

8 months ago

22.0.3

8 months ago

22.0.2

8 months ago

22.0.1

8 months ago

22.0.0

8 months ago

21.0.0

8 months ago

20.0.9

9 months ago

20.0.8

10 months ago

20.0.7

10 months ago

20.0.5

10 months ago

20.0.4

10 months ago

20.0.3

10 months ago

20.0.6

10 months ago

20.0.2

10 months ago

20.0.1

10 months ago

10.1.10

11 months ago

10.1.4

1 year ago

10.1.5

1 year ago

10.1.6

1 year ago

10.1.7

1 year ago

10.1.8

1 year ago

10.1.9

1 year ago

10.1.3

1 year ago

10.1.0

1 year ago

10.1.1

1 year ago

10.1.2

1 year ago

10.0.0

1 year ago

10.0.1

1 year ago

10.0.2

1 year ago

7.0.0

1 year ago

7.0.4

1 year ago

7.0.3

1 year ago

7.0.2

1 year ago

7.0.1

1 year ago

7.0.8

1 year ago

7.0.7

1 year ago

7.0.6

1 year ago

7.0.5

1 year ago

8.0.0

1 year ago

9.0.1

1 year ago

9.0.0

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

5.0.1

1 year ago

5.0.0

1 year ago

6.0.1

1 year ago

6.0.0

1 year ago

6.0.3

1 year ago

6.0.2

1 year ago

1.0.3

2 years ago

2.0.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

4.1.0

1 year ago

4.0.0

1 year ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.0

2 years ago