<commit_before>import {
  Actions,
  Inputs,
  Interfaces,
  StyleGroup,
  _,
  assoc,
} from '../../core'
import { View, h } from '../../interfaces/view'

export const state = {
  id: '',
  title: '',
  body: '',
  _timestamp: 0,
}

export type S = typeof state

export const inputs: Inputs = F => ({
  set: async ([name, value]) => {
    await F.toAct('Set', [name, value])
    await F.runIt(['db', ['setItem', [name, value]]])
  },
  setNoteFromId: async id => {
    let s: S = F.stateOf()
    if (s.id !== '') {
      await F.runIt(['db', ['unsubscribe', F.ctx.id, s.id]])
    }
    await F.runIt(['db', ['subscribe', F.ctx.id, id, F.act('SetNote', _, '*')]])
    await F.toAct('SetId', id)
  },
})

export const actions: Actions<S> = {
  SetId: assoc('id'),
  SetNote: ([evName, item]) => s => {
    return ({
    ...s,
    ...evName === 'add' || evName === 'set'
      ? item
      : evName === 'remove'
      ? { id: '' }
      : {}
  })
}
}

const view: View<S> = ({ ctx, ev }) => s => {
  let style = ctx.groups.style

  return h('div', {
    key: ctx.name,
    class: { [style.base]: true },
  }, s.id == '' ? [
    h('div', {
      class: { [style.title]: true },
    }, 'No one selected ...'),
  ] : [
    h('input', {
      class: { [style.title]: true },
      props: { value: s.title },
      on: { change: ev('set', 'title', ['target', 'value']) },
    }),
    h('textarea', {
      class: { [style.body]: true },
      props: { value: s.body },
      on: { change: ev('set', 'body', ['target', 'value']) },<commit_msg>Remove unused stuff in playground<commit_after>import {
  Actions,
  Inputs,
  Interfaces,
  StyleGroup,
  _,
  assoc,
} from '../../core'
import { View, h } from '../../interfaces/view'

export const state = {
  id: '',
  title: '',
  body: '',
  _timestamp: 0,
}

export type S = typeof state

export const inputs: Inputs = F => ({
  set: async ([name, value]) => {
    await F.toAct('Set', [name, value])
    await F.runIt(['db', ['setItem', [name, value]]])
  },
  setNoteFromId: async id => {
    let s: S = F.stateOf()
    if (s.id !== '') {
      await F.runIt(['db', ['unsubscribe', F.ctx.id, s.id]])
    }
    await F.runIt(['db', ['subscribe', F.ctx.id, id, F.act('SetNote', _, '*')]])
    await F.toAct('SetId', id)
  },
})

export const actions: Actions<S> = {
  SetId: assoc('id'),
  SetNote: ([evName, item]) => s => ({
    ...s,
    ...evName === 'add' || evName === 'set'
      ? item
      : evName === 'remove'
      ? { id: '' }
      : {}
  })
}

const view: View<S> = ({ ctx, ev }) => s => {
  let style = ctx.groups.style

  return h('div', {
    key: ctx.name,
    class: { [style.base]: true },
  }, s.id == '' ? [
    h('div', {
      class: { [style.title]: true },
    }, 'No one selected ...'),
  ] : [
    h('input', {
      class: { [style.title]: true },
      props: { value: s.title },
      on: { change: ev('set', 'title', ['target', 'value']) },
    }),
    h('textarea', {
      class: { [style.body]: true },
      props: { value: s.body },
      on: { change: ev('set', 'body', ['target', 'value']) },
{'fraction_non_alphanumeric': 0.2432520325203252, 'fraction_numerical': 0.0006504065040650406, 'mean_word_length': 2.3728070175438596, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '7121193', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1150, 'n_words': 277}