<commit_before>private typedef Prop<T> = ?T->T;

private typedef Component<D> = {
  function new(o:D):Void;
  function view():Node;
}

class Comp<D, T:Component<D>>{
#if !macro
  public function new(cl:Class<T>, arg:D){
    controller = function() return untyped __js__('new cl')(arg);
  }
  var controller:Dynamic;
  function view(ctrl){
    return ctrl.view();
  }
#end
}

private typedef Promize = Dynamic;

abstract Node(Dynamic) from Comp<Dynamic, Dynamic> from String from Float from Array<Node>{
  public inline function new(v:Dynamic) this = v;
}

private typedef MithrilFn = String->?Dynamic->?Node->Node;
@:native('M')
#if !macro extern #end
class Mithril{
  public static macro function set(expr:haxe.macro.Expr){
    return macro function(v) $expr = v;
  }
  public static macro function setAttr(name:String, expr:haxe.macro.Expr){
    return macro Mithril.withAttr($v{name}, function(v) $expr = v);
  }
  public static macro function component<D, T:Component<D>>(expr:haxe.macro.Expr.ExprOf<Class<T>>, arg:haxe.macro.Expr.ExprOf<D>){
    return macro new Mithril.Comp($expr, $arg);
  }
  #if !macro

  public static inline function routeParam(name:String):Null<String> return (untyped route).param(name);
  public static var routeMode(get,set):String;
  static inline function get_routeMode():String return (untyped route).mode;
  static inline function set_routeMode(v:String):String return (untyped route).mode = v;

  public static inline function getRoute():String return (untyped route)();
  public static function route(el:js.html.Element, def:String, routes:Dynamic):Void;

  public static function prop<T>(v:T):Prop<T>;
  public static function module(el:js.html.Element, comp:Comp<Dynamic, Dynamic>):Void;
  public static function withAttr(name:String, fn:Dynamic->Void):Void->Void;
  public static function request(opts:Dynamic):Promize;
  public static function startComputation():Void;
  public static function endComputation():Void;
  public static function redraw():Void;
  public static var m(get, null):MithrilFn;

  static inline function get_m():MithrilFn return untyped Mithril;
  static function __init__():Void var M = untyped __js__('m');

  #end
}

<commit_msg>minor<commit_after>private typedef Prop<T> = ?T->T;

private typedef Component<D> = {
  function new(o:D):Void;
  function view():Node;
}

class Comp<D, T:Component<D>>{
#if !macro
  public function new(cl:Class<T>, arg:D){
    controller = function() return untyped __js__('new cl')(arg);
  }
  var controller:Dynamic;
  function view(ctrl){
    return ctrl.view();
  }
#end
}

private typedef Promize = Dynamic;

abstract Node(Dynamic) from Comp<Dynamic, Dynamic> from String from Float from Array<Node>{
  public inline function new(v:Dynamic) this = v;
}

private typedef MithrilFn = String->?Dynamic->?Node->Node;
@:native('M')
#if !macro extern #end
class Mithril{
  public static macro function set(expr:haxe.macro.Expr){
    return macro function(v) $expr = v;
  }
  public static macro function setAttr(name:String, expr:haxe.macro.Expr){
    return macro Mithril.withAttr($v{name}, function(v) $expr = v);
  }
  public static macro function component<D, T:Component<D>>(expr:haxe.macro.Expr.ExprOf<Class<T>>, ?arg:haxe.macro.Expr.ExprOf<D>){
    if(arg == null) arg = macro null;
    return macro new Mithril.Comp($expr, $arg);
  }
  #if !macro

  public static inline function routeParam(name:String):Null<String> return (untyped route).param(name);
  public static var routeMode(get,set):String;
  static inline function get_routeMode():String return (untyped route).mode;
  static inline function set_routeMode(v:String):String return (untyped route).mode = v;

  public static inline function getRoute():String return (untyped route)();
  public static function route(el:js.html.Element, def:String, routes:Dynamic):Void;

  public static function prop<T>(v:T):Prop<T>;
  public static function module(el:js.html.Element, comp:Comp<Dynamic, Dynamic>):Void;
  public static function withAttr(name:String, fn:Dynamic->Void):Void->Void;
  public static function request(opts:Dynamic):Promize;
  public static function startComputation():Void;
  public static function endComputation():Void;
  public static function redraw():Void;
  public static var m(get, null):MithrilFn;

  static inline function get_m():MithrilFn return untyped Mithril;
  static function __init__():Void var M = untyped __js__('m');

  #end
}


{'fraction_non_alphanumeric': 0.13175141242937854, 'fraction_numerical': 0.0, 'mean_word_length': 5.508823529411765, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 47, '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': '2524083', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1421, 'n_words': 391}