<commit_before>using Uno;
using Uno.UX;
using Uno.Collections;
using Uno.Compiler;
using Fuse.Scripting;
using Uno.Testing;
using Uno.Threading;

namespace Fuse.Reactive
{
    public partial class JavaScript
    {
        static PropertyHandle _modelHandle = Properties.CreateHandle();

        IExpression _model;

        void SetupModel()
        {
            if (_model != null)
                SetupModel(Parent.Children, this, _model);
        }

        static JavaScript GetModelScript(Visual v, NameTable nt = null)
        {
            var js = v.Properties.Get(_modelHandle) as JavaScript;
            if (js == null || nt != null)
            {
                var oldJs = js;
                
                js = new JavaScript(nt);
                js.FileName = "(model-script)";
                if (oldJs != null) 
                {
                    v.Children.Remove(oldJs);
                    js._model = oldJs._model;
                } 
                v.Children.Add(js);
                v.Properties.Set(_modelHandle, js);
            }
            return js;
        }

        [UXAttachedPropertySetter("JavaScript.Model"), UXNameScope, UXAuxNameTable("ModelNameTable")]
        public static void SetModel(Visual v, IExpression model)
        {
            var js = GetModelScript(v);
            js._model = model;
        }

        [UXAttachedPropertySetterAttribute("ModelNameTable")]
        public static void SetModelNameTable(Visual v, NameTable nt)
        {
            GetModelScript(v, nt);
        }

        static JavaScript _appModel;
        [UXAttachedPropertySetter("Model"), UXNameScope]
        public static void SetModel(AppBase app, IExpression model)
        {
            if (_appModel == null)
            {
                _appModel = new JavaScript(null);
                _appModel.FileName = "(model-script)";
                app.Children.Add(_appModel);
            }
			SetupModel(app.Children, _appModel, model);
        }

        static string ParseModelExpression(IExpression exp, JavaScript js, ref string argString, ref string className, List<string> thisSymbols)
        {
            if (exp is Data) {
                className = ((Data)exp).Key;<commit_msg>Add hack to make App model play nice with preview<commit_after>using Uno;
using Uno.UX;
using Uno.Collections;
using Uno.Compiler;
using Fuse.Scripting;
using Uno.Testing;
using Uno.Threading;

namespace Fuse.Reactive
{
    public partial class JavaScript
    {
        static PropertyHandle _modelHandle = Properties.CreateHandle();

        IExpression _model;

        void SetupModel()
        {
            if (_model != null)
                SetupModel(Parent.Children, this, _model);
        }

        static JavaScript GetModelScript(Visual v, NameTable nt = null)
        {
            var js = v.Properties.Get(_modelHandle) as JavaScript;
            if (js == null || nt != null)
            {
                var oldJs = js;
                
                js = new JavaScript(nt);
                js.FileName = "(model-script)";
                if (oldJs != null) 
                {
                    v.Children.Remove(oldJs);
                    js._model = oldJs._model;
                } 
                v.Children.Add(js);
                v.Properties.Set(_modelHandle, js);
            }
            return js;
        }

        [UXAttachedPropertySetter("JavaScript.Model"), UXNameScope, UXAuxNameTable("ModelNameTable")]
        public static void SetModel(Visual v, IExpression model)
        {
            var js = GetModelScript(v);
            js._model = model;
        }

        [UXAttachedPropertySetterAttribute("ModelNameTable")]
        public static void SetModelNameTable(Visual v, NameTable nt)
        {
            GetModelScript(v, nt);
        }

        static JavaScript _appModel;
        [UXAttachedPropertySetter("Model"), UXNameScope]
        public static void SetAppModel(AppBase app, IExpression model)
        {
            if (_appModel == null)
            {
                _appModel = new JavaScript(null);
                _appModel.FileName = "(model-script)";
                app.Children.Add(_appModel);
            }
			SetupModel(app.Children, _appModel, model);
        }

        static string ParseModelExpression(IExpression exp, JavaScript js, ref string argString, ref string className, List<string> thisSymbols)
        {
            if (exp is Data) {
                className = ((Data)exp).Key;
{'fraction_non_alphanumeric': 0.09028241049588615, 'fraction_numerical': 0.0, 'mean_word_length': 1.6901913875598087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6981893', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1141, 'n_words': 286}