<commit_before>
module.exports =

    class List extends floyd.gui.ViewContext

        ##
        ##
        ##
        configure: (config)->
            config = super new floyd.Config

                widget: ->
                    if @class
                        li class:@class, @text
                    else
                        li @text

                data:
                    items: []
                    limit: -1
                    offset: 0
                    listSelector: ->
                        $ @find('ul')[0]

                content: ->
                    ul()

            , config
            
            if config.browse

                config.children.push new floyd.Config

                    type: 'gui.widgets.ListBrowser'

                    data:
                        selector: '> div.browse'
                    
                    events:
                        browse: (e)->
                            @parent._loadData e.offset, e.limit, (err, items, data)=>
                                return done(err) if err
                                @parent._display items, data
                    
                    booted: ->
                        @parent.on 'display', (e)=>
                            @_display e.items, e.data
                        
                        
                , config.browse

            @_widget = floyd.tools.gui.ck config.widget

            return config


        start: (done)->
            super (err)=>
                return done(err) if err
                
                if typeof (_sel = @data.listSelector) is 'function'
                    @_ul = _sel.apply @, []
                else
                    @_ul = @find _sel
                
                if !@_ul.children().length
                    @_reload done

                else done()


        _reload: (done)->
            @_loadData @data.offset, @data.limit, (err, items, data)=>
                return done(err) if err
                @_display items, data, done



        _loadData: (offset, limit, fn)->
            items = []

            if (_items = @data.items)
                if limit > -1
                    _items = _items.slice offset, offset+limit<commit_msg>moving @_ul creation to boot to havi it in wire and build<commit_after>
module.exports =

    class List extends floyd.gui.ViewContext

        ##
        ##
        ##
        configure: (config)->
            config = super new floyd.Config

                widget: ->
                    if @class
                        li class:@class, @text
                    else
                        li @text

                data:
                    items: []
                    limit: -1
                    offset: 0
                    listSelector: ->
                        $ @find('ul')[0]

                content: ->
                    ul()

            , config
            
            if config.browse

                config.children.push new floyd.Config

                    type: 'gui.widgets.ListBrowser'

                    data:
                        selector: '> div.browse'
                    
                    events:
                        browse: (e)->
                            @parent._loadData e.offset, e.limit, (err, items, data)=>
                                return done(err) if err
                                @parent._display items, data
                    
                    booted: ->
                        @parent.on 'display', (e)=>
                            @_display e.items, e.data
                        
                        
                , config.browse

            @_widget = floyd.tools.gui.ck config.widget

            return config

        
        ##
        boot: (done)->
            super (err)=>
                return done(err) if err
                
                if typeof (_sel = @data.listSelector) is 'function'
                    @_ul = _sel.apply @, []
                else
                    @_ul = @find _sel
                
                done()
        
        ##        
        start: (done)->
            super (err)=>
                return done(err) if err
                
                if !@_ul.children().length
                    @_reload done

                else done()

        
        ##
        _reload: (done)->
            @_loadData @data.offset, @data.limit, (err, items, data)=>
                return done(err) if err
                @_display items, data, done



        _loadData: (offset, limit, fn)->
            items = []

            if (_items = @data.items)
                if limit > -1
                    _items = _items.slice offset, offset+limit
{'fraction_non_alphanumeric': 0.08682824025289779, 'fraction_numerical': 0.0016859852476290833, 'mean_word_length': 0.7340153452685422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, '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': '2473641', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1047, 'n_words': 275}