<commit_before>import { storiesOf } from '@storybook/html';
import { action } from '@storybook/addon-actions';
// import { linkTo } from '@storybook/addon-links';

import { defineCustomElement } from '../dist/esm/es5/corporate-ui.core';
import * as CUI from '../dist/esm/es5/corporate-ui.components';

import categories from '../src/components/categories.json';
import components from '../src/components/data.json';

import '../src/components.scss';

const CUI_COMPONENTS = CUI.COMPONENTS;

// We skip rendering these components for now due to rendering issues
let filteredComponents = components.filter(item => ['c-column', 'c-container', 'c-content', 'c-row'].indexOf(item.name) === -1);

Object.keys(CUI_COMPONENTS)
  .map(item => renderWebComponent(CUI_COMPONENTS[item]));


[{name: 'All'}, ...categories]
  .map(category => renderStories(category, filteredComponents, 'Components'));


function renderWebComponent(component) {
  const [tagName, bundleIds, , tagAttrsData, encapsulationMeta, listenerMeta] = component;
  const tagAttrs = {};

  if (typeof tagAttrsData === 'object') {
    tagAttrsData.map(attributes => {
      const [propName, memberType, reflectToAttr, attrName, propType] = attributes;

      tagAttrs[propName] = {
        attrName,
        memberType,
        propType,
        reflectToAttr
      }
    });
  }

  defineCustomElement(window, [component]);

  /*if (tagName === 'context-consumer') {
    return;
  }
<commit_msg>PLEASE double check this one. Renamed CUI to C but I think it could be appropirate to re-name.,<commit_after>import { storiesOf } from '@storybook/html';
import { action } from '@storybook/addon-actions';
// import { linkTo } from '@storybook/addon-links';

import { defineCustomElement } from '../dist/esm/es5/corporate-ui.core';
import * as C from '../dist/esm/es5/corporate-ui.components';

import categories from '../src/components/categories.json';
import components from '../src/components/data.json';

import '../src/components.scss';

const C_COMPONENTS = C.COMPONENTS;

// We skip rendering these components for now due to rendering issues
let filteredComponents = components.filter(item => ['c-column', 'c-container', 'c-content', 'c-row'].indexOf(item.name) === -1);

Object.keys(C_COMPONENTS)
  .map(item => renderWebComponent(C_COMPONENTS[item]));


[{name: 'All'}, ...categories]
  .map(category => renderStories(category, filteredComponents, 'Components'));


function renderWebComponent(component) {
  const [tagName, bundleIds, , tagAttrsData, encapsulationMeta, listenerMeta] = component;
  const tagAttrs = {};

  if (typeof tagAttrsData === 'object') {
    tagAttrsData.map(attributes => {
      const [propName, memberType, reflectToAttr, attrName, propType] = attributes;

      tagAttrs[propName] = {
        attrName,
        memberType,
        propType,
        reflectToAttr
      }
    });
  }

  defineCustomElement(window, [component]);

  /*if (tagName === 'context-consumer') {
    return;
  }

{'fraction_non_alphanumeric': 0.14899328859060404, 'fraction_numerical': 0.0020134228187919465, 'mean_word_length': 4.0269814502529515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7182559', 'n_tokens_mistral': 931, 'n_tokens_neox': 899, 'n_words': 211}