<commit_before>import xs, { Stream } from 'xstream';
import { DOMSource } from '@cycle/dom/xstream-typings';
import { VNode, button } from '@cycle/dom';
import isolate from '@cycle/isolate';

export interface ButtonSources {
  selector$: Stream<string>;
  content$: Stream<VNode[]|string>;
  dom: DOMSource;
}

export interface ButtonSinks {
  dom: Stream<VNode>;
  click$: Stream<MouseEvent>;
}

function ButtonComponent(sources: ButtonSources): ButtonSinks {
  const click$ =
    sources.dom
      .select('button')
      .events('click')
      .map(event => event as MouseEvent);
  const selector$ = sources.selector$;
  const content$ = sources.content$;
  const dom =
    xs.combine(selector$, content$)
      .map(([selector, content]) => button(selector, content));
  return {
    dom,
    click$
  };
}

export const Button = (sources: ButtonSources) => isolate(ButtonComponent)(sources);
export default Button;<commit_msg>Make Button a UIComponent<commit_after>import { UIComponent, UIComponentSources, UIComponentSinks } from './';
import xs, { Stream } from 'xstream';
import { DOMSource } from '@cycle/dom/xstream-typings';
import { VNode, button } from '@cycle/dom';
import isolate from '@cycle/isolate';

export interface ButtonSources extends UIComponentSources {
  content$: Stream<VNode[]|string>;
}

export interface ButtonSinks extends UIComponentSinks {
  click$: Stream<MouseEvent>;
}

function ButtonComponent(sources: ButtonSources): ButtonSinks {
  const click$ =
    sources.dom
      .select('button')
      .events('click')
      .map(event => event as MouseEvent);
  const dom =
    xs.combine(sources.classes$, sources.style$, sources.content$)
      .map(([classes, style, content]) => button(classes, { style }, content));
  return {
    dom,
    click$
  };
}

export const Button = (sources: ButtonSources) => isolate(ButtonComponent)(sources);
export default Button;
{'fraction_non_alphanumeric': 0.13736842105263158, 'fraction_numerical': 0.0, 'mean_word_length': 4.494219653179191, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '323771', 'n_tokens_mistral': 556, 'n_tokens_neox': 555, 'n_words': 148}