added github pages support
This commit is contained in:
1 parent
b14ebdbf63
commit
6ed638a1cc
373 files changed
+185436
-2343
No files matched your search
@@ -0,0 +1,113 @@
|
||||
(ns reagent.impl.batching
|
||||
(:refer-clojure :exclude [flush])
|
||||
(:require [reagent.debug :refer-macros [dbg assert-some]]
|
||||
[reagent.interop :refer-macros [$ $!]]
|
||||
[reagent.impl.util :refer [is-client]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
;;; Update batching
|
||||
|
||||
(defonce mount-count 0)
|
||||
|
||||
(defn next-mount-count []
|
||||
(set! mount-count (inc mount-count)))
|
||||
|
||||
(defn fake-raf [f]
|
||||
(js/setTimeout f 16))
|
||||
|
||||
(def next-tick
|
||||
(if-not is-client
|
||||
fake-raf
|
||||
(let [w js/window]
|
||||
(or ($ w :requestAnimationFrame)
|
||||
($ w :webkitRequestAnimationFrame)
|
||||
($ w :mozRequestAnimationFrame)
|
||||
($ w :msRequestAnimationFrame)
|
||||
fake-raf))))
|
||||
|
||||
(defn compare-mount-order [c1 c2]
|
||||
(- ($ c1 :cljsMountOrder)
|
||||
($ c2 :cljsMountOrder)))
|
||||
|
||||
(defn run-queue [a]
|
||||
;; sort components by mount order, to make sure parents
|
||||
;; are rendered before children
|
||||
(.sort a compare-mount-order)
|
||||
(dotimes [i (alength a)]
|
||||
(let [c (aget a i)]
|
||||
(when (true? ($ c :cljsIsDirty))
|
||||
($ c forceUpdate)))))
|
||||
|
||||
|
||||
;; Set from ratom.cljs
|
||||
(defonce ratom-flush (fn []))
|
||||
|
||||
(deftype RenderQueue [^:mutable ^boolean scheduled?]
|
||||
Object
|
||||
(enqueue [this k f]
|
||||
(assert-some f "Enqueued function")
|
||||
(when (nil? (aget this k))
|
||||
(aset this k (array)))
|
||||
(.push (aget this k) f)
|
||||
(.schedule this))
|
||||
|
||||
(run-funs [this k]
|
||||
(when-some [fs (aget this k)]
|
||||
(aset this k nil)
|
||||
(dotimes [i (alength fs)]
|
||||
((aget fs i)))))
|
||||
|
||||
(schedule [this]
|
||||
(when-not scheduled?
|
||||
(set! scheduled? true)
|
||||
(next-tick #(.run-queues this))))
|
||||
|
||||
(queue-render [this c]
|
||||
(.enqueue this "componentQueue" c))
|
||||
|
||||
(add-before-flush [this f]
|
||||
(.enqueue this "beforeFlush" f))
|
||||
|
||||
(add-after-render [this f]
|
||||
(.enqueue this "afterRender" f))
|
||||
|
||||
(run-queues [this]
|
||||
(set! scheduled? false)
|
||||
(.flush-queues this))
|
||||
|
||||
(flush-after-render [this]
|
||||
(.run-funs this "afterRender"))
|
||||
|
||||
(flush-queues [this]
|
||||
(.run-funs this "beforeFlush")
|
||||
(ratom-flush)
|
||||
(when-some [cs (aget this "componentQueue")]
|
||||
(aset this "componentQueue" nil)
|
||||
(run-queue cs))
|
||||
(.flush-after-render this)))
|
||||
|
||||
(defonce render-queue (->RenderQueue false))
|
||||
|
||||
(defn flush []
|
||||
(.flush-queues render-queue))
|
||||
|
||||
(defn flush-after-render []
|
||||
(.flush-after-render render-queue))
|
||||
|
||||
(defn queue-render [c]
|
||||
(when-not ($ c :cljsIsDirty)
|
||||
($! c :cljsIsDirty true)
|
||||
(.queue-render render-queue c)))
|
||||
|
||||
(defn mark-rendered [c]
|
||||
($! c :cljsIsDirty false))
|
||||
|
||||
(defn do-before-flush [f]
|
||||
(.add-before-flush render-queue f))
|
||||
|
||||
(defn do-after-render [f]
|
||||
(.add-after-render render-queue f))
|
||||
|
||||
(defn schedule []
|
||||
(when (false? (.-scheduled? render-queue))
|
||||
(.schedule render-queue)))
|
||||
@@ -0,0 +1 @@
|
||||
{:rename-macros {}, :renames {}, :externs {setTimeout {}, window {}, Error {}}, :use-macros {assert-some reagent.debug, dbg reagent.debug, $! reagent.interop, $ reagent.interop}, :excludes #{flush}, :name reagent.impl.batching, :imports nil, :requires {reagent.debug reagent.debug, reagent.interop reagent.interop, reagent.impl.util reagent.impl.util, string clojure.string, clojure.string clojure.string}, :cljs.spec/speced-vars [], :uses {is-client reagent.impl.util}, :defs {fake-raf {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 15, :column 7, :end-line 15, :end-column 15, :arglists (quote ([f]))}, :name reagent.impl.batching/fake-raf, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 15, :method-params ([f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 1, :fn-var true, :arglists (quote ([f]))}, do-before-flush {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 105, :column 7, :end-line 105, :end-column 22, :arglists (quote ([f]))}, :name reagent.impl.batching/do-before-flush, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 22, :method-params ([f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 105, :end-line 105, :max-fixed-arity 1, :fn-var true, :arglists (quote ([f]))}, flush-after-render {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 94, :column 7, :end-line 94, :end-column 25, :arglists (quote ([]))}, :name reagent.impl.batching/flush-after-render, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 25, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 94, :end-line 94, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, queue-render {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 97, :column 7, :end-line 97, :end-column 19, :arglists (quote ([c]))}, :name reagent.impl.batching/queue-render, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 19, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 97, :end-line 97, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, next-tick {:name reagent.impl.batching/next-tick, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 18, :column 1, :end-line 18, :end-column 15, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 18, :column 6, :end-line 18, :end-column 15}, :tag #{nil any}}, flush {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 91, :column 7, :end-line 91, :end-column 12, :arglists (quote ([]))}, :name reagent.impl.batching/flush, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 12, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 91, :end-line 91, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, mark-rendered {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 102, :column 7, :end-line 102, :end-column 20, :arglists (quote ([c]))}, :name reagent.impl.batching/mark-rendered, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 20, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 102, :end-line 102, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, schedule {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 111, :column 7, :end-line 111, :end-column 15, :arglists (quote ([]))}, :name reagent.impl.batching/schedule, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :end-column 15, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 111, :end-line 111, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, render-queue {:name reagent.impl.batching/render-queue, :file "target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 89, :column 1, :end-line 89, :end-column 22, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/batching.cljs", :line 89, :column 10, :end-line 89, :end-column 22}, :tag any}, RenderQueue {:num-fields 1, :protocols #{reagent.impl.batching/Object}, :name reagent.impl.batching/RenderQueue, :file "target/cljsbuild/public/js/out/reagent/impl/batchingLine truncated
|
||||
@@ -0,0 +1,244 @@
|
||||
// Compiled by ClojureScript 1.9.946 {}
|
||||
goog.provide('reagent.impl.batching');
|
||||
goog.require('cljs.core');
|
||||
goog.require('reagent.debug');
|
||||
goog.require('reagent.interop');
|
||||
goog.require('reagent.impl.util');
|
||||
goog.require('clojure.string');
|
||||
if(typeof reagent.impl.batching.mount_count !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.batching.mount_count = (0);
|
||||
}
|
||||
reagent.impl.batching.next_mount_count = (function reagent$impl$batching$next_mount_count(){
|
||||
return reagent.impl.batching.mount_count = (reagent.impl.batching.mount_count + (1));
|
||||
});
|
||||
reagent.impl.batching.fake_raf = (function reagent$impl$batching$fake_raf(f){
|
||||
return setTimeout(f,(16));
|
||||
});
|
||||
reagent.impl.batching.next_tick = ((!(reagent.impl.util.is_client))?reagent.impl.batching.fake_raf:(function (){var w = window;
|
||||
var or__35498__auto__ = (w["requestAnimationFrame"]);
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
var or__35498__auto____$1 = (w["webkitRequestAnimationFrame"]);
|
||||
if(cljs.core.truth_(or__35498__auto____$1)){
|
||||
return or__35498__auto____$1;
|
||||
} else {
|
||||
var or__35498__auto____$2 = (w["mozRequestAnimationFrame"]);
|
||||
if(cljs.core.truth_(or__35498__auto____$2)){
|
||||
return or__35498__auto____$2;
|
||||
} else {
|
||||
var or__35498__auto____$3 = (w["msRequestAnimationFrame"]);
|
||||
if(cljs.core.truth_(or__35498__auto____$3)){
|
||||
return or__35498__auto____$3;
|
||||
} else {
|
||||
return reagent.impl.batching.fake_raf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})());
|
||||
reagent.impl.batching.compare_mount_order = (function reagent$impl$batching$compare_mount_order(c1,c2){
|
||||
return ((c1["cljsMountOrder"]) - (c2["cljsMountOrder"]));
|
||||
});
|
||||
reagent.impl.batching.run_queue = (function reagent$impl$batching$run_queue(a){
|
||||
a.sort(reagent.impl.batching.compare_mount_order);
|
||||
|
||||
var n__36543__auto__ = a.length;
|
||||
var i = (0);
|
||||
while(true){
|
||||
if((i < n__36543__auto__)){
|
||||
var c_37398 = (a[i]);
|
||||
if((c_37398["cljsIsDirty"]) === true){
|
||||
(c_37398["forceUpdate"])();
|
||||
} else {
|
||||
}
|
||||
|
||||
var G__37399 = (i + (1));
|
||||
i = G__37399;
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
if(typeof reagent.impl.batching.ratom_flush !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.batching.ratom_flush = (function reagent$impl$batching$ratom_flush(){
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {reagent.impl.batching.Object}
|
||||
*/
|
||||
reagent.impl.batching.RenderQueue = (function (scheduled_QMARK_){
|
||||
this.scheduled_QMARK_ = scheduled_QMARK_;
|
||||
});
|
||||
reagent.impl.batching.RenderQueue.prototype.run_funs = (function (k){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
var temp__5461__auto__ = (this$[k]);
|
||||
if((temp__5461__auto__ == null)){
|
||||
return null;
|
||||
} else {
|
||||
var fs = temp__5461__auto__;
|
||||
(this$[k] = null);
|
||||
|
||||
var n__36543__auto__ = fs.length;
|
||||
var i = (0);
|
||||
while(true){
|
||||
if((i < n__36543__auto__)){
|
||||
(fs[i]).call(null);
|
||||
|
||||
var G__37400 = (i + (1));
|
||||
i = G__37400;
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.flush_after_render = (function (){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
return this$.run_funs("afterRender");
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.queue_render = (function (c){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
return this$.enqueue("componentQueue",c);
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.schedule = (function (){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
if(self__.scheduled_QMARK_){
|
||||
return null;
|
||||
} else {
|
||||
self__.scheduled_QMARK_ = true;
|
||||
|
||||
return reagent.impl.batching.next_tick.call(null,((function (this$){
|
||||
return (function (){
|
||||
return this$.run_queues();
|
||||
});})(this$))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.flush_queues = (function (){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
this$.run_funs("beforeFlush");
|
||||
|
||||
reagent.impl.batching.ratom_flush.call(null);
|
||||
|
||||
var temp__5461__auto___37401 = (this$["componentQueue"]);
|
||||
if((temp__5461__auto___37401 == null)){
|
||||
} else {
|
||||
var cs_37402 = temp__5461__auto___37401;
|
||||
(this$["componentQueue"] = null);
|
||||
|
||||
reagent.impl.batching.run_queue.call(null,cs_37402);
|
||||
}
|
||||
|
||||
return this$.flush_after_render();
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.run_queues = (function (){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
self__.scheduled_QMARK_ = false;
|
||||
|
||||
return this$.flush_queues();
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.enqueue = (function (k,f){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
if(cljs.core.truth_(f)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Enqueued function"," must not be nil"].join('')),"\n","f"].join('')));
|
||||
}
|
||||
|
||||
if(((this$[k]) == null)){
|
||||
(this$[k] = []);
|
||||
} else {
|
||||
}
|
||||
|
||||
(this$[k]).push(f);
|
||||
|
||||
return this$.schedule();
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.add_before_flush = (function (f){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
return this$.enqueue("beforeFlush",f);
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.prototype.add_after_render = (function (f){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
return this$.enqueue("afterRender",f);
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"scheduled?","scheduled?",579986609,null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"boolean","boolean",-278886877,null),new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
|
||||
});
|
||||
|
||||
reagent.impl.batching.RenderQueue.cljs$lang$type = true;
|
||||
|
||||
reagent.impl.batching.RenderQueue.cljs$lang$ctorStr = "reagent.impl.batching/RenderQueue";
|
||||
|
||||
reagent.impl.batching.RenderQueue.cljs$lang$ctorPrWriter = (function (this__36169__auto__,writer__36170__auto__,opt__36171__auto__){
|
||||
return cljs.core._write.call(null,writer__36170__auto__,"reagent.impl.batching/RenderQueue");
|
||||
});
|
||||
|
||||
reagent.impl.batching.__GT_RenderQueue = (function reagent$impl$batching$__GT_RenderQueue(scheduled_QMARK_){
|
||||
return (new reagent.impl.batching.RenderQueue(scheduled_QMARK_));
|
||||
});
|
||||
|
||||
if(typeof reagent.impl.batching.render_queue !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.batching.render_queue = reagent.impl.batching.__GT_RenderQueue.call(null,false);
|
||||
}
|
||||
reagent.impl.batching.flush = (function reagent$impl$batching$flush(){
|
||||
return reagent.impl.batching.render_queue.flush_queues();
|
||||
});
|
||||
reagent.impl.batching.flush_after_render = (function reagent$impl$batching$flush_after_render(){
|
||||
return reagent.impl.batching.render_queue.flush_after_render();
|
||||
});
|
||||
reagent.impl.batching.queue_render = (function reagent$impl$batching$queue_render(c){
|
||||
if(cljs.core.truth_((c["cljsIsDirty"]))){
|
||||
return null;
|
||||
} else {
|
||||
(c["cljsIsDirty"] = true);
|
||||
|
||||
return reagent.impl.batching.render_queue.queue_render(c);
|
||||
}
|
||||
});
|
||||
reagent.impl.batching.mark_rendered = (function reagent$impl$batching$mark_rendered(c){
|
||||
return (c["cljsIsDirty"] = false);
|
||||
});
|
||||
reagent.impl.batching.do_before_flush = (function reagent$impl$batching$do_before_flush(f){
|
||||
return reagent.impl.batching.render_queue.add_before_flush(f);
|
||||
});
|
||||
reagent.impl.batching.do_after_render = (function reagent$impl$batching$do_after_render(f){
|
||||
return reagent.impl.batching.render_queue.add_after_render(f);
|
||||
});
|
||||
reagent.impl.batching.schedule = (function reagent$impl$batching$schedule(){
|
||||
if(reagent.impl.batching.render_queue.scheduled_QMARK_ === false){
|
||||
return reagent.impl.batching.render_queue.schedule();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=batching.js.map?rel=1517021940666
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/didier\/clojupyter\/website\/target\/cljsbuild\/public\/js\/out\/reagent\/impl\/batching.js","sources":["batching.cljs?rel=1517021940667"],"lineCount":244,"mappings":";AAAA;;;;;;AASA,GAAA,OAASA;AAAT;AAAA,AAAA,oCAAA,pCAASA;;AAET,yCAAA,zCAAMC;AAAN,AACE,OAAMD,oCAAY,qCAAA,pCAAKA;;AAEzB,iCAAA,jCAAME,0EAAUC;AAAhB,AACE,oBAAA,bAACC,WAAcD;;AAEjB,AAAKE,kCACH,EAAA,EAAQC,8BACNJ,+BACA,iBAAMK,IAAEC;AAAR,AACE,IAAAC,oBAAI,GAAA,FAAGF;AAAP,AAAA,oBAAAE;AAAAA;;AAAA,IAAAA,wBACI,G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sDAAA,tDAASA;;AAAT,AAAA,2DAAA,WAAAJ,oBAAAC,sBAAAC,hHAASE;AAAT,AAAA,OAAAD,2BAAAF,sBAAA;;;AAAA,yCAAA,zCAASI,0FAAgCC;AAAzC,AAAA,YAAAF,kCAAyCE;;;AAAhCF,AA4CT,GAAA,OAASS;AAAT;AAAA,AAAA,AAASA,qCAAa,iDAAA,jDAACR;;AAEvB,8BAAA,9BAAMS;AAAN,AACE,OAAeD;;AAEjB,2CAAA,3CAAME;AAAN,AACE,OAAqBF;;AAEvB,qCAAA,rCAAMG,kFAAclB;AAApB,AACE,oBAAU,GAAA,FAAGA;AAAb;;AAAA,AACE,GAAA,iBAAA,nBAAIA;;AACJ,OAAee,gDAAaf;;;AAEhC,sCAAA,tCAAMmB,oFAAenB;AAArB,AACE,UAAA,iBAAA,nBAAIA;;AAEN,wCAAA,xCAAMoB,wFAAiBlC;AAAvB,AACE,OAAmB6B,oDAAa7B;;AAElC,wCAAA,xCAAMmC,wFAAiBnC;AAAvB,AACE,OAAmB6B,oDAAa7B;;AAElC,iCAAA,jCAAMoC;AAAN,AACE,GAAM,AAAQ,AAAcP;AAA5B,AACE,OAAWA;;AADb","names":["reagent.impl.batching\/mount-count","reagent.impl.batching\/next-mount-count","reagent.impl.batching\/fake-raf","f","js\/setTimeout","reagent.impl.batching\/next-tick","reagent.impl.util\/is-client","w","js\/window","or__35498__auto__","reagent.impl.batching\/compare-mount-order","c1","c2","reagent.impl.batching\/run-queue","a","n__36543__auto__","i","c","reagent.impl.batching\/ratom-flush","this__36169__auto__","writer__36170__auto__","opt__36171__auto__","cljs.core\/-write","reagent.impl.batching\/RenderQueue","reagent.impl.batching\/->RenderQueue","scheduled?","this","k","js\/Error","temp__5461__auto__","fs","cs","reagent.impl.batching\/render-queue","reagent.impl.batching\/flush","reagent.impl.batching\/flush-after-render","reagent.impl.batching\/queue-render","reagent.impl.batching\/mark-rendered","reagent.impl.batching\/do-before-flush","reagent.impl.batching\/do-after-render","reagent.impl.batching\/schedule"]}
|
||||
@@ -0,0 +1,316 @@
|
||||
(ns reagent.impl.component
|
||||
(:require [reagent.impl.util :as util]
|
||||
[reagent.impl.batching :as batch]
|
||||
[reagent.ratom :as ratom]
|
||||
[reagent.interop :refer-macros [$ $!]]
|
||||
[reagent.debug :refer-macros [dbg prn dev? warn error warn-unless
|
||||
assert-callable]]))
|
||||
|
||||
(declare ^:dynamic *current-component*)
|
||||
|
||||
|
||||
;;; Argv access
|
||||
|
||||
(defn shallow-obj-to-map [o]
|
||||
(let [ks (js-keys o)
|
||||
len (alength ks)]
|
||||
(loop [m {} i 0]
|
||||
(if (< i len)
|
||||
(let [k (aget ks i)]
|
||||
(recur (assoc m (keyword k) (aget o k)) (inc i)))
|
||||
m))))
|
||||
|
||||
(defn extract-props [v]
|
||||
(let [p (nth v 1 nil)]
|
||||
(if (map? p) p)))
|
||||
|
||||
(defn extract-children [v]
|
||||
(let [p (nth v 1 nil)
|
||||
first-child (if (or (nil? p) (map? p)) 2 1)]
|
||||
(if (> (count v) first-child)
|
||||
(subvec v first-child))))
|
||||
|
||||
(defn props-argv [c p]
|
||||
(if-some [a ($ p :argv)]
|
||||
a
|
||||
[(.-constructor c) (shallow-obj-to-map p)]))
|
||||
|
||||
(defn get-argv [c]
|
||||
(props-argv c ($ c :props)))
|
||||
|
||||
(defn get-props [c]
|
||||
(let [p ($ c :props)]
|
||||
(if-some [v ($ p :argv)]
|
||||
(extract-props v)
|
||||
(shallow-obj-to-map p))))
|
||||
|
||||
(defn get-children [c]
|
||||
(let [p ($ c :props)]
|
||||
(if-some [v ($ p :argv)]
|
||||
(extract-children v)
|
||||
(->> ($ p :children)
|
||||
($ util/react Children.toArray)
|
||||
(into [])))))
|
||||
|
||||
(defn ^boolean reagent-class? [c]
|
||||
(and (fn? c)
|
||||
(some? (some-> c .-prototype ($ :reagentRender)))))
|
||||
|
||||
(defn ^boolean react-class? [c]
|
||||
(and (fn? c)
|
||||
(some? (some-> c .-prototype ($ :render)))))
|
||||
|
||||
(defn ^boolean reagent-component? [c]
|
||||
(some? ($ c :reagentRender)))
|
||||
|
||||
(defn cached-react-class [c]
|
||||
($ c :cljsReactClass))
|
||||
|
||||
(defn cache-react-class [c constructor]
|
||||
($! c :cljsReactClass constructor))
|
||||
|
||||
|
||||
;;; State
|
||||
|
||||
(defn state-atom [this]
|
||||
(let [sa ($ this :cljsState)]
|
||||
(if-not (nil? sa)
|
||||
sa
|
||||
($! this :cljsState (ratom/atom nil)))))
|
||||
|
||||
;; avoid circular dependency: this gets set from template.cljs
|
||||
(defonce as-element nil)
|
||||
|
||||
|
||||
;;; Rendering
|
||||
|
||||
(defn wrap-render [c]
|
||||
(let [f ($ c :reagentRender)
|
||||
_ (assert-callable f)
|
||||
res (if (true? ($ c :cljsLegacyRender))
|
||||
(.call f c c)
|
||||
(let [v (get-argv c)
|
||||
n (count v)]
|
||||
(case n
|
||||
1 (.call f c)
|
||||
2 (.call f c (nth v 1))
|
||||
3 (.call f c (nth v 1) (nth v 2))
|
||||
4 (.call f c (nth v 1) (nth v 2) (nth v 3))
|
||||
5 (.call f c (nth v 1) (nth v 2) (nth v 3) (nth v 4))
|
||||
(.apply f c (.slice (into-array v) 1)))))]
|
||||
(cond
|
||||
(vector? res) (as-element res)
|
||||
(ifn? res) (let [f (if (reagent-class? res)
|
||||
(fn [& args]
|
||||
(as-element (apply vector res args)))
|
||||
res)]
|
||||
($! c :reagentRender f)
|
||||
(recur c))
|
||||
:else res)))
|
||||
|
||||
(declare comp-name)
|
||||
|
||||
(defn do-render [c]
|
||||
(binding [*current-component* c]
|
||||
(if (dev?)
|
||||
;; Log errors, without using try/catch (and mess up call stack)
|
||||
(let [ok (array false)]
|
||||
(try
|
||||
(let [res (wrap-render c)]
|
||||
(aset ok 0 true)
|
||||
res)
|
||||
(finally
|
||||
(when-not (aget ok 0)
|
||||
(error (str "Error rendering component"
|
||||
(comp-name)))))))
|
||||
(wrap-render c))))
|
||||
|
||||
|
||||
;;; Method wrapping
|
||||
|
||||
(def rat-opts {:no-cache true})
|
||||
|
||||
(def static-fns
|
||||
{:render
|
||||
(fn render []
|
||||
(this-as c (if util/*non-reactive*
|
||||
(do-render c)
|
||||
(let [rat ($ c :cljsRatom)]
|
||||
(batch/mark-rendered c)
|
||||
(if (nil? rat)
|
||||
(ratom/run-in-reaction #(do-render c) c "cljsRatom"
|
||||
batch/queue-render rat-opts)
|
||||
(._run rat false))))))})
|
||||
|
||||
(defn custom-wrapper [key f]
|
||||
(case key
|
||||
:getDefaultProps
|
||||
(throw (js/Error. "getDefaultProps not supported"))
|
||||
|
||||
:getInitialState
|
||||
(fn getInitialState []
|
||||
(this-as c (reset! (state-atom c) (.call f c c))))
|
||||
|
||||
:componentWillReceiveProps
|
||||
(fn componentWillReceiveProps [nextprops]
|
||||
(this-as c (.call f c c (props-argv c nextprops))))
|
||||
|
||||
:shouldComponentUpdate
|
||||
(fn shouldComponentUpdate [nextprops nextstate]
|
||||
(or util/*always-update*
|
||||
(this-as c
|
||||
;; Don't care about nextstate here, we use forceUpdate
|
||||
;; when only when state has changed anyway.
|
||||
(let [old-argv ($ c :props.argv)
|
||||
new-argv ($ nextprops :argv)
|
||||
noargv (or (nil? old-argv) (nil? new-argv))]
|
||||
(cond
|
||||
(nil? f) (or noargv (not= old-argv new-argv))
|
||||
noargv (.call f c c (get-argv c) (props-argv c nextprops))
|
||||
:else (.call f c c old-argv new-argv))))))
|
||||
|
||||
:componentWillUpdate
|
||||
(fn componentWillUpdate [nextprops]
|
||||
(this-as c (.call f c c (props-argv c nextprops))))
|
||||
|
||||
:componentDidUpdate
|
||||
(fn componentDidUpdate [oldprops]
|
||||
(this-as c (.call f c c (props-argv c oldprops))))
|
||||
|
||||
:componentWillMount
|
||||
(fn componentWillMount []
|
||||
(this-as c
|
||||
($! c :cljsMountOrder (batch/next-mount-count))
|
||||
(when-not (nil? f)
|
||||
(.call f c c))))
|
||||
|
||||
:componentDidMount
|
||||
(fn componentDidMount []
|
||||
(this-as c (.call f c c)))
|
||||
|
||||
:componentWillUnmount
|
||||
(fn componentWillUnmount []
|
||||
(this-as c
|
||||
(some-> ($ c :cljsRatom)
|
||||
ratom/dispose!)
|
||||
(batch/mark-rendered c)
|
||||
(when-not (nil? f)
|
||||
(.call f c c))))
|
||||
|
||||
nil))
|
||||
|
||||
(defn get-wrapper [key f name]
|
||||
(let [wrap (custom-wrapper key f)]
|
||||
(when (and wrap f)
|
||||
(assert-callable f))
|
||||
(or wrap f)))
|
||||
|
||||
(def obligatory {:shouldComponentUpdate nil
|
||||
:componentWillMount nil
|
||||
:componentWillUnmount nil})
|
||||
|
||||
(def dash-to-camel (util/memoize-1 util/dash-to-camel))
|
||||
|
||||
(defn camelify-map-keys [fun-map]
|
||||
(reduce-kv (fn [m k v]
|
||||
(assoc m (-> k dash-to-camel keyword) v))
|
||||
{} fun-map))
|
||||
|
||||
(defn add-obligatory [fun-map]
|
||||
(merge obligatory fun-map))
|
||||
|
||||
(defn wrap-funs [fmap]
|
||||
(when (dev?)
|
||||
(let [renders (select-keys fmap [:render :reagentRender :componentFunction])
|
||||
render-fun (-> renders vals first)]
|
||||
(assert (pos? (count renders)) "Missing reagent-render")
|
||||
(assert (== 1 (count renders)) "Too many render functions supplied")
|
||||
(assert-callable render-fun)))
|
||||
(let [render-fun (or (:reagentRender fmap)
|
||||
(:componentFunction fmap))
|
||||
legacy-render (nil? render-fun)
|
||||
render-fun (or render-fun
|
||||
(:render fmap))
|
||||
name (str (or (:displayName fmap)
|
||||
(util/fun-name render-fun)))
|
||||
name (case name
|
||||
"" (str (gensym "reagent"))
|
||||
name)
|
||||
fmap (reduce-kv (fn [m k v]
|
||||
(assoc m k (get-wrapper k v name)))
|
||||
{} fmap)]
|
||||
(assoc fmap
|
||||
:displayName name
|
||||
:autobind false
|
||||
:cljsLegacyRender legacy-render
|
||||
:reagentRender render-fun
|
||||
:render (:render static-fns))))
|
||||
|
||||
(defn map-to-js [m]
|
||||
(reduce-kv (fn [o k v]
|
||||
(doto o
|
||||
(aset (name k) v)))
|
||||
#js{} m))
|
||||
|
||||
(defn cljsify [body]
|
||||
(-> body
|
||||
camelify-map-keys
|
||||
add-obligatory
|
||||
wrap-funs
|
||||
map-to-js))
|
||||
|
||||
(defn create-class [body]
|
||||
{:pre [(map? body)]}
|
||||
(->> body
|
||||
cljsify
|
||||
util/create-class))
|
||||
|
||||
(defn component-path [c]
|
||||
(let [elem (some-> (or (some-> c ($ :_reactInternalInstance))
|
||||
c)
|
||||
($ :_currentElement))
|
||||
name (some-> elem
|
||||
($ :type)
|
||||
($ :displayName))
|
||||
path (some-> elem
|
||||
($ :_owner)
|
||||
component-path
|
||||
(str " > "))
|
||||
res (str path name)]
|
||||
(when-not (empty? res) res)))
|
||||
|
||||
(defn comp-name []
|
||||
(if (dev?)
|
||||
(let [c *current-component*
|
||||
n (or (component-path c)
|
||||
(some-> c .-constructor util/fun-name))]
|
||||
(if-not (empty? n)
|
||||
(str " (in " n ")")
|
||||
""))
|
||||
""))
|
||||
|
||||
(defn fn-to-class [f]
|
||||
(assert-callable f)
|
||||
(warn-unless (not (and (react-class? f)
|
||||
(not (reagent-class? f))))
|
||||
"Using native React classes directly in Hiccup forms "
|
||||
"is not supported. Use create-element or "
|
||||
"adapt-react-class instead: " (let [n (util/fun-name f)]
|
||||
(if (empty? n) f n))
|
||||
(comp-name))
|
||||
(if (reagent-class? f)
|
||||
(cache-react-class f f)
|
||||
(let [spec (meta f)
|
||||
withrender (assoc spec :reagent-render f)
|
||||
res (create-class withrender)]
|
||||
(cache-react-class f res))))
|
||||
|
||||
(defn as-class [tag]
|
||||
(if-some [cached-class (cached-react-class tag)]
|
||||
cached-class
|
||||
(fn-to-class tag)))
|
||||
|
||||
(defn reactify-component [comp]
|
||||
(if (react-class? comp)
|
||||
comp
|
||||
(as-class comp)))
|
||||
@@ -0,0 +1 @@
|
||||
{:rename-macros {}, :renames {}, :externs {Error {}, console {}}, :use-macros {warn-unless reagent.debug, dbg reagent.debug, $! reagent.interop, prn reagent.debug, warn reagent.debug, dev? reagent.debug, $ reagent.interop, assert-callable reagent.debug, error reagent.debug}, :excludes #{}, :name reagent.impl.component, :imports nil, :requires {util reagent.impl.util, reagent.impl.util reagent.impl.util, batch reagent.impl.batching, reagent.impl.batching reagent.impl.batching, ratom reagent.ratom, reagent.ratom reagent.ratom, reagent.interop reagent.interop, reagent.debug reagent.debug}, :cljs.spec/speced-vars [], :uses nil, :defs {get-props {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 41, :column 7, :end-line 41, :end-column 16, :arglists (quote ([c]))}, :name reagent.impl.component/get-props, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 16, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 41, :end-line 41, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, get-wrapper {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 202, :column 7, :end-line 202, :end-column 18, :arglists (quote ([key f name]))}, :name reagent.impl.component/get-wrapper, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 18, :method-params ([key f name]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 202, :end-line 202, :max-fixed-arity 3, :fn-var true, :arglists (quote ([key f name]))}, get-argv {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 38, :column 7, :end-line 38, :end-column 15, :arglists (quote ([c]))}, :name reagent.impl.component/get-argv, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 15, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 38, :end-line 38, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, wrap-render {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 87, :column 7, :end-line 87, :end-column 18, :arglists (quote ([c]))}, :name reagent.impl.component/wrap-render, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 18, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 87, :end-line 87, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, rat-opts {:name reagent.impl.component/rat-opts, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 131, :column 1, :end-line 131, :end-column 14, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 131, :column 6, :end-line 131, :end-column 14}, :tag cljs.core/IMap}, obligatory {:name reagent.impl.component/obligatory, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 208, :column 1, :end-line 208, :end-column 16, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 208, :column 6, :end-line 208, :end-column 16}, :tag cljs.core/IMap}, props-argv {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 33, :column 7, :end-line 33, :end-column 17, :arglists (quote ([c p]))}, :name reagent.impl.component/props-argv, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 17, :method-params ([c p]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 33, :end-line 33, :max-fixed-arity 2, :fn-var true, :arglists (quote ([c p]))}, as-element {:name reagent.impl.component/as-element, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 82, :column 1, :end-line 82, :end-column 20, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 82, :column 10, :end-line 82, :end-column 20}, :tag clj-nil}, do-render {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/component.cljs", :line 113, :column 7, :end-line 113, :end-column 16, :arglists (quote ([c]))}, :name reagent.impl.component/do-render, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/component.cljs", :end-column 16, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 113, :end-line 113, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, comp-name {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/compoLine truncated
|
||||
@@ -0,0 +1,573 @@
|
||||
// Compiled by ClojureScript 1.9.946 {}
|
||||
goog.provide('reagent.impl.component');
|
||||
goog.require('cljs.core');
|
||||
goog.require('reagent.impl.util');
|
||||
goog.require('reagent.impl.batching');
|
||||
goog.require('reagent.ratom');
|
||||
goog.require('reagent.interop');
|
||||
goog.require('reagent.debug');
|
||||
reagent.impl.component.shallow_obj_to_map = (function reagent$impl$component$shallow_obj_to_map(o){
|
||||
var ks = cljs.core.js_keys.call(null,o);
|
||||
var len = ks.length;
|
||||
var m = cljs.core.PersistentArrayMap.EMPTY;
|
||||
var i = (0);
|
||||
while(true){
|
||||
if((i < len)){
|
||||
var k = (ks[i]);
|
||||
var G__37627 = cljs.core.assoc.call(null,m,cljs.core.keyword.call(null,k),(o[k]));
|
||||
var G__37628 = (i + (1));
|
||||
m = G__37627;
|
||||
i = G__37628;
|
||||
continue;
|
||||
} else {
|
||||
return m;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.extract_props = (function reagent$impl$component$extract_props(v){
|
||||
var p = cljs.core.nth.call(null,v,(1),null);
|
||||
if(cljs.core.map_QMARK_.call(null,p)){
|
||||
return p;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.extract_children = (function reagent$impl$component$extract_children(v){
|
||||
var p = cljs.core.nth.call(null,v,(1),null);
|
||||
var first_child = ((((p == null)) || (cljs.core.map_QMARK_.call(null,p)))?(2):(1));
|
||||
if((cljs.core.count.call(null,v) > first_child)){
|
||||
return cljs.core.subvec.call(null,v,first_child);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.props_argv = (function reagent$impl$component$props_argv(c,p){
|
||||
var temp__5459__auto__ = (p["argv"]);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [c.constructor,reagent.impl.component.shallow_obj_to_map.call(null,p)], null);
|
||||
} else {
|
||||
var a = temp__5459__auto__;
|
||||
return a;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.get_argv = (function reagent$impl$component$get_argv(c){
|
||||
return reagent.impl.component.props_argv.call(null,c,(c["props"]));
|
||||
});
|
||||
reagent.impl.component.get_props = (function reagent$impl$component$get_props(c){
|
||||
var p = (c["props"]);
|
||||
var temp__5459__auto__ = (p["argv"]);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return reagent.impl.component.shallow_obj_to_map.call(null,p);
|
||||
} else {
|
||||
var v = temp__5459__auto__;
|
||||
return reagent.impl.component.extract_props.call(null,v);
|
||||
}
|
||||
});
|
||||
reagent.impl.component.get_children = (function reagent$impl$component$get_children(c){
|
||||
var p = (c["props"]);
|
||||
var temp__5459__auto__ = (p["argv"]);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return cljs.core.into.call(null,cljs.core.PersistentVector.EMPTY,(reagent.impl.util.react["Children"]["toArray"])((p["children"])));
|
||||
} else {
|
||||
var v = temp__5459__auto__;
|
||||
return reagent.impl.component.extract_children.call(null,v);
|
||||
}
|
||||
});
|
||||
reagent.impl.component.reagent_class_QMARK_ = (function reagent$impl$component$reagent_class_QMARK_(c){
|
||||
return (cljs.core.fn_QMARK_.call(null,c)) && (!(((function (){var G__37630 = c;
|
||||
var G__37630__$1 = (((G__37630 == null))?null:G__37630.prototype);
|
||||
if((G__37630__$1 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (G__37630__$1["reagentRender"]);
|
||||
}
|
||||
})() == null)));
|
||||
});
|
||||
reagent.impl.component.react_class_QMARK_ = (function reagent$impl$component$react_class_QMARK_(c){
|
||||
return (cljs.core.fn_QMARK_.call(null,c)) && (!(((function (){var G__37632 = c;
|
||||
var G__37632__$1 = (((G__37632 == null))?null:G__37632.prototype);
|
||||
if((G__37632__$1 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (G__37632__$1["render"]);
|
||||
}
|
||||
})() == null)));
|
||||
});
|
||||
reagent.impl.component.reagent_component_QMARK_ = (function reagent$impl$component$reagent_component_QMARK_(c){
|
||||
return !(((c["reagentRender"]) == null));
|
||||
});
|
||||
reagent.impl.component.cached_react_class = (function reagent$impl$component$cached_react_class(c){
|
||||
return (c["cljsReactClass"]);
|
||||
});
|
||||
reagent.impl.component.cache_react_class = (function reagent$impl$component$cache_react_class(c,constructor$){
|
||||
return (c["cljsReactClass"] = constructor$);
|
||||
});
|
||||
reagent.impl.component.state_atom = (function reagent$impl$component$state_atom(this$){
|
||||
var sa = (this$["cljsState"]);
|
||||
if(!((sa == null))){
|
||||
return sa;
|
||||
} else {
|
||||
return (this$["cljsState"] = reagent.ratom.atom.call(null,null));
|
||||
}
|
||||
});
|
||||
if(typeof reagent.impl.component.as_element !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.component.as_element = null;
|
||||
}
|
||||
reagent.impl.component.wrap_render = (function reagent$impl$component$wrap_render(c){
|
||||
while(true){
|
||||
var f = (c["reagentRender"]);
|
||||
var _ = ((cljs.core.ifn_QMARK_.call(null,f))?null:(function(){throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Expected something callable, not ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.pr_str.call(null,f))].join('')),"\n","(clojure.core/ifn? f)"].join('')))})());
|
||||
var res = (((c["cljsLegacyRender"]) === true)?f.call(c,c):(function (){var v = reagent.impl.component.get_argv.call(null,c);
|
||||
var n = cljs.core.count.call(null,v);
|
||||
var G__37633 = n;
|
||||
switch (G__37633) {
|
||||
case (1):
|
||||
return f.call(c);
|
||||
|
||||
break;
|
||||
case (2):
|
||||
return f.call(c,cljs.core.nth.call(null,v,(1)));
|
||||
|
||||
break;
|
||||
case (3):
|
||||
return f.call(c,cljs.core.nth.call(null,v,(1)),cljs.core.nth.call(null,v,(2)));
|
||||
|
||||
break;
|
||||
case (4):
|
||||
return f.call(c,cljs.core.nth.call(null,v,(1)),cljs.core.nth.call(null,v,(2)),cljs.core.nth.call(null,v,(3)));
|
||||
|
||||
break;
|
||||
case (5):
|
||||
return f.call(c,cljs.core.nth.call(null,v,(1)),cljs.core.nth.call(null,v,(2)),cljs.core.nth.call(null,v,(3)),cljs.core.nth.call(null,v,(4)));
|
||||
|
||||
break;
|
||||
default:
|
||||
return f.apply(c,cljs.core.into_array.call(null,v).slice((1)));
|
||||
|
||||
}
|
||||
})());
|
||||
if(cljs.core.vector_QMARK_.call(null,res)){
|
||||
return reagent.impl.component.as_element.call(null,res);
|
||||
} else {
|
||||
if(cljs.core.ifn_QMARK_.call(null,res)){
|
||||
var f__$1 = ((reagent.impl.component.reagent_class_QMARK_.call(null,res))?((function (c,f,_,res){
|
||||
return (function() {
|
||||
var G__37635__delegate = function (args){
|
||||
return reagent.impl.component.as_element.call(null,cljs.core.apply.call(null,cljs.core.vector,res,args));
|
||||
};
|
||||
var G__37635 = function (var_args){
|
||||
var args = null;
|
||||
if (arguments.length > 0) {
|
||||
var G__37636__i = 0, G__37636__a = new Array(arguments.length - 0);
|
||||
while (G__37636__i < G__37636__a.length) {G__37636__a[G__37636__i] = arguments[G__37636__i + 0]; ++G__37636__i;}
|
||||
args = new cljs.core.IndexedSeq(G__37636__a,0,null);
|
||||
}
|
||||
return G__37635__delegate.call(this,args);};
|
||||
G__37635.cljs$lang$maxFixedArity = 0;
|
||||
G__37635.cljs$lang$applyTo = (function (arglist__37637){
|
||||
var args = cljs.core.seq(arglist__37637);
|
||||
return G__37635__delegate(args);
|
||||
});
|
||||
G__37635.cljs$core$IFn$_invoke$arity$variadic = G__37635__delegate;
|
||||
return G__37635;
|
||||
})()
|
||||
;})(c,f,_,res))
|
||||
:res);
|
||||
(c["reagentRender"] = f__$1);
|
||||
|
||||
var G__37638 = c;
|
||||
c = G__37638;
|
||||
continue;
|
||||
} else {
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.do_render = (function reagent$impl$component$do_render(c){
|
||||
var _STAR_current_component_STAR_37639 = reagent.impl.component._STAR_current_component_STAR_;
|
||||
reagent.impl.component._STAR_current_component_STAR_ = c;
|
||||
|
||||
try{var ok = [false];
|
||||
try{var res = reagent.impl.component.wrap_render.call(null,c);
|
||||
(ok[(0)] = true);
|
||||
|
||||
return res;
|
||||
}finally {if(cljs.core.truth_((ok[(0)]))){
|
||||
} else {
|
||||
if(cljs.core.truth_(reagent.debug.has_console)){
|
||||
(cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).error([cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Error rendering component",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.component.comp_name.call(null))].join(''))].join(''));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
}finally {reagent.impl.component._STAR_current_component_STAR_ = _STAR_current_component_STAR_37639;
|
||||
}});
|
||||
reagent.impl.component.rat_opts = new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"no-cache","no-cache",1588056370),true], null);
|
||||
reagent.impl.component.static_fns = new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"render","render",-1408033454),(function reagent$impl$component$render(){
|
||||
var c = this;
|
||||
if(reagent.impl.util._STAR_non_reactive_STAR_){
|
||||
return reagent.impl.component.do_render.call(null,c);
|
||||
} else {
|
||||
var rat = (c["cljsRatom"]);
|
||||
reagent.impl.batching.mark_rendered.call(null,c);
|
||||
|
||||
if((rat == null)){
|
||||
return reagent.ratom.run_in_reaction.call(null,((function (rat,c){
|
||||
return (function (){
|
||||
return reagent.impl.component.do_render.call(null,c);
|
||||
});})(rat,c))
|
||||
,c,"cljsRatom",reagent.impl.batching.queue_render,reagent.impl.component.rat_opts);
|
||||
} else {
|
||||
return rat._run(false);
|
||||
}
|
||||
}
|
||||
})], null);
|
||||
reagent.impl.component.custom_wrapper = (function reagent$impl$component$custom_wrapper(key,f){
|
||||
var G__37640 = key;
|
||||
var G__37640__$1 = (((G__37640 instanceof cljs.core.Keyword))?G__37640.fqn:null);
|
||||
switch (G__37640__$1) {
|
||||
case "getDefaultProps":
|
||||
throw (new Error("getDefaultProps not supported"));
|
||||
|
||||
break;
|
||||
case "getInitialState":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_getInitialState(){
|
||||
var c = this;
|
||||
return cljs.core.reset_BANG_.call(null,reagent.impl.component.state_atom.call(null,c),f.call(c,c));
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentWillReceiveProps":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentWillReceiveProps(nextprops){
|
||||
var c = this;
|
||||
return f.call(c,c,reagent.impl.component.props_argv.call(null,c,nextprops));
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "shouldComponentUpdate":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_shouldComponentUpdate(nextprops,nextstate){
|
||||
var or__35498__auto__ = reagent.impl.util._STAR_always_update_STAR_;
|
||||
if(or__35498__auto__){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
var c = this;
|
||||
var old_argv = (c["props"]["argv"]);
|
||||
var new_argv = (nextprops["argv"]);
|
||||
var noargv = ((old_argv == null)) || ((new_argv == null));
|
||||
if((f == null)){
|
||||
return (noargv) || (cljs.core.not_EQ_.call(null,old_argv,new_argv));
|
||||
} else {
|
||||
if(noargv){
|
||||
return f.call(c,c,reagent.impl.component.get_argv.call(null,c),reagent.impl.component.props_argv.call(null,c,nextprops));
|
||||
} else {
|
||||
return f.call(c,c,old_argv,new_argv);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentWillUpdate":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentWillUpdate(nextprops){
|
||||
var c = this;
|
||||
return f.call(c,c,reagent.impl.component.props_argv.call(null,c,nextprops));
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentDidUpdate":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentDidUpdate(oldprops){
|
||||
var c = this;
|
||||
return f.call(c,c,reagent.impl.component.props_argv.call(null,c,oldprops));
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentWillMount":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentWillMount(){
|
||||
var c = this;
|
||||
(c["cljsMountOrder"] = reagent.impl.batching.next_mount_count.call(null));
|
||||
|
||||
if((f == null)){
|
||||
return null;
|
||||
} else {
|
||||
return f.call(c,c);
|
||||
}
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentDidMount":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentDidMount(){
|
||||
var c = this;
|
||||
return f.call(c,c);
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
case "componentWillUnmount":
|
||||
return ((function (G__37640,G__37640__$1){
|
||||
return (function reagent$impl$component$custom_wrapper_$_componentWillUnmount(){
|
||||
var c = this;
|
||||
var G__37641_37643 = (c["cljsRatom"]);
|
||||
if((G__37641_37643 == null)){
|
||||
} else {
|
||||
reagent.ratom.dispose_BANG_.call(null,G__37641_37643);
|
||||
}
|
||||
|
||||
reagent.impl.batching.mark_rendered.call(null,c);
|
||||
|
||||
if((f == null)){
|
||||
return null;
|
||||
} else {
|
||||
return f.call(c,c);
|
||||
}
|
||||
});
|
||||
;})(G__37640,G__37640__$1))
|
||||
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
});
|
||||
reagent.impl.component.get_wrapper = (function reagent$impl$component$get_wrapper(key,f,name){
|
||||
var wrap = reagent.impl.component.custom_wrapper.call(null,key,f);
|
||||
if(cljs.core.truth_((function (){var and__35486__auto__ = wrap;
|
||||
if(cljs.core.truth_(and__35486__auto__)){
|
||||
return f;
|
||||
} else {
|
||||
return and__35486__auto__;
|
||||
}
|
||||
})())){
|
||||
if(cljs.core.ifn_QMARK_.call(null,f)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Expected something callable, not ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.pr_str.call(null,f))].join('')),"\n","(clojure.core/ifn? f)"].join('')));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
var or__35498__auto__ = wrap;
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return f;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.obligatory = new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"shouldComponentUpdate","shouldComponentUpdate",1795750960),null,new cljs.core.Keyword(null,"componentWillMount","componentWillMount",-285327619),null,new cljs.core.Keyword(null,"componentWillUnmount","componentWillUnmount",1573788814),null], null);
|
||||
reagent.impl.component.dash_to_camel = reagent.impl.util.memoize_1.call(null,reagent.impl.util.dash_to_camel);
|
||||
reagent.impl.component.camelify_map_keys = (function reagent$impl$component$camelify_map_keys(fun_map){
|
||||
return cljs.core.reduce_kv.call(null,(function (m,k,v){
|
||||
return cljs.core.assoc.call(null,m,cljs.core.keyword.call(null,reagent.impl.component.dash_to_camel.call(null,k)),v);
|
||||
}),cljs.core.PersistentArrayMap.EMPTY,fun_map);
|
||||
});
|
||||
reagent.impl.component.add_obligatory = (function reagent$impl$component$add_obligatory(fun_map){
|
||||
return cljs.core.merge.call(null,reagent.impl.component.obligatory,fun_map);
|
||||
});
|
||||
reagent.impl.component.wrap_funs = (function reagent$impl$component$wrap_funs(fmap){
|
||||
var renders_37645 = cljs.core.select_keys.call(null,fmap,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"render","render",-1408033454),new cljs.core.Keyword(null,"reagentRender","reagentRender",-358306383),new cljs.core.Keyword(null,"componentFunction","componentFunction",825866104)], null));
|
||||
var render_fun_37646 = cljs.core.first.call(null,cljs.core.vals.call(null,renders_37645));
|
||||
if((cljs.core.count.call(null,renders_37645) > (0))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ","Missing reagent-render","\n","(pos? (count renders))"].join('')));
|
||||
}
|
||||
|
||||
if(((1) === cljs.core.count.call(null,renders_37645))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ","Too many render functions supplied","\n","(== 1 (count renders))"].join('')));
|
||||
}
|
||||
|
||||
if(cljs.core.ifn_QMARK_.call(null,render_fun_37646)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Expected something callable, not ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.pr_str.call(null,render_fun_37646))].join('')),"\n","(clojure.core/ifn? render-fun)"].join('')));
|
||||
}
|
||||
|
||||
|
||||
var render_fun = (function (){var or__35498__auto__ = new cljs.core.Keyword(null,"reagentRender","reagentRender",-358306383).cljs$core$IFn$_invoke$arity$1(fmap);
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return new cljs.core.Keyword(null,"componentFunction","componentFunction",825866104).cljs$core$IFn$_invoke$arity$1(fmap);
|
||||
}
|
||||
})();
|
||||
var legacy_render = (render_fun == null);
|
||||
var render_fun__$1 = (function (){var or__35498__auto__ = render_fun;
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return new cljs.core.Keyword(null,"render","render",-1408033454).cljs$core$IFn$_invoke$arity$1(fmap);
|
||||
}
|
||||
})();
|
||||
var name = [cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var or__35498__auto__ = new cljs.core.Keyword(null,"displayName","displayName",-809144601).cljs$core$IFn$_invoke$arity$1(fmap);
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return reagent.impl.util.fun_name.call(null,render_fun__$1);
|
||||
}
|
||||
})())].join('');
|
||||
var name__$1 = (function (){var G__37644 = name;
|
||||
switch (G__37644) {
|
||||
case "":
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.gensym.call(null,"reagent"))].join('');
|
||||
|
||||
break;
|
||||
default:
|
||||
return name;
|
||||
|
||||
}
|
||||
})();
|
||||
var fmap__$1 = cljs.core.reduce_kv.call(null,((function (render_fun,legacy_render,render_fun__$1,name,name__$1){
|
||||
return (function (m,k,v){
|
||||
return cljs.core.assoc.call(null,m,k,reagent.impl.component.get_wrapper.call(null,k,v,name__$1));
|
||||
});})(render_fun,legacy_render,render_fun__$1,name,name__$1))
|
||||
,cljs.core.PersistentArrayMap.EMPTY,fmap);
|
||||
return cljs.core.assoc.call(null,fmap__$1,new cljs.core.Keyword(null,"displayName","displayName",-809144601),name__$1,new cljs.core.Keyword(null,"autobind","autobind",-570650245),false,new cljs.core.Keyword(null,"cljsLegacyRender","cljsLegacyRender",-1527295613),legacy_render,new cljs.core.Keyword(null,"reagentRender","reagentRender",-358306383),render_fun__$1,new cljs.core.Keyword(null,"render","render",-1408033454),new cljs.core.Keyword(null,"render","render",-1408033454).cljs$core$IFn$_invoke$arity$1(reagent.impl.component.static_fns));
|
||||
});
|
||||
reagent.impl.component.map_to_js = (function reagent$impl$component$map_to_js(m){
|
||||
return cljs.core.reduce_kv.call(null,(function (o,k,v){
|
||||
var G__37648 = o;
|
||||
(G__37648[cljs.core.name.call(null,k)] = v);
|
||||
|
||||
return G__37648;
|
||||
}),({}),m);
|
||||
});
|
||||
reagent.impl.component.cljsify = (function reagent$impl$component$cljsify(body){
|
||||
return reagent.impl.component.map_to_js.call(null,reagent.impl.component.wrap_funs.call(null,reagent.impl.component.add_obligatory.call(null,reagent.impl.component.camelify_map_keys.call(null,body))));
|
||||
});
|
||||
reagent.impl.component.create_class = (function reagent$impl$component$create_class(body){
|
||||
if(cljs.core.map_QMARK_.call(null,body)){
|
||||
} else {
|
||||
throw (new Error("Assert failed: (map? body)"));
|
||||
}
|
||||
|
||||
return reagent.impl.util.create_class.call(null,reagent.impl.component.cljsify.call(null,body));
|
||||
});
|
||||
reagent.impl.component.component_path = (function reagent$impl$component$component_path(c){
|
||||
var elem = (function (){var G__37649 = (function (){var or__35498__auto__ = (function (){var G__37651 = c;
|
||||
if((G__37651 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (G__37651["_reactInternalInstance"]);
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
})();
|
||||
if((G__37649 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (G__37649["_currentElement"]);
|
||||
}
|
||||
})();
|
||||
var name = (function (){var G__37652 = elem;
|
||||
var G__37652__$1 = (((G__37652 == null))?null:(G__37652["type"]));
|
||||
if((G__37652__$1 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (G__37652__$1["displayName"]);
|
||||
}
|
||||
})();
|
||||
var path = (function (){var G__37653 = elem;
|
||||
var G__37653__$1 = (((G__37653 == null))?null:(G__37653["_owner"]));
|
||||
var G__37653__$2 = (((G__37653__$1 == null))?null:reagent.impl.component.component_path.call(null,G__37653__$1));
|
||||
if((G__37653__$2 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__37653__$2)," > "].join('');
|
||||
}
|
||||
})();
|
||||
var res = [cljs.core.str.cljs$core$IFn$_invoke$arity$1(path),cljs.core.str.cljs$core$IFn$_invoke$arity$1(name)].join('');
|
||||
if(cljs.core.empty_QMARK_.call(null,res)){
|
||||
return null;
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.comp_name = (function reagent$impl$component$comp_name(){
|
||||
var c = reagent.impl.component._STAR_current_component_STAR_;
|
||||
var n = (function (){var or__35498__auto__ = reagent.impl.component.component_path.call(null,c);
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
var G__37654 = c;
|
||||
var G__37654__$1 = (((G__37654 == null))?null:G__37654.constructor);
|
||||
if((G__37654__$1 == null)){
|
||||
return null;
|
||||
} else {
|
||||
return reagent.impl.util.fun_name.call(null,G__37654__$1);
|
||||
}
|
||||
}
|
||||
})();
|
||||
if(!(cljs.core.empty_QMARK_.call(null,n))){
|
||||
return [" (in ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(n),")"].join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
});
|
||||
reagent.impl.component.fn_to_class = (function reagent$impl$component$fn_to_class(f){
|
||||
if(cljs.core.ifn_QMARK_.call(null,f)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Expected something callable, not ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.pr_str.call(null,f))].join('')),"\n","(clojure.core/ifn? f)"].join('')));
|
||||
}
|
||||
|
||||
if(!(!((reagent.impl.component.react_class_QMARK_.call(null,f)) && (!(reagent.impl.component.reagent_class_QMARK_.call(null,f)))))){
|
||||
if(cljs.core.truth_(reagent.debug.has_console)){
|
||||
(cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).warn(["Warning: ","Using native React classes directly in Hiccup forms ","is not supported. Use create-element or ","adapt-react-class instead: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var n = reagent.impl.util.fun_name.call(null,f);
|
||||
if(cljs.core.empty_QMARK_.call(null,n)){
|
||||
return f;
|
||||
} else {
|
||||
return n;
|
||||
}
|
||||
})()),cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.component.comp_name.call(null))].join(''));
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if(reagent.impl.component.reagent_class_QMARK_.call(null,f)){
|
||||
return reagent.impl.component.cache_react_class.call(null,f,f);
|
||||
} else {
|
||||
var spec = cljs.core.meta.call(null,f);
|
||||
var withrender = cljs.core.assoc.call(null,spec,new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853),f);
|
||||
var res = reagent.impl.component.create_class.call(null,withrender);
|
||||
return reagent.impl.component.cache_react_class.call(null,f,res);
|
||||
}
|
||||
});
|
||||
reagent.impl.component.as_class = (function reagent$impl$component$as_class(tag){
|
||||
var temp__5459__auto__ = reagent.impl.component.cached_react_class.call(null,tag);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return reagent.impl.component.fn_to_class.call(null,tag);
|
||||
} else {
|
||||
var cached_class = temp__5459__auto__;
|
||||
return cached_class;
|
||||
}
|
||||
});
|
||||
reagent.impl.component.reactify_component = (function reagent$impl$component$reactify_component(comp){
|
||||
if(reagent.impl.component.react_class_QMARK_.call(null,comp)){
|
||||
return comp;
|
||||
} else {
|
||||
return reagent.impl.component.as_class.call(null,comp);
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=component.js.map?rel=1517021941100
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/didier\/clojupyter\/website\/target\/cljsbuild\/public\/js\/out\/reagent\/impl\/component.js","sources":["component.cljs?rel=1517021941102"],"lineCount":573,"mappings":";AAAA;;;;;;;AAQ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ZAAMC;AAFvC,AAGE,GACE,MAAA,LAAMvC;AAAG,QAAIwC,YAAO,AAACC,4BAAKH,SAASC;;AADrC,GAEEC;AAAO,OAAOxC,OAAEvB,EAAEA,EAAE,AAACG,0CAASH,GAAG,AAACD,4CAAWC,EAAEyD;;AAFjD,AAGS,OAAOlC,OAAEvB,EAAEA,EAAE6D,SAASC;;;;;;;;;KAxBlD;AA2BE;6EAAyBL;AAAzB,AACE,QAAA,JAASzD;AAAT,AAAW,OAAOuB,OAAEvB,EAAEA,EAAE,AAACD,4CAAWC,EAAEyD;;;;;KA5B1C;AA+BE;4EAAwBQ;AAAxB,AACE,QAAA,JAASjE;AAAT,AAAW,OAAOuB,OAAEvB,EAAEA,EAAE,AAACD,4CAAWC,EAAEiE;;;;;KAhC1C;AAmCE;;AAAA,AACE,QAAA,JAASjE;AAAT,AACS,GAAA,FAAIA,sBAAkB,AAACkE;;AACvB,GAAU,MAAA,LAAM3C;AAAhB;;AAAA,AACE,OAAOA,OAAEvB,EAAEA;;;;;;KAvC1B;AA0CE;;AAAA,AACE,QAAA,JAASA;ALine truncated
|
||||
@@ -0,0 +1,405 @@
|
||||
(ns reagent.impl.template
|
||||
(:require [clojure.string :as string]
|
||||
[clojure.walk :refer [prewalk]]
|
||||
[reagent.impl.util :as util :refer [is-client]]
|
||||
[reagent.impl.component :as comp]
|
||||
[reagent.impl.batching :as batch]
|
||||
[reagent.ratom :as ratom]
|
||||
[reagent.interop :refer-macros [$ $!]]
|
||||
[reagent.debug :refer-macros [dbg prn println log dev?
|
||||
warn warn-unless]]))
|
||||
|
||||
;; From Weavejester's Hiccup, via pump:
|
||||
(def ^{:doc "Regular expression that parses a CSS-style id and class
|
||||
from a tag name."}
|
||||
re-tag #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?")
|
||||
|
||||
(deftype NativeWrapper [])
|
||||
|
||||
|
||||
;;; Common utilities
|
||||
|
||||
(defn ^boolean named? [x]
|
||||
(or (keyword? x)
|
||||
(symbol? x)))
|
||||
|
||||
(defn ^boolean hiccup-tag? [x]
|
||||
(or (named? x)
|
||||
(string? x)))
|
||||
|
||||
(defn ^boolean valid-tag? [x]
|
||||
(or (hiccup-tag? x)
|
||||
(ifn? x)
|
||||
(instance? NativeWrapper x)))
|
||||
|
||||
|
||||
;;; Props conversion
|
||||
|
||||
(def prop-name-cache #js{:class "className"
|
||||
:for "htmlFor"
|
||||
:charset "charSet"})
|
||||
|
||||
(defn cache-get [o k]
|
||||
(when ^boolean (.hasOwnProperty o k)
|
||||
(aget o k)))
|
||||
|
||||
(defn cached-prop-name [k]
|
||||
(if (named? k)
|
||||
(if-some [k' (cache-get prop-name-cache (name k))]
|
||||
k'
|
||||
(aset prop-name-cache (name k)
|
||||
(util/dash-to-camel k)))
|
||||
k))
|
||||
|
||||
(defn ^boolean js-val? [x]
|
||||
(not (identical? "object" (goog/typeOf x))))
|
||||
|
||||
(declare convert-prop-value)
|
||||
|
||||
(defn kv-conv [o k v]
|
||||
(doto o
|
||||
(aset (cached-prop-name k)
|
||||
(convert-prop-value v))))
|
||||
|
||||
(defn convert-prop-value [x]
|
||||
(cond (js-val? x) x
|
||||
(named? x) (name x)
|
||||
(map? x) (reduce-kv kv-conv #js{} x)
|
||||
(coll? x) (clj->js x)
|
||||
(ifn? x) (fn [& args]
|
||||
(apply x args))
|
||||
:else (clj->js x)))
|
||||
|
||||
(defn oset [o k v]
|
||||
(doto (if (nil? o) #js{} o)
|
||||
(aset k v)))
|
||||
|
||||
(defn oget [o k]
|
||||
(if (nil? o) nil (aget o k)))
|
||||
|
||||
(defn set-id-class [p id-class]
|
||||
(let [id ($ id-class :id)
|
||||
p (if (and (some? id)
|
||||
(nil? (oget p "id")))
|
||||
(oset p "id" id)
|
||||
p)]
|
||||
(if-some [class ($ id-class :className)]
|
||||
(let [old (oget p "className")]
|
||||
(oset p "className" (if (nil? old)
|
||||
class
|
||||
(str class " " old))))
|
||||
p)))
|
||||
|
||||
(defn convert-props [props id-class]
|
||||
(-> props
|
||||
convert-prop-value
|
||||
(set-id-class id-class)))
|
||||
|
||||
|
||||
;;; Specialization for input components
|
||||
|
||||
;; This gets set from reagent.dom
|
||||
(defonce find-dom-node nil)
|
||||
|
||||
;; <input type="??" >
|
||||
;; The properites 'selectionStart' and 'selectionEnd' only exist on some inputs
|
||||
;; See: https://html.spec.whatwg.org/multipage/forms.html#do-not-apply
|
||||
(def these-inputs-have-selection-api #{"text" "textarea" "password" "search"
|
||||
"tel" "url"})
|
||||
|
||||
(defn ^boolean has-selection-api?
|
||||
[input-type]
|
||||
(contains? these-inputs-have-selection-api input-type))
|
||||
|
||||
(defn input-set-value [this]
|
||||
(when ($ this :cljsInputLive)
|
||||
($! this :cljsInputDirty false)
|
||||
(let [rendered-value ($ this :cljsRenderedValue)
|
||||
dom-value ($ this :cljsDOMValue)
|
||||
node (find-dom-node this)]
|
||||
(when (not= rendered-value dom-value)
|
||||
(if-not (and (identical? node ($ js/document :activeElement))
|
||||
(has-selection-api? ($ node :type))
|
||||
(string? rendered-value)
|
||||
(string? dom-value))
|
||||
;; just set the value, no need to worry about a cursor
|
||||
(do
|
||||
($! this :cljsDOMValue rendered-value)
|
||||
($! node :value rendered-value))
|
||||
|
||||
;; Setting "value" (below) moves the cursor position to the
|
||||
;; end which gives the user a jarring experience.
|
||||
;;
|
||||
;; But repositioning the cursor within the text, turns out to
|
||||
;; be quite a challenge because changes in the text can be
|
||||
;; triggered by various events like:
|
||||
;; - a validation function rejecting a user inputted char
|
||||
;; - the user enters a lower case char, but is transformed to
|
||||
;; upper.
|
||||
;; - the user selects multiple chars and deletes text
|
||||
;; - the user pastes in multiple chars, and some of them are
|
||||
;; rejected by a validator.
|
||||
;; - the user selects multiple chars and then types in a
|
||||
;; single new char to repalce them all.
|
||||
;; Coming up with a sane cursor repositioning strategy hasn't
|
||||
;; been easy ALTHOUGH in the end, it kinda fell out nicely,
|
||||
;; and it appears to sanely handle all the cases we could
|
||||
;; think of.
|
||||
;; So this is just a warning. The code below is simple
|
||||
;; enough, but if you are tempted to change it, be aware of
|
||||
;; all the scenarios you have handle.
|
||||
(let [node-value ($ node :value)]
|
||||
(if (not= node-value dom-value)
|
||||
;; IE has not notified us of the change yet, so check again later
|
||||
(batch/do-after-render #(input-set-value this))
|
||||
(let [existing-offset-from-end (- (count node-value)
|
||||
($ node :selectionStart))
|
||||
new-cursor-offset (- (count rendered-value)
|
||||
existing-offset-from-end)]
|
||||
($! this :cljsDOMValue rendered-value)
|
||||
($! node :value rendered-value)
|
||||
($! node :selectionStart new-cursor-offset)
|
||||
($! node :selectionEnd new-cursor-offset)))))))))
|
||||
|
||||
(defn input-handle-change [this on-change e]
|
||||
($! this :cljsDOMValue (-> e .-target .-value))
|
||||
;; Make sure the input is re-rendered, in case on-change
|
||||
;; wants to keep the value unchanged
|
||||
(when-not ($ this :cljsInputDirty)
|
||||
($! this :cljsInputDirty true)
|
||||
(batch/do-after-render #(input-set-value this)))
|
||||
(on-change e))
|
||||
|
||||
(defn input-render-setup [this jsprops]
|
||||
;; Don't rely on React for updating "controlled inputs", since it
|
||||
;; doesn't play well with async rendering (misses keystrokes).
|
||||
(when (and (some? jsprops)
|
||||
(.hasOwnProperty jsprops "onChange")
|
||||
(.hasOwnProperty jsprops "value"))
|
||||
(assert find-dom-node
|
||||
"reagent.dom needs to be loaded for controlled input to work")
|
||||
(let [v ($ jsprops :value)
|
||||
value (if (nil? v) "" v)
|
||||
on-change ($ jsprops :onChange)]
|
||||
(when-not ($ this :cljsInputLive)
|
||||
;; set initial value
|
||||
($! this :cljsInputLive true)
|
||||
($! this :cljsDOMValue value))
|
||||
($! this :cljsRenderedValue value)
|
||||
(js-delete jsprops "value")
|
||||
(doto jsprops
|
||||
($! :defaultValue value)
|
||||
($! :onChange #(input-handle-change this on-change %))))))
|
||||
|
||||
(defn input-unmount [this]
|
||||
($! this :cljsInputLive nil))
|
||||
|
||||
(defn ^boolean input-component? [x]
|
||||
(case x
|
||||
("input" "textarea") true
|
||||
false))
|
||||
|
||||
(def reagent-input-class nil)
|
||||
|
||||
(declare make-element)
|
||||
|
||||
(def input-spec
|
||||
{:display-name "ReagentInput"
|
||||
:component-did-update input-set-value
|
||||
:component-will-unmount input-unmount
|
||||
:reagent-render
|
||||
(fn [argv comp jsprops first-child]
|
||||
(let [this comp/*current-component*]
|
||||
(input-render-setup this jsprops)
|
||||
(make-element argv comp jsprops first-child)))})
|
||||
|
||||
(defn reagent-input []
|
||||
(when (nil? reagent-input-class)
|
||||
(set! reagent-input-class (comp/create-class input-spec)))
|
||||
reagent-input-class)
|
||||
|
||||
|
||||
;;; Conversion from Hiccup forms
|
||||
|
||||
(defn parse-tag [hiccup-tag]
|
||||
(let [[tag id class] (->> hiccup-tag name (re-matches re-tag) next)
|
||||
class (when-not (nil? class)
|
||||
(string/replace class #"\." " "))]
|
||||
(assert tag (str "Invalid tag: '" hiccup-tag "'"
|
||||
(comp/comp-name)))
|
||||
#js{:name tag
|
||||
:id id
|
||||
:className class}))
|
||||
|
||||
(defn try-get-key [x]
|
||||
;; try catch to avoid clojurescript peculiarity with
|
||||
;; sorted-maps with keys that are numbers
|
||||
(try (get x :key)
|
||||
(catch :default e)))
|
||||
|
||||
(defn get-key [x]
|
||||
(when (map? x)
|
||||
(try-get-key x)))
|
||||
|
||||
(defn key-from-vec [v]
|
||||
(if-some [k (-> (meta v) get-key)]
|
||||
k
|
||||
(-> v (nth 1 nil) get-key)))
|
||||
|
||||
(defn reag-element [tag v]
|
||||
(let [c (comp/as-class tag)
|
||||
jsprops #js{:argv v}]
|
||||
(when-some [key (key-from-vec v)]
|
||||
($! jsprops :key key))
|
||||
($ util/react createElement c jsprops)))
|
||||
|
||||
(defn adapt-react-class [c]
|
||||
(doto (->NativeWrapper)
|
||||
($! :name c)
|
||||
($! :id nil)
|
||||
($! :class nil)))
|
||||
|
||||
(def tag-name-cache #js{})
|
||||
|
||||
(defn cached-parse [x]
|
||||
(if-some [s (cache-get tag-name-cache x)]
|
||||
s
|
||||
(aset tag-name-cache x (parse-tag x))))
|
||||
|
||||
(declare as-element)
|
||||
|
||||
(defn native-element [parsed argv first]
|
||||
(let [comp ($ parsed :name)]
|
||||
(let [props (nth argv first nil)
|
||||
hasprops (or (nil? props) (map? props))
|
||||
jsprops (convert-props (if hasprops props) parsed)
|
||||
first-child (+ first (if hasprops 1 0))]
|
||||
(if (input-component? comp)
|
||||
(-> [(reagent-input) argv comp jsprops first-child]
|
||||
(with-meta (meta argv))
|
||||
as-element)
|
||||
(let [key (-> (meta argv) get-key)
|
||||
p (if (nil? key)
|
||||
jsprops
|
||||
(oset jsprops "key" key))]
|
||||
(make-element argv comp p first-child))))))
|
||||
|
||||
(defn str-coll [coll]
|
||||
(if (dev?)
|
||||
(str (prewalk (fn [x]
|
||||
(if (fn? x)
|
||||
(let [n (util/fun-name x)]
|
||||
(case n "" x (symbol n)))
|
||||
x)) coll))
|
||||
(str coll)))
|
||||
|
||||
(defn hiccup-err [v & msg]
|
||||
(str (apply str msg) ": " (str-coll v) "\n" (comp/comp-name)))
|
||||
|
||||
(defn vec-to-elem [v]
|
||||
(assert (pos? (count v)) (hiccup-err v "Hiccup form should not be empty"))
|
||||
(let [tag (nth v 0 nil)]
|
||||
(assert (valid-tag? tag) (hiccup-err v "Invalid Hiccup form"))
|
||||
(cond
|
||||
(hiccup-tag? tag)
|
||||
(let [n (name tag)
|
||||
pos (.indexOf n ">")]
|
||||
(case pos
|
||||
-1 (native-element (cached-parse n) v 1)
|
||||
0 (let [comp (nth v 1 nil)]
|
||||
;; Support [:> comp ...]
|
||||
(assert (= ">" n) (hiccup-err v "Invalid Hiccup tag"))
|
||||
(assert (or (string? comp) (fn? comp))
|
||||
(hiccup-err v "Expected React component in"))
|
||||
(native-element #js{:name comp} v 2))
|
||||
;; Support extended hiccup syntax, i.e :div.bar>a.foo
|
||||
(recur [(subs n 0 pos)
|
||||
(assoc v 0 (subs n (inc pos)))])))
|
||||
|
||||
(instance? NativeWrapper tag)
|
||||
(native-element tag v 1)
|
||||
|
||||
:else (reag-element tag v))))
|
||||
|
||||
(declare expand-seq)
|
||||
(declare expand-seq-check)
|
||||
|
||||
(defn as-element [x]
|
||||
(cond (js-val? x) x
|
||||
(vector? x) (vec-to-elem x)
|
||||
(seq? x) (if (dev?)
|
||||
(expand-seq-check x)
|
||||
(expand-seq x))
|
||||
(named? x) (name x)
|
||||
(satisfies? IPrintWithWriter x) (pr-str x)
|
||||
:else x))
|
||||
|
||||
(set! comp/as-element as-element)
|
||||
|
||||
(defn expand-seq [s]
|
||||
(let [a (into-array s)]
|
||||
(dotimes [i (alength a)]
|
||||
(aset a i (as-element (aget a i))))
|
||||
a))
|
||||
|
||||
(defn expand-seq-dev [s o]
|
||||
(let [a (into-array s)]
|
||||
(dotimes [i (alength a)]
|
||||
(let [val (aget a i)]
|
||||
(when (and (vector? val)
|
||||
(nil? (key-from-vec val)))
|
||||
($! o :no-key true))
|
||||
(aset a i (as-element val))))
|
||||
a))
|
||||
|
||||
(defn expand-seq-check [x]
|
||||
(let [ctx #js{}
|
||||
[res derefed] (ratom/check-derefs #(expand-seq-dev x ctx))]
|
||||
(when derefed
|
||||
(warn (hiccup-err x "Reactive deref not supported in lazy seq, "
|
||||
"it should be wrapped in doall")))
|
||||
(when ($ ctx :no-key)
|
||||
(warn (hiccup-err x "Every element in a seq should have a unique :key")))
|
||||
res))
|
||||
|
||||
;; From https://github.com/babel/babel/commit/1d0e68f5a19d721fe8799b1ea331041d8bf9120e
|
||||
;; (def react-element-type (or (and (exists? js/Symbol)
|
||||
;; ($ js/Symbol :for)
|
||||
;; ($ js/Symbol for "react.element"))
|
||||
;; 60103))
|
||||
|
||||
;; (defn make-element-fast [argv comp jsprops first-child]
|
||||
;; (let [key (some-> jsprops ($ :key))
|
||||
;; ref (some-> jsprops ($ :ref))
|
||||
;; props (if (nil? jsprops) (js-obj) jsprops)]
|
||||
;; ($! props :children
|
||||
;; (case (- (count argv) first-child)
|
||||
;; 0 nil
|
||||
;; 1 (as-element (nth argv first-child))
|
||||
;; (reduce-kv (fn [a k v]
|
||||
;; (when (>= k first-child)
|
||||
;; (.push a (as-element v)))
|
||||
;; a)
|
||||
;; #js[] argv)))
|
||||
;; (js-obj "key" key
|
||||
;; "ref" ref
|
||||
;; "props" props
|
||||
;; "$$typeof" react-element-type
|
||||
;; "type" comp
|
||||
;; ;; "_store" (js-obj)
|
||||
;; )))
|
||||
|
||||
(defn make-element [argv comp jsprops first-child]
|
||||
(case (- (count argv) first-child)
|
||||
;; Optimize cases of zero or one child
|
||||
0 ($ util/react createElement comp jsprops)
|
||||
|
||||
1 ($ util/react createElement comp jsprops
|
||||
(as-element (nth argv first-child nil)))
|
||||
|
||||
(.apply ($ util/react :createElement) nil
|
||||
(reduce-kv (fn [a k v]
|
||||
(when (>= k first-child)
|
||||
(.push a (as-element v)))
|
||||
a)
|
||||
#js[comp jsprops] argv))))
|
||||
@@ -0,0 +1 @@
|
||||
{:rename-macros {}, :renames {}, :externs {document {}, Error {}, console {}}, :use-macros {log reagent.debug, warn-unless reagent.debug, dbg reagent.debug, $! reagent.interop, prn reagent.debug, warn reagent.debug, dev? reagent.debug, prewalk clojure.walk, println reagent.debug, $ reagent.interop}, :excludes #{}, :name reagent.impl.template, :imports nil, :requires {reagent.impl.util reagent.impl.util, comp reagent.impl.component, reagent.interop reagent.interop, reagent.ratom reagent.ratom, reagent.impl.batching reagent.impl.batching, reagent.impl.component reagent.impl.component, util reagent.impl.util, ratom reagent.ratom, string clojure.string, batch reagent.impl.batching, reagent.debug reagent.debug, clojure.string clojure.string, clojure.walk clojure.walk}, :cljs.spec/speced-vars [], :uses {prewalk clojure.walk, is-client reagent.impl.util}, :defs {valid-tag? {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 30, :column 16, :end-line 30, :end-column 26, :tag boolean, :arglists (quote ([x]))}, :name reagent.impl.template/valid-tag?, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 26, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 30, :ret-tag boolean, :end-line 30, :max-fixed-arity 1, :tag boolean, :fn-var true, :arglists (quote ([x]))}, adapt-react-class {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 256, :column 7, :end-line 256, :end-column 24, :arglists (quote ([c]))}, :name reagent.impl.template/adapt-react-class, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 24, :method-params ([c]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 256, :end-line 256, :max-fixed-arity 1, :fn-var true, :arglists (quote ([c]))}, has-selection-api? {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 110, :column 16, :end-line 110, :end-column 34, :tag boolean, :arglists (quote ([input-type]))}, :name reagent.impl.template/has-selection-api?, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 34, :method-params ([input-type]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 110, :ret-tag boolean, :end-line 110, :max-fixed-arity 1, :tag boolean, :fn-var true, :arglists (quote ([input-type]))}, str-coll {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 287, :column 7, :end-line 287, :end-column 15, :arglists (quote ([coll]))}, :name reagent.impl.template/str-coll, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 15, :method-params ([coll]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 287, :end-line 287, :max-fixed-arity 1, :fn-var true, :arglists (quote ([coll]))}, get-key {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 240, :column 7, :end-line 240, :end-column 14, :arglists (quote ([x]))}, :name reagent.impl.template/get-key, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 14, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 240, :end-line 240, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}, re-tag {:name reagent.impl.template/re-tag, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 13, :column 1, :end-line 15, :end-column 9, :doc "Regular expression that parses a CSS-style id and class\n from a tag name.", :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 15, :column 3, :end-line 15, :end-column 9, :doc "Regular expression that parses a CSS-style id and class\n from a tag name."}, :tag any}, reag-element {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 249, :column 7, :end-line 249, :end-column 19, :arglists (quote ([tag v]))}, :name reagent.impl.template/reag-element, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/template.cljs", :end-column 19, :method-params ([tag v]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 249, :end-line 249, :max-fixed-arity 2, :fn-var true, :arglists (quote ([tag v]))}, as-element {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/template.cljs", :line 327, :column 7, :end-line 327, :end-column 17, :arglists (quote ([x]))}, :name reagent.impl.template/as-element, :variadic false, :file "target/cljsbuild/publicLine truncated
|
||||
@@ -0,0 +1,596 @@
|
||||
// Compiled by ClojureScript 1.9.946 {}
|
||||
goog.provide('reagent.impl.template');
|
||||
goog.require('cljs.core');
|
||||
goog.require('clojure.string');
|
||||
goog.require('clojure.walk');
|
||||
goog.require('reagent.impl.util');
|
||||
goog.require('reagent.impl.component');
|
||||
goog.require('reagent.impl.batching');
|
||||
goog.require('reagent.ratom');
|
||||
goog.require('reagent.interop');
|
||||
goog.require('reagent.debug');
|
||||
/**
|
||||
* Regular expression that parses a CSS-style id and class
|
||||
* from a tag name.
|
||||
*/
|
||||
reagent.impl.template.re_tag = /([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?/;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
reagent.impl.template.NativeWrapper = (function (){
|
||||
});
|
||||
|
||||
reagent.impl.template.NativeWrapper.getBasis = (function (){
|
||||
return cljs.core.PersistentVector.EMPTY;
|
||||
});
|
||||
|
||||
reagent.impl.template.NativeWrapper.cljs$lang$type = true;
|
||||
|
||||
reagent.impl.template.NativeWrapper.cljs$lang$ctorStr = "reagent.impl.template/NativeWrapper";
|
||||
|
||||
reagent.impl.template.NativeWrapper.cljs$lang$ctorPrWriter = (function (this__36169__auto__,writer__36170__auto__,opt__36171__auto__){
|
||||
return cljs.core._write.call(null,writer__36170__auto__,"reagent.impl.template/NativeWrapper");
|
||||
});
|
||||
|
||||
reagent.impl.template.__GT_NativeWrapper = (function reagent$impl$template$__GT_NativeWrapper(){
|
||||
return (new reagent.impl.template.NativeWrapper());
|
||||
});
|
||||
|
||||
reagent.impl.template.named_QMARK_ = (function reagent$impl$template$named_QMARK_(x){
|
||||
return ((x instanceof cljs.core.Keyword)) || ((x instanceof cljs.core.Symbol));
|
||||
});
|
||||
reagent.impl.template.hiccup_tag_QMARK_ = (function reagent$impl$template$hiccup_tag_QMARK_(x){
|
||||
return (reagent.impl.template.named_QMARK_.call(null,x)) || (typeof x === 'string');
|
||||
});
|
||||
reagent.impl.template.valid_tag_QMARK_ = (function reagent$impl$template$valid_tag_QMARK_(x){
|
||||
return (reagent.impl.template.hiccup_tag_QMARK_.call(null,x)) || (cljs.core.ifn_QMARK_.call(null,x)) || ((x instanceof reagent.impl.template.NativeWrapper));
|
||||
});
|
||||
reagent.impl.template.prop_name_cache = ({"class": "className", "for": "htmlFor", "charset": "charSet"});
|
||||
reagent.impl.template.cache_get = (function reagent$impl$template$cache_get(o,k){
|
||||
if(o.hasOwnProperty(k)){
|
||||
return (o[k]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.cached_prop_name = (function reagent$impl$template$cached_prop_name(k){
|
||||
if(reagent.impl.template.named_QMARK_.call(null,k)){
|
||||
var temp__5459__auto__ = reagent.impl.template.cache_get.call(null,reagent.impl.template.prop_name_cache,cljs.core.name.call(null,k));
|
||||
if((temp__5459__auto__ == null)){
|
||||
return (reagent.impl.template.prop_name_cache[cljs.core.name.call(null,k)] = reagent.impl.util.dash_to_camel.call(null,k));
|
||||
} else {
|
||||
var k_SINGLEQUOTE_ = temp__5459__auto__;
|
||||
return k_SINGLEQUOTE_;
|
||||
}
|
||||
} else {
|
||||
return k;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.js_val_QMARK_ = (function reagent$impl$template$js_val_QMARK_(x){
|
||||
return !(("object" === goog.typeOf(x)));
|
||||
});
|
||||
reagent.impl.template.kv_conv = (function reagent$impl$template$kv_conv(o,k,v){
|
||||
var G__37667 = o;
|
||||
(G__37667[reagent.impl.template.cached_prop_name.call(null,k)] = reagent.impl.template.convert_prop_value.call(null,v));
|
||||
|
||||
return G__37667;
|
||||
});
|
||||
reagent.impl.template.convert_prop_value = (function reagent$impl$template$convert_prop_value(x){
|
||||
if(reagent.impl.template.js_val_QMARK_.call(null,x)){
|
||||
return x;
|
||||
} else {
|
||||
if(reagent.impl.template.named_QMARK_.call(null,x)){
|
||||
return cljs.core.name.call(null,x);
|
||||
} else {
|
||||
if(cljs.core.map_QMARK_.call(null,x)){
|
||||
return cljs.core.reduce_kv.call(null,reagent.impl.template.kv_conv,({}),x);
|
||||
} else {
|
||||
if(cljs.core.coll_QMARK_.call(null,x)){
|
||||
return cljs.core.clj__GT_js.call(null,x);
|
||||
} else {
|
||||
if(cljs.core.ifn_QMARK_.call(null,x)){
|
||||
return (function() {
|
||||
var G__37668__delegate = function (args){
|
||||
return cljs.core.apply.call(null,x,args);
|
||||
};
|
||||
var G__37668 = function (var_args){
|
||||
var args = null;
|
||||
if (arguments.length > 0) {
|
||||
var G__37669__i = 0, G__37669__a = new Array(arguments.length - 0);
|
||||
while (G__37669__i < G__37669__a.length) {G__37669__a[G__37669__i] = arguments[G__37669__i + 0]; ++G__37669__i;}
|
||||
args = new cljs.core.IndexedSeq(G__37669__a,0,null);
|
||||
}
|
||||
return G__37668__delegate.call(this,args);};
|
||||
G__37668.cljs$lang$maxFixedArity = 0;
|
||||
G__37668.cljs$lang$applyTo = (function (arglist__37670){
|
||||
var args = cljs.core.seq(arglist__37670);
|
||||
return G__37668__delegate(args);
|
||||
});
|
||||
G__37668.cljs$core$IFn$_invoke$arity$variadic = G__37668__delegate;
|
||||
return G__37668;
|
||||
})()
|
||||
;
|
||||
} else {
|
||||
return cljs.core.clj__GT_js.call(null,x);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
reagent.impl.template.oset = (function reagent$impl$template$oset(o,k,v){
|
||||
var G__37671 = (((o == null))?({}):o);
|
||||
(G__37671[k] = v);
|
||||
|
||||
return G__37671;
|
||||
});
|
||||
reagent.impl.template.oget = (function reagent$impl$template$oget(o,k){
|
||||
if((o == null)){
|
||||
return null;
|
||||
} else {
|
||||
return (o[k]);
|
||||
}
|
||||
});
|
||||
reagent.impl.template.set_id_class = (function reagent$impl$template$set_id_class(p,id_class){
|
||||
var id = (id_class["id"]);
|
||||
var p__$1 = (((!((id == null))) && ((reagent.impl.template.oget.call(null,p,"id") == null)))?reagent.impl.template.oset.call(null,p,"id",id):p);
|
||||
var temp__5459__auto__ = (id_class["className"]);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return p__$1;
|
||||
} else {
|
||||
var class$ = temp__5459__auto__;
|
||||
var old = reagent.impl.template.oget.call(null,p__$1,"className");
|
||||
return reagent.impl.template.oset.call(null,p__$1,"className",(((old == null))?class$:[cljs.core.str.cljs$core$IFn$_invoke$arity$1(class$)," ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(old)].join('')));
|
||||
}
|
||||
});
|
||||
reagent.impl.template.convert_props = (function reagent$impl$template$convert_props(props,id_class){
|
||||
return reagent.impl.template.set_id_class.call(null,reagent.impl.template.convert_prop_value.call(null,props),id_class);
|
||||
});
|
||||
if(typeof reagent.impl.template.find_dom_node !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.template.find_dom_node = null;
|
||||
}
|
||||
reagent.impl.template.these_inputs_have_selection_api = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 6, ["url",null,"tel",null,"text",null,"textarea",null,"password",null,"search",null], null), null);
|
||||
reagent.impl.template.has_selection_api_QMARK_ = (function reagent$impl$template$has_selection_api_QMARK_(input_type){
|
||||
return cljs.core.contains_QMARK_.call(null,reagent.impl.template.these_inputs_have_selection_api,input_type);
|
||||
});
|
||||
reagent.impl.template.input_set_value = (function reagent$impl$template$input_set_value(this$){
|
||||
if(cljs.core.truth_((this$["cljsInputLive"]))){
|
||||
(this$["cljsInputDirty"] = false);
|
||||
|
||||
var rendered_value = (this$["cljsRenderedValue"]);
|
||||
var dom_value = (this$["cljsDOMValue"]);
|
||||
var node = reagent.impl.template.find_dom_node.call(null,this$);
|
||||
if(cljs.core.not_EQ_.call(null,rendered_value,dom_value)){
|
||||
if(!(((node === (document["activeElement"]))) && (reagent.impl.template.has_selection_api_QMARK_.call(null,(node["type"]))) && (typeof rendered_value === 'string') && (typeof dom_value === 'string'))){
|
||||
(this$["cljsDOMValue"] = rendered_value);
|
||||
|
||||
return (node["value"] = rendered_value);
|
||||
} else {
|
||||
var node_value = (node["value"]);
|
||||
if(cljs.core.not_EQ_.call(null,node_value,dom_value)){
|
||||
return reagent.impl.batching.do_after_render.call(null,((function (node_value,rendered_value,dom_value,node){
|
||||
return (function (){
|
||||
return reagent.impl.template.input_set_value.call(null,this$);
|
||||
});})(node_value,rendered_value,dom_value,node))
|
||||
);
|
||||
} else {
|
||||
var existing_offset_from_end = (cljs.core.count.call(null,node_value) - (node["selectionStart"]));
|
||||
var new_cursor_offset = (cljs.core.count.call(null,rendered_value) - existing_offset_from_end);
|
||||
(this$["cljsDOMValue"] = rendered_value);
|
||||
|
||||
(node["value"] = rendered_value);
|
||||
|
||||
(node["selectionStart"] = new_cursor_offset);
|
||||
|
||||
return (node["selectionEnd"] = new_cursor_offset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.input_handle_change = (function reagent$impl$template$input_handle_change(this$,on_change,e){
|
||||
(this$["cljsDOMValue"] = e.target.value);
|
||||
|
||||
if(cljs.core.truth_((this$["cljsInputDirty"]))){
|
||||
} else {
|
||||
(this$["cljsInputDirty"] = true);
|
||||
|
||||
reagent.impl.batching.do_after_render.call(null,(function (){
|
||||
return reagent.impl.template.input_set_value.call(null,this$);
|
||||
}));
|
||||
}
|
||||
|
||||
return on_change.call(null,e);
|
||||
});
|
||||
reagent.impl.template.input_render_setup = (function reagent$impl$template$input_render_setup(this$,jsprops){
|
||||
if(cljs.core.truth_((function (){var and__35486__auto__ = !((jsprops == null));
|
||||
if(and__35486__auto__){
|
||||
var and__35486__auto____$1 = jsprops.hasOwnProperty("onChange");
|
||||
if(cljs.core.truth_(and__35486__auto____$1)){
|
||||
return jsprops.hasOwnProperty("value");
|
||||
} else {
|
||||
return and__35486__auto____$1;
|
||||
}
|
||||
} else {
|
||||
return and__35486__auto__;
|
||||
}
|
||||
})())){
|
||||
if(cljs.core.truth_(reagent.impl.template.find_dom_node)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ","reagent.dom needs to be loaded for controlled input to work","\n","find-dom-node"].join('')));
|
||||
}
|
||||
|
||||
var v = (jsprops["value"]);
|
||||
var value = (((v == null))?"":v);
|
||||
var on_change = (jsprops["onChange"]);
|
||||
if(cljs.core.truth_((this$["cljsInputLive"]))){
|
||||
} else {
|
||||
(this$["cljsInputLive"] = true);
|
||||
|
||||
(this$["cljsDOMValue"] = value);
|
||||
}
|
||||
|
||||
(this$["cljsRenderedValue"] = value);
|
||||
|
||||
delete jsprops["value"];
|
||||
|
||||
var G__37673 = jsprops;
|
||||
(G__37673["defaultValue"] = value);
|
||||
|
||||
(G__37673["onChange"] = ((function (G__37673,v,value,on_change){
|
||||
return (function (p1__37672_SHARP_){
|
||||
return reagent.impl.template.input_handle_change.call(null,this$,on_change,p1__37672_SHARP_);
|
||||
});})(G__37673,v,value,on_change))
|
||||
);
|
||||
|
||||
return G__37673;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.input_unmount = (function reagent$impl$template$input_unmount(this$){
|
||||
return (this$["cljsInputLive"] = null);
|
||||
});
|
||||
reagent.impl.template.input_component_QMARK_ = (function reagent$impl$template$input_component_QMARK_(x){
|
||||
var G__37674 = x;
|
||||
switch (G__37674) {
|
||||
case "input":
|
||||
case "textarea":
|
||||
return true;
|
||||
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
reagent.impl.template.reagent_input_class = null;
|
||||
reagent.impl.template.input_spec = new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"display-name","display-name",694513143),"ReagentInput",new cljs.core.Keyword(null,"component-did-update","component-did-update",-1468549173),reagent.impl.template.input_set_value,new cljs.core.Keyword(null,"component-will-unmount","component-will-unmount",-2058314698),reagent.impl.template.input_unmount,new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853),(function (argv,comp,jsprops,first_child){
|
||||
var this$ = reagent.impl.component._STAR_current_component_STAR_;
|
||||
reagent.impl.template.input_render_setup.call(null,this$,jsprops);
|
||||
|
||||
return reagent.impl.template.make_element.call(null,argv,comp,jsprops,first_child);
|
||||
})], null);
|
||||
reagent.impl.template.reagent_input = (function reagent$impl$template$reagent_input(){
|
||||
if((reagent.impl.template.reagent_input_class == null)){
|
||||
reagent.impl.template.reagent_input_class = reagent.impl.component.create_class.call(null,reagent.impl.template.input_spec);
|
||||
} else {
|
||||
}
|
||||
|
||||
return reagent.impl.template.reagent_input_class;
|
||||
});
|
||||
reagent.impl.template.parse_tag = (function reagent$impl$template$parse_tag(hiccup_tag){
|
||||
var vec__37676 = cljs.core.next.call(null,cljs.core.re_matches.call(null,reagent.impl.template.re_tag,cljs.core.name.call(null,hiccup_tag)));
|
||||
var tag = cljs.core.nth.call(null,vec__37676,(0),null);
|
||||
var id = cljs.core.nth.call(null,vec__37676,(1),null);
|
||||
var class$ = cljs.core.nth.call(null,vec__37676,(2),null);
|
||||
var class$__$1 = (((class$ == null))?null:clojure.string.replace.call(null,class$,/\./," "));
|
||||
if(cljs.core.truth_(tag)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Invalid tag: '",cljs.core.str.cljs$core$IFn$_invoke$arity$1(hiccup_tag),"'",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.component.comp_name.call(null))].join('')),"\n","tag"].join('')));
|
||||
}
|
||||
|
||||
return ({"name": tag, "id": id, "className": class$__$1});
|
||||
});
|
||||
reagent.impl.template.try_get_key = (function reagent$impl$template$try_get_key(x){
|
||||
try{return cljs.core.get.call(null,x,new cljs.core.Keyword(null,"key","key",-1516042587));
|
||||
}catch (e37679){var e = e37679;
|
||||
return null;
|
||||
}});
|
||||
reagent.impl.template.get_key = (function reagent$impl$template$get_key(x){
|
||||
if(cljs.core.map_QMARK_.call(null,x)){
|
||||
return reagent.impl.template.try_get_key.call(null,x);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.key_from_vec = (function reagent$impl$template$key_from_vec(v){
|
||||
var temp__5459__auto__ = reagent.impl.template.get_key.call(null,cljs.core.meta.call(null,v));
|
||||
if((temp__5459__auto__ == null)){
|
||||
return reagent.impl.template.get_key.call(null,cljs.core.nth.call(null,v,(1),null));
|
||||
} else {
|
||||
var k = temp__5459__auto__;
|
||||
return k;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.reag_element = (function reagent$impl$template$reag_element(tag,v){
|
||||
var c = reagent.impl.component.as_class.call(null,tag);
|
||||
var jsprops = ({"argv": v});
|
||||
var temp__5461__auto___37680 = reagent.impl.template.key_from_vec.call(null,v);
|
||||
if((temp__5461__auto___37680 == null)){
|
||||
} else {
|
||||
var key_37681 = temp__5461__auto___37680;
|
||||
(jsprops["key"] = key_37681);
|
||||
}
|
||||
|
||||
return (reagent.impl.util.react["createElement"])(c,jsprops);
|
||||
});
|
||||
reagent.impl.template.adapt_react_class = (function reagent$impl$template$adapt_react_class(c){
|
||||
var G__37682 = reagent.impl.template.__GT_NativeWrapper.call(null);
|
||||
(G__37682["name"] = c);
|
||||
|
||||
(G__37682["id"] = null);
|
||||
|
||||
(G__37682["class"] = null);
|
||||
|
||||
return G__37682;
|
||||
});
|
||||
reagent.impl.template.tag_name_cache = ({});
|
||||
reagent.impl.template.cached_parse = (function reagent$impl$template$cached_parse(x){
|
||||
var temp__5459__auto__ = reagent.impl.template.cache_get.call(null,reagent.impl.template.tag_name_cache,x);
|
||||
if((temp__5459__auto__ == null)){
|
||||
return (reagent.impl.template.tag_name_cache[x] = reagent.impl.template.parse_tag.call(null,x));
|
||||
} else {
|
||||
var s = temp__5459__auto__;
|
||||
return s;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.native_element = (function reagent$impl$template$native_element(parsed,argv,first){
|
||||
var comp = (parsed["name"]);
|
||||
var props = cljs.core.nth.call(null,argv,first,null);
|
||||
var hasprops = ((props == null)) || (cljs.core.map_QMARK_.call(null,props));
|
||||
var jsprops = reagent.impl.template.convert_props.call(null,((hasprops)?props:null),parsed);
|
||||
var first_child = (first + ((hasprops)?(1):(0)));
|
||||
if(reagent.impl.template.input_component_QMARK_.call(null,comp)){
|
||||
return reagent.impl.template.as_element.call(null,cljs.core.with_meta.call(null,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [reagent.impl.template.reagent_input.call(null),argv,comp,jsprops,first_child], null),cljs.core.meta.call(null,argv)));
|
||||
} else {
|
||||
var key = reagent.impl.template.get_key.call(null,cljs.core.meta.call(null,argv));
|
||||
var p = (((key == null))?jsprops:reagent.impl.template.oset.call(null,jsprops,"key",key));
|
||||
return reagent.impl.template.make_element.call(null,argv,comp,p,first_child);
|
||||
}
|
||||
});
|
||||
reagent.impl.template.str_coll = (function reagent$impl$template$str_coll(coll){
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(clojure.walk.prewalk.call(null,(function (x){
|
||||
if(cljs.core.fn_QMARK_.call(null,x)){
|
||||
var n = reagent.impl.util.fun_name.call(null,x);
|
||||
var G__37683 = n;
|
||||
switch (G__37683) {
|
||||
case "":
|
||||
return x;
|
||||
|
||||
break;
|
||||
default:
|
||||
return cljs.core.symbol.call(null,n);
|
||||
|
||||
}
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),coll))].join('');
|
||||
|
||||
});
|
||||
reagent.impl.template.hiccup_err = (function reagent$impl$template$hiccup_err(var_args){
|
||||
var args__36784__auto__ = [];
|
||||
var len__36777__auto___37687 = arguments.length;
|
||||
var i__36778__auto___37688 = (0);
|
||||
while(true){
|
||||
if((i__36778__auto___37688 < len__36777__auto___37687)){
|
||||
args__36784__auto__.push((arguments[i__36778__auto___37688]));
|
||||
|
||||
var G__37689 = (i__36778__auto___37688 + (1));
|
||||
i__36778__auto___37688 = G__37689;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__36785__auto__ = ((((1) < args__36784__auto__.length))?(new cljs.core.IndexedSeq(args__36784__auto__.slice((1)),(0),null)):null);
|
||||
return reagent.impl.template.hiccup_err.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__36785__auto__);
|
||||
});
|
||||
|
||||
reagent.impl.template.hiccup_err.cljs$core$IFn$_invoke$arity$variadic = (function (v,msg){
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.apply.call(null,cljs.core.str,msg)),": ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.str_coll.call(null,v)),"\n",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.component.comp_name.call(null))].join('');
|
||||
});
|
||||
|
||||
reagent.impl.template.hiccup_err.cljs$lang$maxFixedArity = (1);
|
||||
|
||||
reagent.impl.template.hiccup_err.cljs$lang$applyTo = (function (seq37685){
|
||||
var G__37686 = cljs.core.first.call(null,seq37685);
|
||||
var seq37685__$1 = cljs.core.next.call(null,seq37685);
|
||||
return reagent.impl.template.hiccup_err.cljs$core$IFn$_invoke$arity$variadic(G__37686,seq37685__$1);
|
||||
});
|
||||
|
||||
reagent.impl.template.vec_to_elem = (function reagent$impl$template$vec_to_elem(v){
|
||||
while(true){
|
||||
if((cljs.core.count.call(null,v) > (0))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,v,"Hiccup form should not be empty")),"\n","(pos? (count v))"].join('')));
|
||||
}
|
||||
|
||||
var tag = cljs.core.nth.call(null,v,(0),null);
|
||||
if(reagent.impl.template.valid_tag_QMARK_.call(null,tag)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,v,"Invalid Hiccup form")),"\n","(valid-tag? tag)"].join('')));
|
||||
}
|
||||
|
||||
if(reagent.impl.template.hiccup_tag_QMARK_.call(null,tag)){
|
||||
var n = cljs.core.name.call(null,tag);
|
||||
var pos = n.indexOf(">");
|
||||
var G__37690 = pos;
|
||||
switch (G__37690) {
|
||||
case (-1):
|
||||
return reagent.impl.template.native_element.call(null,reagent.impl.template.cached_parse.call(null,n),v,(1));
|
||||
|
||||
break;
|
||||
case (0):
|
||||
var comp = cljs.core.nth.call(null,v,(1),null);
|
||||
if(cljs.core._EQ_.call(null,">",n)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,v,"Invalid Hiccup tag")),"\n","(= \">\" n)"].join('')));
|
||||
}
|
||||
|
||||
if((typeof comp === 'string') || (cljs.core.fn_QMARK_.call(null,comp))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,v,"Expected React component in")),"\n","(or (string? comp) (fn? comp))"].join('')));
|
||||
}
|
||||
|
||||
return reagent.impl.template.native_element.call(null,({"name": comp}),v,(2));
|
||||
|
||||
break;
|
||||
default:
|
||||
var G__37692 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.subs.call(null,n,(0),pos),cljs.core.assoc.call(null,v,(0),cljs.core.subs.call(null,n,(pos + (1))))], null);
|
||||
v = G__37692;
|
||||
continue;
|
||||
|
||||
}
|
||||
} else {
|
||||
if((tag instanceof reagent.impl.template.NativeWrapper)){
|
||||
return reagent.impl.template.native_element.call(null,tag,v,(1));
|
||||
} else {
|
||||
return reagent.impl.template.reag_element.call(null,tag,v);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
reagent.impl.template.as_element = (function reagent$impl$template$as_element(x){
|
||||
if(reagent.impl.template.js_val_QMARK_.call(null,x)){
|
||||
return x;
|
||||
} else {
|
||||
if(cljs.core.vector_QMARK_.call(null,x)){
|
||||
return reagent.impl.template.vec_to_elem.call(null,x);
|
||||
} else {
|
||||
if(cljs.core.seq_QMARK_.call(null,x)){
|
||||
return reagent.impl.template.expand_seq_check.call(null,x);
|
||||
|
||||
} else {
|
||||
if(reagent.impl.template.named_QMARK_.call(null,x)){
|
||||
return cljs.core.name.call(null,x);
|
||||
} else {
|
||||
if(((!((x == null)))?((((x.cljs$lang$protocol_mask$partition0$ & (2147483648))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$IPrintWithWriter$)))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IPrintWithWriter,x):false)):cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IPrintWithWriter,x))){
|
||||
return cljs.core.pr_str.call(null,x);
|
||||
} else {
|
||||
return x;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
reagent.impl.component.as_element = reagent.impl.template.as_element;
|
||||
reagent.impl.template.expand_seq = (function reagent$impl$template$expand_seq(s){
|
||||
var a = cljs.core.into_array.call(null,s);
|
||||
var n__36543__auto___37694 = a.length;
|
||||
var i_37695 = (0);
|
||||
while(true){
|
||||
if((i_37695 < n__36543__auto___37694)){
|
||||
(a[i_37695] = reagent.impl.template.as_element.call(null,(a[i_37695])));
|
||||
|
||||
var G__37696 = (i_37695 + (1));
|
||||
i_37695 = G__37696;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return a;
|
||||
});
|
||||
reagent.impl.template.expand_seq_dev = (function reagent$impl$template$expand_seq_dev(s,o){
|
||||
var a = cljs.core.into_array.call(null,s);
|
||||
var n__36543__auto___37697 = a.length;
|
||||
var i_37698 = (0);
|
||||
while(true){
|
||||
if((i_37698 < n__36543__auto___37697)){
|
||||
var val_37699 = (a[i_37698]);
|
||||
if((cljs.core.vector_QMARK_.call(null,val_37699)) && ((reagent.impl.template.key_from_vec.call(null,val_37699) == null))){
|
||||
(o["no-key"] = true);
|
||||
} else {
|
||||
}
|
||||
|
||||
(a[i_37698] = reagent.impl.template.as_element.call(null,val_37699));
|
||||
|
||||
var G__37700 = (i_37698 + (1));
|
||||
i_37698 = G__37700;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return a;
|
||||
});
|
||||
reagent.impl.template.expand_seq_check = (function reagent$impl$template$expand_seq_check(x){
|
||||
var ctx = ({});
|
||||
var vec__37701 = reagent.ratom.check_derefs.call(null,((function (ctx){
|
||||
return (function (){
|
||||
return reagent.impl.template.expand_seq_dev.call(null,x,ctx);
|
||||
});})(ctx))
|
||||
);
|
||||
var res = cljs.core.nth.call(null,vec__37701,(0),null);
|
||||
var derefed = cljs.core.nth.call(null,vec__37701,(1),null);
|
||||
if(cljs.core.truth_(derefed)){
|
||||
if(cljs.core.truth_(reagent.debug.has_console)){
|
||||
(cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).warn(["Warning: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,x,"Reactive deref not supported in lazy seq, ","it should be wrapped in doall"))].join(''));
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_((ctx["no-key"]))){
|
||||
if(cljs.core.truth_(reagent.debug.has_console)){
|
||||
(cljs.core.truth_(reagent.debug.tracking)?reagent.debug.track_console:console).warn(["Warning: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(reagent.impl.template.hiccup_err.call(null,x,"Every element in a seq should have a unique :key"))].join(''));
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return res;
|
||||
});
|
||||
reagent.impl.template.make_element = (function reagent$impl$template$make_element(argv,comp,jsprops,first_child){
|
||||
var G__37704 = (cljs.core.count.call(null,argv) - first_child);
|
||||
switch (G__37704) {
|
||||
case (0):
|
||||
return (reagent.impl.util.react["createElement"])(comp,jsprops);
|
||||
|
||||
break;
|
||||
case (1):
|
||||
return (reagent.impl.util.react["createElement"])(comp,jsprops,reagent.impl.template.as_element.call(null,cljs.core.nth.call(null,argv,first_child,null)));
|
||||
|
||||
break;
|
||||
default:
|
||||
return (reagent.impl.util.react["createElement"]).apply(null,cljs.core.reduce_kv.call(null,((function (G__37704){
|
||||
return (function (a,k,v){
|
||||
if((k >= first_child)){
|
||||
a.push(reagent.impl.template.as_element.call(null,v));
|
||||
} else {
|
||||
}
|
||||
|
||||
return a;
|
||||
});})(G__37704))
|
||||
,[comp,jsprops],argv));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=template.js.map?rel=1517021941217
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/didier\/clojupyter\/website\/target\/cljsbuild\/public\/js\/out\/reagent\/impl\/template.js","sources":["template.cljs?rel=1517021941219"],"lineCount":596,"mappings":";AAAA;;;;;;;;;;AAYA;;;;+BAAA,\/BAEEA;AAEF,AAAA;;;;;;AAAA;AAAA,AAAA,+CAAA,\/CAASK;AAAT,AAAA;;;AAAA,AAAA,qDAAA,rDAASA;;AAAT,AAAA,wDAAA,xDAASA;;AAAT,AAAA,6DAAA,WAAAJ,oBAAAC,sBAAAC,lHAASE;AAAT,AAAA,OAAAD,2BAAAF,sBAAA;;;AAAA,2CAAA,3CAASI;AAAT,AAAA,YAAAD;;;AAASA,AAKT,qCAAA,rCAAeE,kFAAQC;AAAvB,AACE,QAAI,cAAAC,bAAUD,qCACV,cAAAE,bAASF;;AAEf,0CAAA,1CAAeG,4FAAaH;AAA5B,AACE,QAAI,AAACD,6CAAOC,QACR,OAASA;;AAEf,yCAAA,zCAAeI,0FAAYJ;AAA3B,AACE,QAAI,AAACG,kDAAYH,QACb,AAACK,+BAAKL,QACN,cAAWH,bAAcG;;AAK\/B,wCAAA,WAAA,oBAAA,sBAAA,7FAAKM;AAIL,kCAAA,lCAAMC,4EAAWC,EAAEC;AAAnB,AACE,GAAM,AAA0BD,iBAAEC;AAAlC,AACE,QAAMD,EAAEC;;AADV;;;AAGF,yCAAA,zCAAMC,0FAAkBD;AAAxB,AACE,GAAI,AAACV,6CAAOU;AACV,IAAAE,qBAAa,AAACJ,0CAAUD,sCAAgB,AAACO,yBAAKJ;AAA9C,AAAA,GAAA,CAAAE,sBAAA;AAEE,QAAML,sCAAgB,AAACO,yBAAKJ,MACtB,AAACK,0CAAmBL;;AAH5B,qBAAAE,jBAAUC;AAAV,AACEA;;;AAGFH;;;AAEJ,sCAAA,tCAAeM,oFAASf;AAAxB,AACE,SAAK,CAAA,aAAqB,AAACgB,YAAYhB;;AAEzC,AAAA,AAEA,gCAA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J,KAAKC,KAAKZ,QAAQa;;AAEvC,sCAAA,tCAAMG;AAAN,AACE,GAAM,8CAAA,7CAAMP;AAAZ,AACE,AAAMA,4CAAoB,AAACQ,8CAAkBP;;AAD\/C;;AAEAD;;AAKF,kCAAA,lCAAMS,4EAAWC;AAAjB,AACE,IAAAC,aAAqB,8GAAKD,zBAAWjE,5DAAK,4DAAA,5DAACqE,+BAAW1F,xDAAQ2F;UAA9D,AAAAH,wBAAAD,WAAA,IAAA,7CAAOE;SAAP,AAAAD,wBAAAD,WAAA,IAAA,5CAAW9C;aAAX,AAAA+C,wBAAAD,WAAA,IAAA,hDAAc7C;IACRA,aAAM,oBAAA,KAAA,vBAAU,WAAA,VAAMA,sBACd,wCAAA,KAAA,7CAACkD,iCAAelD;AAF9B,AAGE,oBAAQ+C;AAAR;AAAA,AAAA,MAAA,KAAApB,MAAA,CAAA,gPAAA,KAAA,vLAAY,CAAA,yEAAA,ZAAsBiB,4DACjB,AAACO;;;AAJpB,iBAKYJ,WACFhD,iBACOC;;AAEnB,oCAAA,pCAAMoD,gFAAatF;AAAnB,AAGE,IAAA,AAAK,iCAAA,1BAACwF,wBAAIxF;gBAAV,QAAAuF,JACqB9B;AADrB,AAAA;;AAGF,gCAAA,hCAAMgC,wEAASzF;AAAf,AACE,GAAM,AAACqB,+BAAKrB;AAAZ,Line truncated
|
||||
@@ -0,0 +1,155 @@
|
||||
(ns reagent.impl.util
|
||||
(:require [cljsjs.react]
|
||||
[cljsjs.create-react-class]
|
||||
[reagent.debug :refer-macros [dbg log warn]]
|
||||
[reagent.interop :refer-macros [$ $!]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
(defonce react
|
||||
(cond (exists? js/React) js/React
|
||||
(exists? js/require) (or (js/require "react")
|
||||
(throw (js/Error. "require('react') failed")))
|
||||
:else (throw (js/Error. "js/React is missing"))))
|
||||
|
||||
(defonce create-class
|
||||
(cond (exists? js/createReactClass) js/createReactClass
|
||||
(exists? js/require) (or (js/require "create-react-class")
|
||||
(throw (js/Error. "require('create-react-class') failed")))
|
||||
:else (throw (js/Error. "js/createReactClass is missing"))))
|
||||
|
||||
(def is-client (and (exists? js/window)
|
||||
(-> js/window ($ :document) nil? not)))
|
||||
|
||||
(def ^:dynamic ^boolean *non-reactive* false)
|
||||
|
||||
;;; Props accessors
|
||||
|
||||
;; Misc utilities
|
||||
|
||||
(defn memoize-1 [f]
|
||||
(let [mem (atom {})]
|
||||
(fn [arg]
|
||||
(let [v (get @mem arg)]
|
||||
(if-not (nil? v)
|
||||
v
|
||||
(let [ret (f arg)]
|
||||
(swap! mem assoc arg ret)
|
||||
ret))))))
|
||||
|
||||
(def dont-camel-case #{"aria" "data"})
|
||||
|
||||
(defn capitalize [s]
|
||||
(if (< (count s) 2)
|
||||
(string/upper-case s)
|
||||
(str (string/upper-case (subs s 0 1)) (subs s 1))))
|
||||
|
||||
(defn dash-to-camel [dashed]
|
||||
(if (string? dashed)
|
||||
dashed
|
||||
(let [name-str (name dashed)
|
||||
[start & parts] (string/split name-str #"-")]
|
||||
(if (dont-camel-case start)
|
||||
name-str
|
||||
(apply str start (map capitalize parts))))))
|
||||
|
||||
(defn fun-name [f]
|
||||
(let [n (or (and (fn? f)
|
||||
(or ($ f :displayName)
|
||||
($ f :name)))
|
||||
(and (implements? INamed f)
|
||||
(name f))
|
||||
(let [m (meta f)]
|
||||
(if (map? m)
|
||||
(:name m))))]
|
||||
(-> n
|
||||
str
|
||||
(clojure.string/replace "$" "."))))
|
||||
|
||||
(deftype PartialFn [pfn f args]
|
||||
Fn
|
||||
IFn
|
||||
(-invoke [_]
|
||||
(pfn))
|
||||
(-invoke [_ a]
|
||||
(pfn a))
|
||||
(-invoke [_ a b]
|
||||
(pfn a b))
|
||||
(-invoke [_ a b c]
|
||||
(pfn a b c))
|
||||
(-invoke [_ a b c d]
|
||||
(pfn a b c d))
|
||||
(-invoke [_ a b c d e]
|
||||
(pfn a b c d e))
|
||||
(-invoke [_ a b c d e f]
|
||||
(pfn a b c d e f))
|
||||
(-invoke [_ a b c d e f g]
|
||||
(pfn a b c d e f g))
|
||||
(-invoke [_ a b c d e f g h]
|
||||
(pfn a b c d e f g h))
|
||||
(-invoke [_ a b c d e f g h i]
|
||||
(pfn a b c d e f g h i))
|
||||
(-invoke [_ a b c d e f g h i j]
|
||||
(pfn a b c d e f g h i j))
|
||||
(-invoke [_ a b c d e f g h i j k]
|
||||
(pfn a b c d e f g h i j k))
|
||||
(-invoke [_ a b c d e f g h i j k l]
|
||||
(pfn a b c d e f g h i j k l))
|
||||
(-invoke [_ a b c d e f g h i j k l m]
|
||||
(pfn a b c d e f g h i j k l m))
|
||||
(-invoke [_ a b c d e f g h i j k l m n]
|
||||
(pfn a b c d e f g h i j k l m n))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o]
|
||||
(pfn a b c d e f g h i j k l m n o))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p]
|
||||
(pfn a b c d e f g h i j k l m n o p))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q]
|
||||
(pfn a b c d e f g h i j k l m n o p q))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r]
|
||||
(pfn a b c d e f g h i j k l m n o p q r))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s]
|
||||
(pfn a b c d e f g h i j k l m n o p q r s))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s t]
|
||||
(pfn a b c d e f g h i j k l m n o p q r s t))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s t rest]
|
||||
(apply pfn a b c d e f g h i j k l m n o p q r s t rest))
|
||||
IEquiv
|
||||
(-equiv [_ other]
|
||||
(and (= f (.-f other)) (= args (.-args other))))
|
||||
IHash
|
||||
(-hash [_] (hash [f args])))
|
||||
|
||||
(defn make-partial-fn [f args]
|
||||
(->PartialFn (apply partial f args) f args))
|
||||
|
||||
(defn- merge-class [p1 p2]
|
||||
(let [class (when-let [c1 (:class p1)]
|
||||
(when-let [c2 (:class p2)]
|
||||
(str c1 " " c2)))]
|
||||
(if (nil? class)
|
||||
p2
|
||||
(assoc p2 :class class))))
|
||||
|
||||
(defn- merge-style [p1 p2]
|
||||
(let [style (when-let [s1 (:style p1)]
|
||||
(when-let [s2 (:style p2)]
|
||||
(merge s1 s2)))]
|
||||
(if (nil? style)
|
||||
p2
|
||||
(assoc p2 :style style))))
|
||||
|
||||
(defn merge-props [p1 p2]
|
||||
(if (nil? p1)
|
||||
p2
|
||||
(do
|
||||
(assert (map? p1)
|
||||
(str "Property must be a map, not " (pr-str p1)))
|
||||
(merge-style p1 (merge-class p1 (merge p1 p2))))))
|
||||
|
||||
|
||||
(def ^:dynamic *always-update* false)
|
||||
|
||||
(defn force-update [comp deep]
|
||||
(if deep
|
||||
(binding [*always-update* true]
|
||||
($ comp forceUpdate))
|
||||
($ comp forceUpdate)))
|
||||
@@ -0,0 +1 @@
|
||||
{:rename-macros {}, :renames {}, :externs {React {}, require {}, Error {}, createReactClass {}, window {}}, :use-macros {log reagent.debug, dbg reagent.debug, $! reagent.interop, warn reagent.debug, $ reagent.interop}, :excludes #{}, :name reagent.impl.util, :imports nil, :requires {cljsjs.react cljsjs.react, cljsjs.create-react-class cljsjs.create-react-class, reagent.debug reagent.debug, reagent.interop reagent.interop, string clojure.string, clojure.string clojure.string}, :cljs.spec/speced-vars [], :uses nil, :defs {->PartialFn {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 68, :column 10, :end-line 68, :end-column 19, :protocols #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn cljs.core/Fn}, :skip-protocol-flag #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn}, :factory :positional, :arglists (quote ([pfn f args]))}, :protocols #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn cljs.core/Fn}, :name reagent.impl.util/->PartialFn, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 19, :method-params ([pfn f args]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :factory :positional, :line 68, :end-line 68, :max-fixed-arity 3, :fn-var true, :arglists (quote ([pfn f args])), :skip-protocol-flag #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn}}, merge-props {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 140, :column 7, :end-line 140, :end-column 18, :arglists (quote ([p1 p2]))}, :name reagent.impl.util/merge-props, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 18, :method-params ([p1 p2]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 140, :end-line 140, :max-fixed-arity 2, :fn-var true, :arglists (quote ([p1 p2]))}, capitalize {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 41, :column 7, :end-line 41, :end-column 17, :arglists (quote ([s]))}, :name reagent.impl.util/capitalize, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 17, :method-params ([s]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 41, :end-line 41, :max-fixed-arity 1, :fn-var true, :arglists (quote ([s]))}, react {:name reagent.impl.util/react, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 8, :column 1, :end-line 8, :end-column 15, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 8, :column 10, :end-line 8, :end-column 15}, :tag js}, PartialFn {:num-fields 3, :protocols #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn cljs.core/Fn}, :name reagent.impl.util/PartialFn, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 19, :type true, :column 10, :line 68, :record false, :end-line 68, :skip-protocol-flag #{cljs.core/IEquiv cljs.core/IHash cljs.core/IFn}}, dash-to-camel {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 46, :column 7, :end-line 46, :end-column 20, :arglists (quote ([dashed]))}, :name reagent.impl.util/dash-to-camel, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 20, :method-params ([dashed]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 46, :end-line 46, :max-fixed-arity 1, :fn-var true, :arglists (quote ([dashed]))}, dont-camel-case {:name reagent.impl.util/dont-camel-case, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 39, :column 1, :end-line 39, :end-column 21, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 39, :column 6, :end-line 39, :end-column 21}, :tag cljs.core/ISet}, merge-style {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 132, :column 8, :end-line 132, :end-column 19, :private true, :arglists (quote ([p1 p2]))}, :private true, :name reagent.impl.util/merge-style, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 19, :method-params ([p1 p2]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 132, :end-line 132, :max-fixed-arity 2, :fn-var true, :arglists (quote ([p1 p2]))}, memoize-1 {:protocol-inline nil, :meta {:file "/home/didier/clojupyter/website/target/cljsbuild/public/js/out/reagent/impl/util.cljs", :line 29, :column 7, :end-line 29, :end-column 16, :arglists (quote ([f]))}, :name reagent.impl.util/memoize-1, :variadic false, :file "target/cljsbuild/public/js/out/reagent/impl/util.cljs", :end-column 16, :method-params ([f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 29, :end-line 29, :max-fixed-arity 1, :fnLine truncated
|
||||
@@ -0,0 +1,574 @@
|
||||
// Compiled by ClojureScript 1.9.946 {}
|
||||
goog.provide('reagent.impl.util');
|
||||
goog.require('cljs.core');
|
||||
goog.require('cljsjs.react');
|
||||
goog.require('cljsjs.create_react_class');
|
||||
goog.require('reagent.debug');
|
||||
goog.require('reagent.interop');
|
||||
goog.require('clojure.string');
|
||||
if(typeof reagent.impl.util.react !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.util.react = ((typeof React !== 'undefined')?React:((typeof require !== 'undefined')?(function (){var or__35498__auto__ = require("react");
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
throw (new Error("require('react') failed"));
|
||||
}
|
||||
})():(function(){throw (new Error("js/React is missing"))})()
|
||||
));
|
||||
}
|
||||
if(typeof reagent.impl.util.create_class !== 'undefined'){
|
||||
} else {
|
||||
reagent.impl.util.create_class = ((typeof createReactClass !== 'undefined')?createReactClass:((typeof require !== 'undefined')?(function (){var or__35498__auto__ = require("create-react-class");
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
throw (new Error("require('create-react-class') failed"));
|
||||
}
|
||||
})():(function(){throw (new Error("js/createReactClass is missing"))})()
|
||||
));
|
||||
}
|
||||
reagent.impl.util.is_client = (typeof window !== 'undefined') && (!(((window["document"]) == null)));
|
||||
reagent.impl.util._STAR_non_reactive_STAR_ = false;
|
||||
reagent.impl.util.memoize_1 = (function reagent$impl$util$memoize_1(f){
|
||||
var mem = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
|
||||
return ((function (mem){
|
||||
return (function (arg){
|
||||
var v = cljs.core.get.call(null,cljs.core.deref.call(null,mem),arg);
|
||||
if(!((v == null))){
|
||||
return v;
|
||||
} else {
|
||||
var ret = f.call(null,arg);
|
||||
cljs.core.swap_BANG_.call(null,mem,cljs.core.assoc,arg,ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
;})(mem))
|
||||
});
|
||||
reagent.impl.util.dont_camel_case = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["aria",null,"data",null], null), null);
|
||||
reagent.impl.util.capitalize = (function reagent$impl$util$capitalize(s){
|
||||
if((cljs.core.count.call(null,s) < (2))){
|
||||
return clojure.string.upper_case.call(null,s);
|
||||
} else {
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(clojure.string.upper_case.call(null,cljs.core.subs.call(null,s,(0),(1)))),cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.subs.call(null,s,(1)))].join('');
|
||||
}
|
||||
});
|
||||
reagent.impl.util.dash_to_camel = (function reagent$impl$util$dash_to_camel(dashed){
|
||||
if(typeof dashed === 'string'){
|
||||
return dashed;
|
||||
} else {
|
||||
var name_str = cljs.core.name.call(null,dashed);
|
||||
var vec__37386 = clojure.string.split.call(null,name_str,/-/);
|
||||
var seq__37387 = cljs.core.seq.call(null,vec__37386);
|
||||
var first__37388 = cljs.core.first.call(null,seq__37387);
|
||||
var seq__37387__$1 = cljs.core.next.call(null,seq__37387);
|
||||
var start = first__37388;
|
||||
var parts = seq__37387__$1;
|
||||
if(cljs.core.truth_(reagent.impl.util.dont_camel_case.call(null,start))){
|
||||
return name_str;
|
||||
} else {
|
||||
return cljs.core.apply.call(null,cljs.core.str,start,cljs.core.map.call(null,reagent.impl.util.capitalize,parts));
|
||||
}
|
||||
}
|
||||
});
|
||||
reagent.impl.util.fun_name = (function reagent$impl$util$fun_name(f){
|
||||
var n = (function (){var or__35498__auto__ = (function (){var and__35486__auto__ = cljs.core.fn_QMARK_.call(null,f);
|
||||
if(and__35486__auto__){
|
||||
var or__35498__auto__ = (f["displayName"]);
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
return (f["name"]);
|
||||
}
|
||||
} else {
|
||||
return and__35486__auto__;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(or__35498__auto__)){
|
||||
return or__35498__auto__;
|
||||
} else {
|
||||
var or__35498__auto____$1 = (function (){var and__35486__auto__ = ((!((f == null)))?((((f.cljs$lang$protocol_mask$partition1$ & (4096))) || ((cljs.core.PROTOCOL_SENTINEL === f.cljs$core$INamed$)))?true:false):false);
|
||||
if(and__35486__auto__){
|
||||
return cljs.core.name.call(null,f);
|
||||
} else {
|
||||
return and__35486__auto__;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(or__35498__auto____$1)){
|
||||
return or__35498__auto____$1;
|
||||
} else {
|
||||
var m = cljs.core.meta.call(null,f);
|
||||
if(cljs.core.map_QMARK_.call(null,m)){
|
||||
return new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
return clojure.string.replace.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(n)].join(''),"$",".");
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.IEquiv}
|
||||
* @implements {cljs.core.IHash}
|
||||
* @implements {cljs.core.IFn}
|
||||
* @implements {cljs.core.Fn}
|
||||
*/
|
||||
reagent.impl.util.PartialFn = (function (pfn,f,args){
|
||||
this.pfn = pfn;
|
||||
this.f = f;
|
||||
this.args = args;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 6291457;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$Fn$ = cljs.core.PROTOCOL_SENTINEL;
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.call = (function() {
|
||||
var G__37394 = null;
|
||||
var G__37394__1 = (function (self__){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null);
|
||||
});
|
||||
var G__37394__2 = (function (self__,a){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a);
|
||||
});
|
||||
var G__37394__3 = (function (self__,a,b){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b);
|
||||
});
|
||||
var G__37394__4 = (function (self__,a,b,c){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c);
|
||||
});
|
||||
var G__37394__5 = (function (self__,a,b,c,d){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d);
|
||||
});
|
||||
var G__37394__6 = (function (self__,a,b,c,d,e){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e);
|
||||
});
|
||||
var G__37394__7 = (function (self__,a,b,c,d,e,f__$1){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1);
|
||||
});
|
||||
var G__37394__8 = (function (self__,a,b,c,d,e,f__$1,g){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g);
|
||||
});
|
||||
var G__37394__9 = (function (self__,a,b,c,d,e,f__$1,g,h){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h);
|
||||
});
|
||||
var G__37394__10 = (function (self__,a,b,c,d,e,f__$1,g,h,i){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i);
|
||||
});
|
||||
var G__37394__11 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j);
|
||||
});
|
||||
var G__37394__12 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k);
|
||||
});
|
||||
var G__37394__13 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l);
|
||||
});
|
||||
var G__37394__14 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m);
|
||||
});
|
||||
var G__37394__15 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n);
|
||||
});
|
||||
var G__37394__16 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o);
|
||||
});
|
||||
var G__37394__17 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p);
|
||||
});
|
||||
var G__37394__18 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q);
|
||||
});
|
||||
var G__37394__19 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r);
|
||||
});
|
||||
var G__37394__20 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s);
|
||||
});
|
||||
var G__37394__21 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t);
|
||||
});
|
||||
var G__37394__22 = (function (self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
var _ = self____$1;
|
||||
return cljs.core.apply.call(null,self__.pfn,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest);
|
||||
});
|
||||
G__37394 = function(self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest){
|
||||
switch(arguments.length){
|
||||
case 1:
|
||||
return G__37394__1.call(this,self__);
|
||||
case 2:
|
||||
return G__37394__2.call(this,self__,a);
|
||||
case 3:
|
||||
return G__37394__3.call(this,self__,a,b);
|
||||
case 4:
|
||||
return G__37394__4.call(this,self__,a,b,c);
|
||||
case 5:
|
||||
return G__37394__5.call(this,self__,a,b,c,d);
|
||||
case 6:
|
||||
return G__37394__6.call(this,self__,a,b,c,d,e);
|
||||
case 7:
|
||||
return G__37394__7.call(this,self__,a,b,c,d,e,f__$1);
|
||||
case 8:
|
||||
return G__37394__8.call(this,self__,a,b,c,d,e,f__$1,g);
|
||||
case 9:
|
||||
return G__37394__9.call(this,self__,a,b,c,d,e,f__$1,g,h);
|
||||
case 10:
|
||||
return G__37394__10.call(this,self__,a,b,c,d,e,f__$1,g,h,i);
|
||||
case 11:
|
||||
return G__37394__11.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j);
|
||||
case 12:
|
||||
return G__37394__12.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k);
|
||||
case 13:
|
||||
return G__37394__13.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l);
|
||||
case 14:
|
||||
return G__37394__14.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m);
|
||||
case 15:
|
||||
return G__37394__15.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n);
|
||||
case 16:
|
||||
return G__37394__16.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o);
|
||||
case 17:
|
||||
return G__37394__17.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p);
|
||||
case 18:
|
||||
return G__37394__18.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q);
|
||||
case 19:
|
||||
return G__37394__19.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r);
|
||||
case 20:
|
||||
return G__37394__20.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s);
|
||||
case 21:
|
||||
return G__37394__21.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t);
|
||||
case 22:
|
||||
return G__37394__22.call(this,self__,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest);
|
||||
}
|
||||
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
|
||||
};
|
||||
G__37394.cljs$core$IFn$_invoke$arity$1 = G__37394__1;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$2 = G__37394__2;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$3 = G__37394__3;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$4 = G__37394__4;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$5 = G__37394__5;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$6 = G__37394__6;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$7 = G__37394__7;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$8 = G__37394__8;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$9 = G__37394__9;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$10 = G__37394__10;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$11 = G__37394__11;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$12 = G__37394__12;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$13 = G__37394__13;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$14 = G__37394__14;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$15 = G__37394__15;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$16 = G__37394__16;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$17 = G__37394__17;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$18 = G__37394__18;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$19 = G__37394__19;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$20 = G__37394__20;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$21 = G__37394__21;
|
||||
G__37394.cljs$core$IFn$_invoke$arity$22 = G__37394__22;
|
||||
return G__37394;
|
||||
})()
|
||||
;
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.apply = (function (self__,args37393){
|
||||
var self__ = this;
|
||||
var self____$1 = this;
|
||||
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args37393)));
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$0 = (function (){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$1 = (function (a){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$2 = (function (a,b){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$3 = (function (a,b,c){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$4 = (function (a,b,c,d){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$5 = (function (a,b,c,d,e){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$6 = (function (a,b,c,d,e,f__$1){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$7 = (function (a,b,c,d,e,f__$1,g){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$8 = (function (a,b,c,d,e,f__$1,g,h){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$9 = (function (a,b,c,d,e,f__$1,g,h,i){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$10 = (function (a,b,c,d,e,f__$1,g,h,i,j){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$11 = (function (a,b,c,d,e,f__$1,g,h,i,j,k){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$12 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$13 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$14 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$15 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$16 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$17 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$18 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$19 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$20 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return self__.pfn.call(null,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IFn$_invoke$arity$21 = (function (a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
return cljs.core.apply.call(null,self__.pfn,a,b,c,d,e,f__$1,g,h,i,j,k,l,m,n,o,p,q,r,s,t,rest);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (_,other){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return (cljs.core._EQ_.call(null,self__.f,other.f)) && (cljs.core._EQ_.call(null,self__.args,other.args));
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.prototype.cljs$core$IHash$_hash$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return cljs.core.hash.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.f,self__.args], null));
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"pfn","pfn",-513383568,null),new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"args","args",-1338879193,null)], null);
|
||||
});
|
||||
|
||||
reagent.impl.util.PartialFn.cljs$lang$type = true;
|
||||
|
||||
reagent.impl.util.PartialFn.cljs$lang$ctorStr = "reagent.impl.util/PartialFn";
|
||||
|
||||
reagent.impl.util.PartialFn.cljs$lang$ctorPrWriter = (function (this__36169__auto__,writer__36170__auto__,opt__36171__auto__){
|
||||
return cljs.core._write.call(null,writer__36170__auto__,"reagent.impl.util/PartialFn");
|
||||
});
|
||||
|
||||
reagent.impl.util.__GT_PartialFn = (function reagent$impl$util$__GT_PartialFn(pfn,f,args){
|
||||
return (new reagent.impl.util.PartialFn(pfn,f,args));
|
||||
});
|
||||
|
||||
reagent.impl.util.make_partial_fn = (function reagent$impl$util$make_partial_fn(f,args){
|
||||
return reagent.impl.util.__GT_PartialFn.call(null,cljs.core.apply.call(null,cljs.core.partial,f,args),f,args);
|
||||
});
|
||||
reagent.impl.util.merge_class = (function reagent$impl$util$merge_class(p1,p2){
|
||||
var class$ = (function (){var temp__5457__auto__ = new cljs.core.Keyword(null,"class","class",-2030961996).cljs$core$IFn$_invoke$arity$1(p1);
|
||||
if(cljs.core.truth_(temp__5457__auto__)){
|
||||
var c1 = temp__5457__auto__;
|
||||
var temp__5457__auto____$1 = new cljs.core.Keyword(null,"class","class",-2030961996).cljs$core$IFn$_invoke$arity$1(p2);
|
||||
if(cljs.core.truth_(temp__5457__auto____$1)){
|
||||
var c2 = temp__5457__auto____$1;
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(c1)," ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(c2)].join('');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
if((class$ == null)){
|
||||
return p2;
|
||||
} else {
|
||||
return cljs.core.assoc.call(null,p2,new cljs.core.Keyword(null,"class","class",-2030961996),class$);
|
||||
}
|
||||
});
|
||||
reagent.impl.util.merge_style = (function reagent$impl$util$merge_style(p1,p2){
|
||||
var style = (function (){var temp__5457__auto__ = new cljs.core.Keyword(null,"style","style",-496642736).cljs$core$IFn$_invoke$arity$1(p1);
|
||||
if(cljs.core.truth_(temp__5457__auto__)){
|
||||
var s1 = temp__5457__auto__;
|
||||
var temp__5457__auto____$1 = new cljs.core.Keyword(null,"style","style",-496642736).cljs$core$IFn$_invoke$arity$1(p2);
|
||||
if(cljs.core.truth_(temp__5457__auto____$1)){
|
||||
var s2 = temp__5457__auto____$1;
|
||||
return cljs.core.merge.call(null,s1,s2);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
if((style == null)){
|
||||
return p2;
|
||||
} else {
|
||||
return cljs.core.assoc.call(null,p2,new cljs.core.Keyword(null,"style","style",-496642736),style);
|
||||
}
|
||||
});
|
||||
reagent.impl.util.merge_props = (function reagent$impl$util$merge_props(p1,p2){
|
||||
if((p1 == null)){
|
||||
return p2;
|
||||
} else {
|
||||
if(cljs.core.map_QMARK_.call(null,p1)){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(["Property must be a map, not ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.pr_str.call(null,p1))].join('')),"\n","(map? p1)"].join('')));
|
||||
}
|
||||
|
||||
return reagent.impl.util.merge_style.call(null,p1,reagent.impl.util.merge_class.call(null,p1,cljs.core.merge.call(null,p1,p2)));
|
||||
}
|
||||
});
|
||||
reagent.impl.util._STAR_always_update_STAR_ = false;
|
||||
reagent.impl.util.force_update = (function reagent$impl$util$force_update(comp,deep){
|
||||
if(cljs.core.truth_(deep)){
|
||||
var _STAR_always_update_STAR_37395 = reagent.impl.util._STAR_always_update_STAR_;
|
||||
reagent.impl.util._STAR_always_update_STAR_ = true;
|
||||
|
||||
try{return (comp["forceUpdate"])();
|
||||
}finally {reagent.impl.util._STAR_always_update_STAR_ = _STAR_always_update_STAR_37395;
|
||||
}} else {
|
||||
return (comp["forceUpdate"])();
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=util.js.map?rel=1517021940603
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/didier\/clojupyter\/website\/target\/cljsbuild\/public\/js\/out\/reagent\/impl\/util.js","sources":["util.cljs?rel=1517021940607"],"lineCount":574,"mappings":";AAAA;;;;;;;AAOA,GAAA,OAASA;AAAT;AAAA,AAAA,AAASA,0BACP,sCAAA,pCAAM,OAASC,uBAAUA,QACnB,OAASC,yBAAY,iBAAAC,oBAAI,QAAA,RAACD;AAAL,AAAA,oBAAAC;AAAAA;;AACI,MAAO,KAAAC,MAAA;;KAFtC,AAGY,kBAAO,KAAAA,MAAA;;;AAErB,GAAA,OAASC;AAAT;AAAA,AAAA,AAASA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