<commit_before>/**
	Copyright (C) 2017 <NAME>
 
	Date:  July 2017
	License:  MIT
 */

import Foundation
import Confetti
import Tapestry

class TodoList: CollectionViewpoint<Todo>, UI {

	// TODO: Remove
	override init<S>(collection: S, objectGraph: ObjectGraph? = nil) where S : Sequence, S.Iterator.Element == Todo {
		super.init(collection: collection, objectGraph: objectGraph)
	}
	
	override func itemPresentingCollection(from item: Item) -> Item {
		return (item.items ?? [])[0]
	}

    override func generate() -> Item {
        return column(items:
			column(items:
				collection.map { self.label(extent: Extent(width: 400, height: 50), text: $0.text) }
			),
			row(items:
				button(extent: Extent(width: 200, height: 20), text: "Add", action: { _ in self.add() }),
				button(extent: Extent(width: 200, height: 20), text: "Remove", action: { _ in self.remove() })
			)
		)
    }
}
<commit_msg>Wrapped Todo list UI into a root item to prevent the UI to be split into multiple windows<commit_after>/**
	Copyright (C) 2017 <NAME>
 
	Date:  July 2017
	License:  MIT
 */

import Foundation
import Confetti
import Tapestry

class TodoList: CollectionViewpoint<Todo>, UI {

	// TODO: Remove
	override init<S>(collection: S, objectGraph: ObjectGraph? = nil) where S : Sequence, S.Iterator.Element == Todo {
		super.init(collection: collection, objectGraph: objectGraph)
	}
	
	override func itemPresentingCollection(from item: Item) -> Item {
		return (item.items?.first?.items ?? [])[0]
	}

    override func generate() -> Item {
        return item(frame: Rect(x: 200, y: 200, width: 200, height: 800), items:
			column(items:
				column(items:
					collection.map { self.label(extent: Extent(width: 400, height: 50), text: $0.text) }
				),
				row(items:
					button(extent: Extent(width: 200, height: 20), text: "Add", action: { _ in self.add() }),
					button(extent: Extent(width: 200, height: 20), text: "Remove", action: { _ in self.remove() })
				)
			)
		)
    }
}

{'fraction_non_alphanumeric': 0.1435068216270844, 'fraction_numerical': 0.031328954017180395, 'mean_word_length': 3.691943127962085, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '4864191', 'n_tokens_mistral': 768, 'n_tokens_neox': 644, 'n_words': 191}