Code Monkey home page Code Monkey logo

storybook-addon-overview-angular's People

Contributors

rheimus avatar south-paw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rheimus hypery2k

storybook-addon-overview-angular's Issues

No provided changelog creates exception in overview component

Using the following config on an overview story (where no changelog is defined)...

story.add(
    'Overview',
    () => ({ template: `<my-cool-component>hello world! ๐ŸŒŽ</my-cool-component>` }),
    {
        overview: {
            enabled: true,
            title: 'My Cool Component',
            filename: 'my-cool-component/my-cool-component.component',
            exportClass: 'MyCoolComponent'
        }
    }
);

will cause the following error in the OverviewComponent

image

You can put in showChangelog: false to the story config to work around it - but really there's a length check that's being run on an undefined in the OverviewComponent that should be fixed.

Show errors in storybook when they occur

Errors are currently put into the console but if there are multiple it's hard to tell what story they're from.

A simple error component to render in place of the story would be useful to solve this.

Explicitly set font sizes of elements in OverviewComponent

If a stylesheet is provided in the story that changes the h1, h2, h3 ... etc tag font-size then the story starts to look a little wack. The same applies to tag margin, padding etc. of the tags.

OverviewComponent should provide a set of fixed defaults for these elements so the overview component doesn't get all malformed and unusable forcing people to add custom styles just for the overview.

Or just don't use normal HTML tags and style span and div elements to avoid conflicts on tags...

Add support for get/set inputs and outputs

The properties in the OverviewComponent will fail to render the following for example (bad example by the way);

@Input()
public set myValue(value: number) {
  if (!isNaN(value)) {
    this._value = value;
  }

  this._value = 0;
}

when typedoc'd it will product something like this...

{
    "id": 1,
    "name": "value",
    "kind": 1,
    "kindString": "Accessor",
    "flags": {
        "isPublic": true,
        "isExported": true
    },
    "decorators": [
        {
            "name": "Input",
            "type": {
                "type": "reference",
                "name": "Input"
            },
            "arguments": {}
        }
    ],
    "getSignature": [
        {
            "id": 1,
            "name": "__get",
            "kind": 1,
            "kindString": "Get signature",
            "flags": {},
            "type": {
                "type": "intrinsic",
                "name": "number"
            }
        }
    ],
    "setSignature": [
        {
            "id": 1,
            "name": "__set",
            "kind": 1,
            "kindString": "Set signature",
            "flags": {},
            "parameters": [
                {
                    "id": 1,
                    "name": "value",
                    "kind": 1,
                    "kindString": "Parameter",
                    "flags": {},
                    "type": {
                        "type": "intrinsic",
                        "name": "number"
                    }
                }
            ],
            "type": {
                "type": "intrinsic",
                "name": "void"
            }
        }
    ],
    "sources": [
      {
        "fileName": "example.ts",
        "line": 1,
        "character": 1
      },
      {
        "fileName": "example.ts",
        "line": 1,
        "character": 1
      }
    ]
}

The OverviewComponent chokes on this as there's no type on the object

image

It needs to be able to support get/set members of the components and show them in the properties list

Support for Angular Material Components?

Hi,

I'm sorry if this is the wrong place to ask.
I'm currently working on a Storybook that shows not only documentation for our own custom components but also for Angular Material Components that we use. Our problem is that overview requires a filename or a component file but since we are using the Material Components, we do not have such files (at least not that I know).

Can someone help me getting the Overview addon to work with Material Components?

Thank you in advance.

Add support for custom styles/themes

It would be nice to match the styling of Overview (font family, colors) with the overall Storybook theme.

API proposal

addDecorator(withOverview({
  typedoc,
  theme: myTheme,
}));

Component documentation with no tags throws error

To reproduce:

/**
 * An awesome button component for making buttons.
 *
 * Note that this comment has no tags... yeah well it'll crash.
 */
@Component({
    selector: 'my-button',
    templateUrl: './my-button.component.html',
})
export class MyButtonComponent {
    @Input()
    public label: string;
}

image

Simply missing an if check around the tags generater

Required inputs/outputs

Some inputs/outputs may be required for a component and it'd be useful to call these out in the overview's properties.

Change component @ doc tags to support markdown

@ tags in the documentation block of a component have special sauce applied to them at the moment and should be swapped to use markdown syntax instead which would make links easier and allow for custom HTML elements in them as well.

For example, doc tags would allow the following after this change...

/**
 * my component doc
 *
 * @design_guidelines [The Design Guidelines](example.com)
 * @status <span class="badge warning">In Review</span>
 */

Avoid `addParameters` in SB config, pass `typedoc` json to withOverview function

Change so that users can avoid addParameters in SB config and instead just get them to pass typedoc json to withOverview function, e.g.

...

import { withOverview, OverviewModule } from '../src';
import typedoc from '../typedoc.json';

addDecorator(withOverview(typedoc));
addDecorator(moduleMetadata({ imports: [OverviewModule] }));

...

and withOverview just needs to have a wrapped arrow function to receive the typedoc.

This does huge speed and performance gains on larger storybooks ๐ŸŽ‰

Support for Storybook v6.0.0

Hi @South-Paw
I wonder if you have some time to take a look into the latest Storybook 6 alpha.

With their new ability to load custom MDX files, the new approach is to load a Table of Properties with a separate component, but I don't like that approach, it invades the Designer's Docs page with the stuff of Developers.

And even if I like your decorator, I think that the new version enables your module to offer a Panel to check the Properties. The panels are awesome without interfering with the format of the story shown inside the MDX file.

Thanks in advance!

Overview styles not loading in canvas view

I've gotten the addon working properly and that's amazing since it will take a lot of the panic out of my team when they see that the code they write should basically document itself. However, it seems like the SCSS for the addon isn't loading. The stylesheets are loaded, as I can see them in the Style Editor panel (Firefox) but it appears as though the :host declarations aren't parsing.

I've tried disabling a wrapping decorator I have, changing how it's loaded, adjust the config sass-loader, but all to no avail. I've attached a screenshot of what I'm seeing.

Storybook version: 5.2.5
Storybook-addon-overview-angular version: 1.0.1

Canvas area:
Screenshot showing addon working as intended, but without it's CSS applied

HTML output:
Screenshot showing HTML output correctly applying the addon HTML and classes, but without host resolution

Add support for documenting class properties and methods

Sometimes you may want to document class attributes for a component, directive, module or service (particularly for services associated with storybook components i.e. MyIconRegistry)

Adding support for something like this may be useful.

Properties

className: get string

The class name applied to the DOM element

Date type is being shown as reference

One of my Inputs() is defined this way:

@input() selectedDate: string | Date | number;

In the generated documentation, it's getting described like this:

One of<
string,
reference,
number,

Would be cooler to see Date instead of 'reference'.

Version 1.0.0 is not importable from config.js

Hey,

Looks like new version (1.0.0) doesn't have index.js, but instead has index.ts.

Is this a mistake or does that mean that I need to change something in my setup to make it work?

Currently I just get "Module not found" errors.

Array parameters of generic type are not supported for set input

This:

@Input() set selectedItems(selectedItems: T[])

breaks the documentation in properties.component.ts line 18, because param.type is equal to:

{
  elementType: {
     type: "typeParameter",
     name: "T",
  },
  name: "T"
}

when the code reaches for non-existent name key.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.