update viz 2 to use the newest version, which has some performance improvements and is easier to read the code for. also update the description
This commit is contained in:
parent
5ed62d23b4
commit
2b47573674
@ -5,7 +5,7 @@ description: >-
|
||||
Using clojurescript and quil to generate interesting visuals
|
||||
series: viz
|
||||
git_repo: https://github.com/mediocregopher/viz.git
|
||||
git_commit: cb3d9d871d72b4f4487d175e73f0c30041963c42
|
||||
git_commit: v1
|
||||
---
|
||||
|
||||
First I want to appologize if you've seen this already, I originally had this up
|
||||
|
@ -5,7 +5,7 @@ description: >-
|
||||
Now in glorious technicolor!
|
||||
series: viz
|
||||
git_repo: https://github.com/mediocregopher/viz.git
|
||||
git_commit: 76caf80afc94655f2a21661714248676ed018328
|
||||
git_commit: v2
|
||||
---
|
||||
|
||||
|
||||
@ -21,19 +21,26 @@ than a behavioral one.
|
||||
Behavioral changes which were made:
|
||||
|
||||
* When a live point is deciding its next spawn points, it first sorts the set of
|
||||
empty adjacent points from closest-to-the-center to farthest. Then it randomly
|
||||
chooses a number `n` between `0` to `N` (where `N` is the size of that sorted
|
||||
set) and spawns new points in the first `n` points of the sorted set.
|
||||
empty adjacent points from closest-to-the-center to farthest. It then chooses
|
||||
a number `n` between `0` to `N` (where `N` is the sorted set's size) and
|
||||
spawns new points from the first `n` points of the sorted set. `n` is chosen
|
||||
based on:
|
||||
|
||||
* The live point's linear distance from the center.
|
||||
|
||||
* A random multiplier.
|
||||
|
||||
* Each point is spawned with an attached color, where the color chosen is a
|
||||
slightly different hue than its parent. The change is deterministic, so all
|
||||
child points of the same generation have the same color.
|
||||
|
||||
The second change is purely cosmetic, but does create a mesmerizing effect. The
|
||||
first change alters the behavior dramatically.
|
||||
first change alters the behavior dramatically. Only the points which compete for
|
||||
the center are able to reproduce, but by the same token are more likely to be
|
||||
starved out by other points doing the same.
|
||||
|
||||
In the previous visualization the points moved around in groups aimlessly. Now
|
||||
the groups are all competing for the same thing, the center, and as a result
|
||||
the groups are all competing for the same thing, the center. As a result they
|
||||
congregate and are able to be viewed as a larger whole.
|
||||
|
||||
The constant churn of the whole takes many forms, from a spiral in the center,
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,368 +0,0 @@
|
||||
goog.provide('cljs.core.constants');
|
||||
goog.require('cljs.core');
|
||||
cljs.core.cst$kw$y = new cljs.core.Keyword(null,"y","y",-1757859776);
|
||||
cljs.core.cst$sym$form = new cljs.core.Symbol(null,"form","form",16469056,null);
|
||||
cljs.core.cst$kw$key_DASH_code = new cljs.core.Keyword(null,"key-code","key-code",-1732114304);
|
||||
cljs.core.cst$sym$tag = new cljs.core.Symbol(null,"tag","tag",350170304,null);
|
||||
cljs.core.cst$sym$_AMPERSAND_ = new cljs.core.Symbol(null,"&","&",-2144855648,null);
|
||||
cljs.core.cst$sym$stepper = new cljs.core.Symbol(null,"stepper","stepper",1159163296,null);
|
||||
cljs.core.cst$kw$grid_DASH_def = new cljs.core.Keyword(null,"grid-def","grid-def",-392588768);
|
||||
cljs.core.cst$sym$uuid = new cljs.core.Symbol(null,"uuid","uuid",-504564192,null);
|
||||
cljs.core.cst$kw$shift = new cljs.core.Keyword(null,"shift","shift",997140064);
|
||||
cljs.core.cst$kw$features = new cljs.core.Keyword(null,"features","features",-1146962336);
|
||||
cljs.core.cst$sym$$endDraw = new cljs.core.Symbol(null,".endDraw",".endDraw",795589408,null);
|
||||
cljs.core.cst$kw$open = new cljs.core.Keyword(null,"open","open",-1763596448);
|
||||
cljs.core.cst$kw$baseline = new cljs.core.Keyword(null,"baseline","baseline",1151033280);
|
||||
cljs.core.cst$sym$end = new cljs.core.Symbol(null,"end","end",1372345569,null);
|
||||
cljs.core.cst$kw$disable_DASH_stroke_DASH_perspective = new cljs.core.Keyword(null,"disable-stroke-perspective","disable-stroke-perspective",479198433);
|
||||
cljs.core.cst$kw$active_DASH_node_DASH_ids = new cljs.core.Keyword(null,"active-node-ids","active-node-ids",-398210751);
|
||||
cljs.core.cst$sym$defrecord_STAR_ = new cljs.core.Symbol(null,"defrecord*","defrecord*",-1936366207,null);
|
||||
cljs.core.cst$sym$base = new cljs.core.Symbol(null,"base","base",1825810849,null);
|
||||
cljs.core.cst$sym$obj = new cljs.core.Symbol(null,"obj","obj",-1672671807,null);
|
||||
cljs.core.cst$kw$hsb = new cljs.core.Keyword(null,"hsb","hsb",-753472031);
|
||||
cljs.core.cst$kw$quads = new cljs.core.Keyword(null,"quads","quads",1347497505);
|
||||
cljs.core.cst$sym$fqn = new cljs.core.Symbol(null,"fqn","fqn",-1749334463,null);
|
||||
cljs.core.cst$kw$arrow = new cljs.core.Keyword(null,"arrow","arrow",1071351425);
|
||||
cljs.core.cst$kw$dilate = new cljs.core.Keyword(null,"dilate","dilate",1504745153);
|
||||
cljs.core.cst$sym$first = new cljs.core.Symbol(null,"first","first",996428481,null);
|
||||
cljs.core.cst$sym$quil$core_SLASH_current_DASH_fill = new cljs.core.Symbol("quil.core","current-fill","quil.core/current-fill",269663137,null);
|
||||
cljs.core.cst$sym$try = new cljs.core.Symbol(null,"try","try",-1273693247,null);
|
||||
cljs.core.cst$sym$has_DASH_nil_QMARK_ = new cljs.core.Symbol(null,"has-nil?","has-nil?",825886722,null);
|
||||
cljs.core.cst$kw$min = new cljs.core.Keyword(null,"min","min",444991522);
|
||||
cljs.core.cst$sym$quil$core_SLASH__STAR_graphics_STAR_ = new cljs.core.Symbol("quil.core","*graphics*","quil.core/*graphics*",-1088142302,null);
|
||||
cljs.core.cst$kw$quad_DASH_strip = new cljs.core.Keyword(null,"quad-strip","quad-strip",-1297270686);
|
||||
cljs.core.cst$kw$down = new cljs.core.Keyword(null,"down","down",1565245570);
|
||||
cljs.core.cst$kw$grid_DASH_width = new cljs.core.Keyword(null,"grid-width","grid-width",837583106);
|
||||
cljs.core.cst$kw$disable_DASH_depth_DASH_mask = new cljs.core.Keyword(null,"disable-depth-mask","disable-depth-mask",3298562);
|
||||
cljs.core.cst$kw$pixels_DASH_in_DASH_360 = new cljs.core.Keyword(null,"pixels-in-360","pixels-in-360",1789567298);
|
||||
cljs.core.cst$kw$frame_DASH_rate = new cljs.core.Keyword(null,"frame-rate","frame-rate",-994918942);
|
||||
cljs.core.cst$kw$p_DASH_y = new cljs.core.Keyword(null,"p-y","p-y",-530704830);
|
||||
cljs.core.cst$kw$step_DASH_size = new cljs.core.Keyword(null,"step-size","step-size",1545609922);
|
||||
cljs.core.cst$kw$zoom = new cljs.core.Keyword(null,"zoom","zoom",-1827487038);
|
||||
cljs.core.cst$sym$rear = new cljs.core.Symbol(null,"rear","rear",-900164830,null);
|
||||
cljs.core.cst$sym$hierarchy = new cljs.core.Symbol(null,"hierarchy","hierarchy",587061186,null);
|
||||
cljs.core.cst$sym$iter = new cljs.core.Symbol(null,"iter","iter",-1346195486,null);
|
||||
cljs.core.cst$sym$cljs$core_SLASH_binding = new cljs.core.Symbol("cljs.core","binding","cljs.core/binding",2050379843,null);
|
||||
cljs.core.cst$kw$burn = new cljs.core.Keyword(null,"burn","burn",-458179293);
|
||||
cljs.core.cst$sym$step = new cljs.core.Symbol(null,"step","step",-1365547645,null);
|
||||
cljs.core.cst$sym$tr__10249__auto__ = new cljs.core.Symbol(null,"tr__10249__auto__","tr__10249__auto__",-739839485,null);
|
||||
cljs.core.cst$sym$boolean = new cljs.core.Symbol(null,"boolean","boolean",-278886877,null);
|
||||
cljs.core.cst$kw$key_DASH_typed = new cljs.core.Keyword(null,"key-typed","key-typed",-876037597);
|
||||
cljs.core.cst$sym$update_DASH_count = new cljs.core.Symbol(null,"update-count","update-count",-411982269,null);
|
||||
cljs.core.cst$kw$mouse_DASH_clicked = new cljs.core.Keyword(null,"mouse-clicked","mouse-clicked",-199339421);
|
||||
cljs.core.cst$sym$method_DASH_table = new cljs.core.Symbol(null,"method-table","method-table",-1878263165,null);
|
||||
cljs.core.cst$kw$mouse_DASH_released = new cljs.core.Keyword(null,"mouse-released","mouse-released",-664480061);
|
||||
cljs.core.cst$kw$posterize = new cljs.core.Keyword(null,"posterize","posterize",-148251901);
|
||||
cljs.core.cst$sym$chunk = new cljs.core.Symbol(null,"chunk","chunk",449371907,null);
|
||||
cljs.core.cst$kw$fn = new cljs.core.Keyword(null,"fn","fn",-1175266204);
|
||||
cljs.core.cst$sym$quil$sketch_SLASH_with_DASH_sketch = new cljs.core.Symbol("quil.sketch","with-sketch","quil.sketch/with-sketch",-634067708,null);
|
||||
cljs.core.cst$sym$i = new cljs.core.Symbol(null,"i","i",253690212,null);
|
||||
cljs.core.cst$kw$f8 = new cljs.core.Keyword(null,"f8","f8",-2141475484);
|
||||
cljs.core.cst$sym$rest = new cljs.core.Symbol(null,"rest","rest",398835108,null);
|
||||
cljs.core.cst$kw$meta = new cljs.core.Keyword(null,"meta","meta",1499536964);
|
||||
cljs.core.cst$sym$quil$core_SLASH_translate = new cljs.core.Symbol("quil.core","translate","quil.core/translate",150889028,null);
|
||||
cljs.core.cst$sym$old_DASH_fill__10239__auto__ = new cljs.core.Symbol(null,"old-fill__10239__auto__","old-fill__10239__auto__",-4319548,null);
|
||||
cljs.core.cst$kw$screen = new cljs.core.Keyword(null,"screen","screen",1990059748);
|
||||
cljs.core.cst$kw$enable_DASH_depth_DASH_test = new cljs.core.Keyword(null,"enable-depth-test","enable-depth-test",1519326084);
|
||||
cljs.core.cst$kw$mouse_DASH_exited = new cljs.core.Keyword(null,"mouse-exited","mouse-exited",-483205244);
|
||||
cljs.core.cst$kw$gray = new cljs.core.Keyword(null,"gray","gray",1013268388);
|
||||
cljs.core.cst$kw$frame = new cljs.core.Keyword(null,"frame","frame",-1711082588);
|
||||
cljs.core.cst$kw$enable_DASH_depth_DASH_sort = new cljs.core.Keyword(null,"enable-depth-sort","enable-depth-sort",-383089627);
|
||||
cljs.core.cst$kw$f1 = new cljs.core.Keyword(null,"f1","f1",1714532389);
|
||||
cljs.core.cst$kw$dup = new cljs.core.Keyword(null,"dup","dup",556298533);
|
||||
cljs.core.cst$kw$java2d = new cljs.core.Keyword(null,"java2d","java2d",166099237);
|
||||
cljs.core.cst$kw$corner = new cljs.core.Keyword(null,"corner","corner",1296717125);
|
||||
cljs.core.cst$kw$disable_DASH_texture_DASH_mipmaps = new cljs.core.Keyword(null,"disable-texture-mipmaps","disable-texture-mipmaps",1697917541);
|
||||
cljs.core.cst$kw$key = new cljs.core.Keyword(null,"key","key",-1516042587);
|
||||
cljs.core.cst$sym$comp = new cljs.core.Symbol(null,"comp","comp",-1462482139,null);
|
||||
cljs.core.cst$sym$dispatch_DASH_fn = new cljs.core.Symbol(null,"dispatch-fn","dispatch-fn",-1401088155,null);
|
||||
cljs.core.cst$kw$darkest = new cljs.core.Keyword(null,"darkest","darkest",68197253);
|
||||
cljs.core.cst$kw$f10 = new cljs.core.Keyword(null,"f10","f10",627525541);
|
||||
cljs.core.cst$kw$dodge = new cljs.core.Keyword(null,"dodge","dodge",-1556666427);
|
||||
cljs.core.cst$kw$bottom = new cljs.core.Keyword(null,"bottom","bottom",-1550509018);
|
||||
cljs.core.cst$kw$bevel = new cljs.core.Keyword(null,"bevel","bevel",2090515654);
|
||||
cljs.core.cst$kw$else = new cljs.core.Keyword(null,"else","else",-1508377146);
|
||||
cljs.core.cst$kw$on_DASH_close = new cljs.core.Keyword(null,"on-close","on-close",-761178394);
|
||||
cljs.core.cst$kw$disable_DASH_stroke_DASH_pure = new cljs.core.Keyword(null,"disable-stroke-pure","disable-stroke-pure",735493926);
|
||||
cljs.core.cst$kw$replace = new cljs.core.Keyword(null,"replace","replace",-786587770);
|
||||
cljs.core.cst$kw$next_DASH_id = new cljs.core.Keyword(null,"next-id","next-id",-224240762);
|
||||
cljs.core.cst$kw$alt = new cljs.core.Keyword(null,"alt","alt",-3214426);
|
||||
cljs.core.cst$sym$left = new cljs.core.Symbol(null,"left","left",1241415590,null);
|
||||
cljs.core.cst$sym$ns_STAR_ = new cljs.core.Symbol(null,"ns*","ns*",1840949383,null);
|
||||
cljs.core.cst$kw$cljs$core_SLASH_none = new cljs.core.Keyword("cljs.core","none","cljs.core/none",926646439);
|
||||
cljs.core.cst$sym$shift = new cljs.core.Symbol(null,"shift","shift",-1657295705,null);
|
||||
cljs.core.cst$sym$iters = new cljs.core.Symbol(null,"iters","iters",719353031,null);
|
||||
cljs.core.cst$kw$button = new cljs.core.Keyword(null,"button","button",1456579943);
|
||||
cljs.core.cst$kw$top = new cljs.core.Keyword(null,"top","top",-1856271961);
|
||||
cljs.core.cst$kw$mouse_DASH_wheel = new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439);
|
||||
cljs.core.cst$sym$cljs$core_SLASH_apply = new cljs.core.Symbol("cljs.core","apply","cljs.core/apply",1757277831,null);
|
||||
cljs.core.cst$sym$xform = new cljs.core.Symbol(null,"xform","xform",-85179481,null);
|
||||
cljs.core.cst$kw$validator = new cljs.core.Keyword(null,"validator","validator",-1966190681);
|
||||
cljs.core.cst$kw$disable_DASH_depth_DASH_test = new cljs.core.Keyword(null,"disable-depth-test","disable-depth-test",284606407);
|
||||
cljs.core.cst$sym$finally = new cljs.core.Symbol(null,"finally","finally",-1065347064,null);
|
||||
cljs.core.cst$kw$keyPressed = new cljs.core.Keyword(null,"keyPressed","keyPressed",1791025256);
|
||||
cljs.core.cst$kw$default = new cljs.core.Keyword(null,"default","default",-1987822328);
|
||||
cljs.core.cst$sym$prefer_DASH_table = new cljs.core.Symbol(null,"prefer-table","prefer-table",462168584,null);
|
||||
cljs.core.cst$kw$bar = new cljs.core.Keyword(null,"bar","bar",-1386246584);
|
||||
cljs.core.cst$sym$loop_STAR_ = new cljs.core.Symbol(null,"loop*","loop*",615029416,null);
|
||||
cljs.core.cst$sym$watches = new cljs.core.Symbol(null,"watches","watches",1367433992,null);
|
||||
cljs.core.cst$kw$ns = new cljs.core.Keyword(null,"ns","ns",441598760);
|
||||
cljs.core.cst$kw$grid = new cljs.core.Keyword(null,"grid","grid",402978600);
|
||||
cljs.core.cst$kw$pie = new cljs.core.Keyword(null,"pie","pie",1530441672);
|
||||
cljs.core.cst$sym$quil$core_SLASH_pop_DASH_matrix = new cljs.core.Symbol("quil.core","pop-matrix","quil.core/pop-matrix",310892617,null);
|
||||
cljs.core.cst$kw$decor = new cljs.core.Keyword(null,"decor","decor",-1730969431);
|
||||
cljs.core.cst$kw$w = new cljs.core.Keyword(null,"w","w",354169001);
|
||||
cljs.core.cst$sym$bitmap = new cljs.core.Symbol(null,"bitmap","bitmap",501334601,null);
|
||||
cljs.core.cst$kw$enable_DASH_stroke_DASH_perspective = new cljs.core.Keyword(null,"enable-stroke-perspective","enable-stroke-perspective",-259923319);
|
||||
cljs.core.cst$sym$_seq = new cljs.core.Symbol(null,"_seq","_seq",-449557847,null);
|
||||
cljs.core.cst$sym$nil_DASH_val = new cljs.core.Symbol(null,"nil-val","nil-val",-513933559,null);
|
||||
cljs.core.cst$kw$opengl = new cljs.core.Keyword(null,"opengl","opengl",-614998103);
|
||||
cljs.core.cst$kw$exit_DASH_wait_DASH_frames = new cljs.core.Keyword(null,"exit-wait-frames","exit-wait-frames",1417213098);
|
||||
cljs.core.cst$kw$mouse_DASH_moved = new cljs.core.Keyword(null,"mouse-moved","mouse-moved",-1918152310);
|
||||
cljs.core.cst$kw$parent_DASH_pos = new cljs.core.Keyword(null,"parent-pos","parent-pos",-282368566);
|
||||
cljs.core.cst$sym$v = new cljs.core.Symbol(null,"v","v",1661996586,null);
|
||||
cljs.core.cst$kw$safe_DASH_draw_DASH_fn = new cljs.core.Keyword(null,"safe-draw-fn","safe-draw-fn",1454900202);
|
||||
cljs.core.cst$kw$chord = new cljs.core.Keyword(null,"chord","chord",-696248342);
|
||||
cljs.core.cst$sym$riter = new cljs.core.Symbol(null,"riter","riter",-237834262,null);
|
||||
cljs.core.cst$sym$__hash = new cljs.core.Symbol(null,"__hash","__hash",-1328796629,null);
|
||||
cljs.core.cst$kw$rgb = new cljs.core.Keyword(null,"rgb","rgb",1432123467);
|
||||
cljs.core.cst$sym$meta = new cljs.core.Symbol(null,"meta","meta",-1154898805,null);
|
||||
cljs.core.cst$sym$_meta = new cljs.core.Symbol(null,"_meta","_meta",-1716892533,null);
|
||||
cljs.core.cst$sym$$dispose = new cljs.core.Symbol(null,".dispose",".dispose",-1697594101,null);
|
||||
cljs.core.cst$kw$lines = new cljs.core.Keyword(null,"lines","lines",-700165781);
|
||||
cljs.core.cst$sym$afn = new cljs.core.Symbol(null,"afn","afn",216963467,null);
|
||||
cljs.core.cst$kw$argb = new cljs.core.Keyword(null,"argb","argb",633844107);
|
||||
cljs.core.cst$kw$mouseOut = new cljs.core.Keyword(null,"mouseOut","mouseOut",-386669045);
|
||||
cljs.core.cst$kw$move = new cljs.core.Keyword(null,"move","move",-2110884309);
|
||||
cljs.core.cst$sym$tree = new cljs.core.Symbol(null,"tree","tree",1444219499,null);
|
||||
cljs.core.cst$sym$fn = new cljs.core.Symbol(null,"fn","fn",465265323,null);
|
||||
cljs.core.cst$kw$f5 = new cljs.core.Keyword(null,"f5","f5",1587057387);
|
||||
cljs.core.cst$kw$settings = new cljs.core.Keyword(null,"settings","settings",1556144875);
|
||||
cljs.core.cst$sym$front = new cljs.core.Symbol(null,"front","front",117022539,null);
|
||||
cljs.core.cst$sym$buf = new cljs.core.Symbol(null,"buf","buf",1426618187,null);
|
||||
cljs.core.cst$kw$pos = new cljs.core.Keyword(null,"pos","pos",-864607220);
|
||||
cljs.core.cst$kw$gif_DASH_seconds = new cljs.core.Keyword(null,"gif-seconds","gif-seconds",1861397548);
|
||||
cljs.core.cst$kw$command = new cljs.core.Keyword(null,"command","command",-894540724);
|
||||
cljs.core.cst$kw$mouseScrolled = new cljs.core.Keyword(null,"mouseScrolled","mouseScrolled",31878252);
|
||||
cljs.core.cst$sym$next_DASH_entry = new cljs.core.Symbol(null,"next-entry","next-entry",1091342476,null);
|
||||
cljs.core.cst$kw$val = new cljs.core.Keyword(null,"val","val",128701612);
|
||||
cljs.core.cst$sym$key = new cljs.core.Symbol(null,"key","key",124488940,null);
|
||||
cljs.core.cst$sym$_next = new cljs.core.Symbol(null,"_next","_next",101877036,null);
|
||||
cljs.core.cst$sym$quil$core_SLASH_stroke = new cljs.core.Symbol("quil.core","stroke","quil.core/stroke",577473004,null);
|
||||
cljs.core.cst$kw$update = new cljs.core.Keyword(null,"update","update",1045576396);
|
||||
cljs.core.cst$sym$root_DASH_iter = new cljs.core.Symbol(null,"root-iter","root-iter",1974672108,null);
|
||||
cljs.core.cst$sym$do = new cljs.core.Symbol(null,"do","do",1686842252,null);
|
||||
cljs.core.cst$sym$vec = new cljs.core.Symbol(null,"vec","vec",982683596,null);
|
||||
cljs.core.cst$sym$js_SLASH_Processing$prototype$PConstants = new cljs.core.Symbol("js","Processing.prototype.PConstants","js/Processing.prototype.PConstants",2034048972,null);
|
||||
cljs.core.cst$kw$miter = new cljs.core.Keyword(null,"miter","miter",327727052);
|
||||
cljs.core.cst$kw$points = new cljs.core.Keyword(null,"points","points",-1486596883);
|
||||
cljs.core.cst$kw$fallback_DASH_impl = new cljs.core.Keyword(null,"fallback-impl","fallback-impl",-1501286995);
|
||||
cljs.core.cst$kw$hand = new cljs.core.Keyword(null,"hand","hand",791601933);
|
||||
cljs.core.cst$kw$flush_DASH_on_DASH_newline = new cljs.core.Keyword(null,"flush-on-newline","flush-on-newline",-151457939);
|
||||
cljs.core.cst$kw$mouseDragged = new cljs.core.Keyword(null,"mouseDragged","mouseDragged",129975181);
|
||||
cljs.core.cst$sym$default_DASH_dispatch_DASH_val = new cljs.core.Symbol(null,"default-dispatch-val","default-dispatch-val",-1231201266,null);
|
||||
cljs.core.cst$kw$no_DASH_test = new cljs.core.Keyword(null,"no-test","no-test",-1679482642);
|
||||
cljs.core.cst$kw$close = new cljs.core.Keyword(null,"close","close",1835149582);
|
||||
cljs.core.cst$kw$roots = new cljs.core.Keyword(null,"roots","roots",-1088919250);
|
||||
cljs.core.cst$sym$validator = new cljs.core.Symbol(null,"validator","validator",-325659154,null);
|
||||
cljs.core.cst$kw$radius = new cljs.core.Keyword(null,"radius","radius",-2073122258);
|
||||
cljs.core.cst$kw$normal = new cljs.core.Keyword(null,"normal","normal",-1519123858);
|
||||
cljs.core.cst$sym$letfn_STAR_ = new cljs.core.Symbol(null,"letfn*","letfn*",-110097810,null);
|
||||
cljs.core.cst$sym$if = new cljs.core.Symbol(null,"if","if",1181717262,null);
|
||||
cljs.core.cst$kw$s = new cljs.core.Keyword(null,"s","s",1705939918);
|
||||
cljs.core.cst$sym$arr = new cljs.core.Symbol(null,"arr","arr",2115492975,null);
|
||||
cljs.core.cst$kw$threshold = new cljs.core.Keyword(null,"threshold","threshold",204221583);
|
||||
cljs.core.cst$sym$new = new cljs.core.Symbol(null,"new","new",-444906321,null);
|
||||
cljs.core.cst$kw$rotate_DASH_on = new cljs.core.Keyword(null,"rotate-on","rotate-on",-1282225937);
|
||||
cljs.core.cst$kw$up = new cljs.core.Keyword(null,"up","up",-269712113);
|
||||
cljs.core.cst$kw$descendants = new cljs.core.Keyword(null,"descendants","descendants",1824886031);
|
||||
cljs.core.cst$kw$renderer = new cljs.core.Keyword(null,"renderer","renderer",336841071);
|
||||
cljs.core.cst$sym$ns = new cljs.core.Symbol(null,"ns","ns",2082130287,null);
|
||||
cljs.core.cst$kw$size = new cljs.core.Keyword(null,"size","size",1098693007);
|
||||
cljs.core.cst$kw$title = new cljs.core.Keyword(null,"title","title",636505583);
|
||||
cljs.core.cst$kw$tail_DASH_length = new cljs.core.Keyword(null,"tail-length","tail-length",-2007115089);
|
||||
cljs.core.cst$kw$center = new cljs.core.Keyword(null,"center","center",-748944368);
|
||||
cljs.core.cst$kw$setup = new cljs.core.Keyword(null,"setup","setup",1987730512);
|
||||
cljs.core.cst$kw$mouse_DASH_pressed = new cljs.core.Keyword(null,"mouse-pressed","mouse-pressed",736955536);
|
||||
cljs.core.cst$kw$ancestors = new cljs.core.Keyword(null,"ancestors","ancestors",-776045424);
|
||||
cljs.core.cst$kw$middleware = new cljs.core.Keyword(null,"middleware","middleware",1462115504);
|
||||
cljs.core.cst$kw$round = new cljs.core.Keyword(null,"round","round",2009433328);
|
||||
cljs.core.cst$kw$disable_DASH_optimized_DASH_stroke = new cljs.core.Keyword(null,"disable-optimized-stroke","disable-optimized-stroke",74038544);
|
||||
cljs.core.cst$sym$meta8588 = new cljs.core.Symbol(null,"meta8588","meta8588",1105839504,null);
|
||||
cljs.core.cst$sym$value = new cljs.core.Symbol(null,"value","value",1946509744,null);
|
||||
cljs.core.cst$kw$focus_DASH_gained = new cljs.core.Keyword(null,"focus-gained","focus-gained",-857086384);
|
||||
cljs.core.cst$sym$name = new cljs.core.Symbol(null,"name","name",-810760592,null);
|
||||
cljs.core.cst$sym$gr__10259__auto__ = new cljs.core.Symbol(null,"gr__10259__auto__","gr__10259__auto__",-992087344,null);
|
||||
cljs.core.cst$kw$readably = new cljs.core.Keyword(null,"readably","readably",1129599760);
|
||||
cljs.core.cst$kw$global_DASH_key_DASH_events = new cljs.core.Keyword(null,"global-key-events","global-key-events",335064944);
|
||||
cljs.core.cst$kw$more_DASH_marker = new cljs.core.Keyword(null,"more-marker","more-marker",-14717935);
|
||||
cljs.core.cst$sym$cljs$core_SLASH_let = new cljs.core.Symbol("cljs.core","let","cljs.core/let",-308701135,null);
|
||||
cljs.core.cst$sym$fields = new cljs.core.Symbol(null,"fields","fields",-291534703,null);
|
||||
cljs.core.cst$kw$corners = new cljs.core.Keyword(null,"corners","corners",-137817903);
|
||||
cljs.core.cst$sym$method_DASH_cache = new cljs.core.Symbol(null,"method-cache","method-cache",1230193905,null);
|
||||
cljs.core.cst$kw$z = new cljs.core.Keyword(null,"z","z",-789527183);
|
||||
cljs.core.cst$sym$nexts = new cljs.core.Symbol(null,"nexts","nexts",-1683579407,null);
|
||||
cljs.core.cst$kw$f11 = new cljs.core.Keyword(null,"f11","f11",-1417398799);
|
||||
cljs.core.cst$kw$host = new cljs.core.Keyword(null,"host","host",-1558485167);
|
||||
cljs.core.cst$sym$edit = new cljs.core.Symbol(null,"edit","edit",-1302639,null);
|
||||
cljs.core.cst$sym$editable_QMARK_ = new cljs.core.Symbol(null,"editable?","editable?",-164945806,null);
|
||||
cljs.core.cst$kw$opaque = new cljs.core.Keyword(null,"opaque","opaque",-1243552654);
|
||||
cljs.core.cst$kw$straight = new cljs.core.Keyword(null,"straight","straight",-1252567854);
|
||||
cljs.core.cst$sym$base_DASH_count = new cljs.core.Symbol(null,"base-count","base-count",-1180647182,null);
|
||||
cljs.core.cst$kw$overlay = new cljs.core.Keyword(null,"overlay","overlay",-139131598);
|
||||
cljs.core.cst$kw$mouse_DASH_entered = new cljs.core.Keyword(null,"mouse-entered","mouse-entered",811350322);
|
||||
cljs.core.cst$sym$collision_DASH_hash = new cljs.core.Symbol(null,"collision-hash","collision-hash",-35831342,null);
|
||||
cljs.core.cst$kw$forest = new cljs.core.Keyword(null,"forest","forest",278860306);
|
||||
cljs.core.cst$sym$deftype_STAR_ = new cljs.core.Symbol(null,"deftype*","deftype*",962659890,null);
|
||||
cljs.core.cst$sym$let_STAR_ = new cljs.core.Symbol(null,"let*","let*",1920721458,null);
|
||||
cljs.core.cst$kw$enable_DASH_opengl_DASH_errors = new cljs.core.Keyword(null,"enable-opengl-errors","enable-opengl-errors",89998962);
|
||||
cljs.core.cst$kw$leaves = new cljs.core.Keyword(null,"leaves","leaves",-2143630574);
|
||||
cljs.core.cst$sym$start = new cljs.core.Symbol(null,"start","start",1285322546,null);
|
||||
cljs.core.cst$sym$coll = new cljs.core.Symbol(null,"coll","coll",-1006698606,null);
|
||||
cljs.core.cst$sym$not_DASH_native = new cljs.core.Symbol(null,"not-native","not-native",-236392494,null);
|
||||
cljs.core.cst$sym$js_STAR_ = new cljs.core.Symbol(null,"js*","js*",-1134233646,null);
|
||||
cljs.core.cst$kw$enable_DASH_stroke_DASH_pure = new cljs.core.Keyword(null,"enable-stroke-pure","enable-stroke-pure",881345587);
|
||||
cljs.core.cst$sym$strobj = new cljs.core.Symbol(null,"strobj","strobj",1088091283,null);
|
||||
cljs.core.cst$kw$nodes = new cljs.core.Keyword(null,"nodes","nodes",-2099585805);
|
||||
cljs.core.cst$kw$no_DASH_safe_DASH_draw = new cljs.core.Keyword(null,"no-safe-draw","no-safe-draw",-1157778157);
|
||||
cljs.core.cst$kw$blur = new cljs.core.Keyword(null,"blur","blur",-453500461);
|
||||
cljs.core.cst$sym$_rest = new cljs.core.Symbol(null,"_rest","_rest",-2100466189,null);
|
||||
cljs.core.cst$kw$project = new cljs.core.Keyword(null,"project","project",1124394579);
|
||||
cljs.core.cst$kw$triangle_DASH_fan = new cljs.core.Keyword(null,"triangle-fan","triangle-fan",1743150739);
|
||||
cljs.core.cst$kw$focus_DASH_lost = new cljs.core.Keyword(null,"focus-lost","focus-lost",-554849613);
|
||||
cljs.core.cst$sym$fn_STAR_ = new cljs.core.Symbol(null,"fn*","fn*",-752876845,null);
|
||||
cljs.core.cst$kw$f3 = new cljs.core.Keyword(null,"f3","f3",1954829043);
|
||||
cljs.core.cst$sym$val = new cljs.core.Symbol(null,"val","val",1769233139,null);
|
||||
cljs.core.cst$sym$ascending_QMARK_ = new cljs.core.Symbol(null,"ascending?","ascending?",-1938452653,null);
|
||||
cljs.core.cst$sym$recur = new cljs.core.Symbol(null,"recur","recur",1202958259,null);
|
||||
cljs.core.cst$sym$ci = new cljs.core.Symbol(null,"ci","ci",2049808339,null);
|
||||
cljs.core.cst$kw$enable_DASH_depth_DASH_mask = new cljs.core.Keyword(null,"enable-depth-mask","enable-depth-mask",872785875);
|
||||
cljs.core.cst$kw$key_DASH_pressed = new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364);
|
||||
cljs.core.cst$kw$key_DASH_released = new cljs.core.Keyword(null,"key-released","key-released",215919828);
|
||||
cljs.core.cst$kw$print_DASH_length = new cljs.core.Keyword(null,"print-length","print-length",1931866356);
|
||||
cljs.core.cst$kw$max = new cljs.core.Keyword(null,"max","max",61366548);
|
||||
cljs.core.cst$kw$foo = new cljs.core.Keyword(null,"foo","foo",1268894036);
|
||||
cljs.core.cst$kw$f2 = new cljs.core.Keyword(null,"f2","f2",396168596);
|
||||
cljs.core.cst$kw$keyReleased = new cljs.core.Keyword(null,"keyReleased","keyReleased",541714964);
|
||||
cljs.core.cst$kw$id = new cljs.core.Keyword(null,"id","id",-1388402092);
|
||||
cljs.core.cst$sym$state = new cljs.core.Symbol(null,"state","state",-348086572,null);
|
||||
cljs.core.cst$kw$control = new cljs.core.Keyword(null,"control","control",1892578036);
|
||||
cljs.core.cst$kw$ok = new cljs.core.Keyword(null,"ok","ok",967785236);
|
||||
cljs.core.cst$kw$difference = new cljs.core.Keyword(null,"difference","difference",1916101396);
|
||||
cljs.core.cst$sym$quil$core_SLASH_push_DASH_matrix = new cljs.core.Symbol("quil.core","push-matrix","quil.core/push-matrix",1356326676,null);
|
||||
cljs.core.cst$kw$cljs$core_SLASH_halt = new cljs.core.Keyword("cljs.core","halt","cljs.core/halt",-1049036715);
|
||||
cljs.core.cst$kw$mouseClicked = new cljs.core.Keyword(null,"mouseClicked","mouseClicked",1764302965);
|
||||
cljs.core.cst$kw$square = new cljs.core.Keyword(null,"square","square",812434677);
|
||||
cljs.core.cst$sym$cached_DASH_hierarchy = new cljs.core.Symbol(null,"cached-hierarchy","cached-hierarchy",-1085460203,null);
|
||||
cljs.core.cst$kw$enable_DASH_optimized_DASH_stroke = new cljs.core.Keyword(null,"enable-optimized-stroke","enable-optimized-stroke",1537575253);
|
||||
cljs.core.cst$kw$parent_DASH_id = new cljs.core.Keyword(null,"parent-id","parent-id",-1400729131);
|
||||
cljs.core.cst$sym$s = new cljs.core.Symbol(null,"s","s",-948495851,null);
|
||||
cljs.core.cst$kw$parents = new cljs.core.Keyword(null,"parents","parents",-2027538891);
|
||||
cljs.core.cst$sym$cnt = new cljs.core.Symbol(null,"cnt","cnt",1924510325,null);
|
||||
cljs.core.cst$kw$p_DASH_x = new cljs.core.Keyword(null,"p-x","p-x",-1721211211);
|
||||
cljs.core.cst$kw$p2d = new cljs.core.Keyword(null,"p2d","p2d",-2106175755);
|
||||
cljs.core.cst$kw$keep_DASH_on_DASH_top = new cljs.core.Keyword(null,"keep-on-top","keep-on-top",-970284267);
|
||||
cljs.core.cst$kw$navigation_DASH_3d = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301);
|
||||
cljs.core.cst$sym$node = new cljs.core.Symbol(null,"node","node",-2073234571,null);
|
||||
cljs.core.cst$kw$mouseReleased = new cljs.core.Keyword(null,"mouseReleased","mouseReleased",1116234838);
|
||||
cljs.core.cst$kw$mousePressed = new cljs.core.Keyword(null,"mousePressed","mousePressed",1776186454);
|
||||
cljs.core.cst$kw$shape = new cljs.core.Keyword(null,"shape","shape",1190694006);
|
||||
cljs.core.cst$sym$sym = new cljs.core.Symbol(null,"sym","sym",195671222,null);
|
||||
cljs.core.cst$kw$mouseMoved = new cljs.core.Keyword(null,"mouseMoved","mouseMoved",-1936954058);
|
||||
cljs.core.cst$kw$f12 = new cljs.core.Keyword(null,"f12","f12",853352790);
|
||||
cljs.core.cst$sym$sb = new cljs.core.Symbol(null,"sb","sb",-1249746442,null);
|
||||
cljs.core.cst$kw$mouseOver = new cljs.core.Keyword(null,"mouseOver","mouseOver",-1334461930);
|
||||
cljs.core.cst$kw$exclusion = new cljs.core.Keyword(null,"exclusion","exclusion",531897910);
|
||||
cljs.core.cst$sym$quil$core_SLASH_fill = new cljs.core.Symbol("quil.core","fill","quil.core/fill",814613078,null);
|
||||
cljs.core.cst$sym$meta8585 = new cljs.core.Symbol(null,"meta8585","meta8585",663620534,null);
|
||||
cljs.core.cst$sym$old_DASH_stroke__10244__auto__ = new cljs.core.Symbol(null,"old-stroke__10244__auto__","old-stroke__10244__auto__",1374294039,null);
|
||||
cljs.core.cst$kw$disable_DASH_opengl_DASH_errors = new cljs.core.Keyword(null,"disable-opengl-errors","disable-opengl-errors",506822839);
|
||||
cljs.core.cst$kw$unknown_DASH_key = new cljs.core.Keyword(null,"unknown-key","unknown-key",255305911);
|
||||
cljs.core.cst$kw$alpha = new cljs.core.Keyword(null,"alpha","alpha",-1574982441);
|
||||
cljs.core.cst$kw$wait = new cljs.core.Keyword(null,"wait","wait",-260664777);
|
||||
cljs.core.cst$kw$right = new cljs.core.Keyword(null,"right","right",-452581833);
|
||||
cljs.core.cst$kw$random = new cljs.core.Keyword(null,"random","random",-557811113);
|
||||
cljs.core.cst$sym$quil$core_SLASH_current_DASH_stroke = new cljs.core.Symbol("quil.core","current-stroke","quil.core/current-stroke",-1148124489,null);
|
||||
cljs.core.cst$kw$host_DASH_id = new cljs.core.Keyword(null,"host-id","host-id",742376279);
|
||||
cljs.core.cst$kw$repeat = new cljs.core.Keyword(null,"repeat","repeat",832692087);
|
||||
cljs.core.cst$kw$hard_DASH_light = new cljs.core.Keyword(null,"hard-light","hard-light",-37591145);
|
||||
cljs.core.cst$sym$quil$sketch$macros_SLASH_defsketch = new cljs.core.Symbol("quil.sketch$macros","defsketch","quil.sketch$macros/defsketch",2065609719,null);
|
||||
cljs.core.cst$kw$keyTyped = new cljs.core.Keyword(null,"keyTyped","keyTyped",1437329399);
|
||||
cljs.core.cst$kw$position = new cljs.core.Keyword(null,"position","position",-2011731912);
|
||||
cljs.core.cst$kw$no_DASH_start = new cljs.core.Keyword(null,"no-start","no-start",1381488856);
|
||||
cljs.core.cst$sym$_hash = new cljs.core.Symbol(null,"_hash","_hash",-2130838312,null);
|
||||
cljs.core.cst$kw$image = new cljs.core.Keyword(null,"image","image",-58725096);
|
||||
cljs.core.cst$kw$d = new cljs.core.Keyword(null,"d","d",1972142424);
|
||||
cljs.core.cst$kw$dial = new cljs.core.Keyword(null,"dial","dial",1238392184);
|
||||
cljs.core.cst$kw$multiply = new cljs.core.Keyword(null,"multiply","multiply",-1036907048);
|
||||
cljs.core.cst$kw$lightest = new cljs.core.Keyword(null,"lightest","lightest",-2043115912);
|
||||
cljs.core.cst$sym$quil$core_SLASH_rotate = new cljs.core.Symbol("quil.core","rotate","quil.core/rotate",-1944995048,null);
|
||||
cljs.core.cst$kw$f7 = new cljs.core.Keyword(null,"f7","f7",356150168);
|
||||
cljs.core.cst$kw$ghost = new cljs.core.Keyword(null,"ghost","ghost",-1531157576);
|
||||
cljs.core.cst$sym$keys = new cljs.core.Symbol(null,"keys","keys",-1586012071,null);
|
||||
cljs.core.cst$kw$x = new cljs.core.Keyword(null,"x","x",2099068185);
|
||||
cljs.core.cst$kw$blend = new cljs.core.Keyword(null,"blend","blend",249565561);
|
||||
cljs.core.cst$sym$set_BANG_ = new cljs.core.Symbol(null,"set!","set!",250714521,null);
|
||||
cljs.core.cst$kw$disable_DASH_depth_DASH_sort = new cljs.core.Keyword(null,"disable-depth-sort","disable-depth-sort",-1568352839);
|
||||
cljs.core.cst$kw$tag = new cljs.core.Keyword(null,"tag","tag",-1290361223);
|
||||
cljs.core.cst$sym$tree_DASH_map = new cljs.core.Symbol(null,"tree-map","tree-map",1373073049,null);
|
||||
cljs.core.cst$kw$raw_DASH_key = new cljs.core.Keyword(null,"raw-key","raw-key",-162482279);
|
||||
cljs.core.cst$kw$target = new cljs.core.Keyword(null,"target","target",253001721);
|
||||
cljs.core.cst$sym$_DOT_ = new cljs.core.Symbol(null,".",".",1975675962,null);
|
||||
cljs.core.cst$sym$var = new cljs.core.Symbol(null,"var","var",870848730,null);
|
||||
cljs.core.cst$kw$mutable = new cljs.core.Keyword(null,"mutable","mutable",875778266);
|
||||
cljs.core.cst$sym$quote = new cljs.core.Symbol(null,"quote","quote",1377916282,null);
|
||||
cljs.core.cst$kw$f9 = new cljs.core.Keyword(null,"f9","f9",704633338);
|
||||
cljs.core.cst$sym$root = new cljs.core.Symbol(null,"root","root",1191874074,null);
|
||||
cljs.core.cst$sym$str = new cljs.core.Symbol(null,"str","str",-1564826950,null);
|
||||
cljs.core.cst$kw$draw = new cljs.core.Keyword(null,"draw","draw",1358331674);
|
||||
cljs.core.cst$sym$nodes = new cljs.core.Symbol(null,"nodes","nodes",-459054278,null);
|
||||
cljs.core.cst$sym$seen = new cljs.core.Symbol(null,"seen","seen",1121531738,null);
|
||||
cljs.core.cst$sym$hash_DASH_map = new cljs.core.Symbol(null,"hash-map","hash-map",-439030950,null);
|
||||
cljs.core.cst$kw$erode = new cljs.core.Keyword(null,"erode","erode",1539530618);
|
||||
cljs.core.cst$kw$centered = new cljs.core.Keyword(null,"centered","centered",-515171141);
|
||||
cljs.core.cst$kw$add = new cljs.core.Keyword(null,"add","add",235287739);
|
||||
cljs.core.cst$sym$catch = new cljs.core.Symbol(null,"catch","catch",-1616370245,null);
|
||||
cljs.core.cst$kw$soft_DASH_light = new cljs.core.Keyword(null,"soft-light","soft-light",513207899);
|
||||
cljs.core.cst$kw$child_DASH_ids = new cljs.core.Keyword(null,"child-ids","child-ids",-604525861);
|
||||
cljs.core.cst$kw$alt_DASH_impl = new cljs.core.Keyword(null,"alt-impl","alt-impl",670969595);
|
||||
cljs.core.cst$sym$ext_DASH_map_DASH_iter = new cljs.core.Symbol(null,"ext-map-iter","ext-map-iter",-1215982757,null);
|
||||
cljs.core.cst$sym$tail = new cljs.core.Symbol(null,"tail","tail",494507963,null);
|
||||
cljs.core.cst$sym$quil$core_SLASH_with_DASH_graphics = new cljs.core.Symbol("quil.core","with-graphics","quil.core/with-graphics",481277883,null);
|
||||
cljs.core.cst$kw$subtract = new cljs.core.Keyword(null,"subtract","subtract",2136988635);
|
||||
cljs.core.cst$kw$clamp = new cljs.core.Keyword(null,"clamp","clamp",1803814940);
|
||||
cljs.core.cst$sym$record = new cljs.core.Symbol(null,"record","record",861424668,null);
|
||||
cljs.core.cst$sym$mseq = new cljs.core.Symbol(null,"mseq","mseq",1602647196,null);
|
||||
cljs.core.cst$sym$count = new cljs.core.Symbol(null,"count","count",-514511684,null);
|
||||
cljs.core.cst$kw$f6 = new cljs.core.Keyword(null,"f6","f6",2103080604);
|
||||
cljs.core.cst$kw$keywordize_DASH_keys = new cljs.core.Keyword(null,"keywordize-keys","keywordize-keys",1310784252);
|
||||
cljs.core.cst$sym$off = new cljs.core.Symbol(null,"off","off",-2047994980,null);
|
||||
cljs.core.cst$kw$clj = new cljs.core.Keyword(null,"clj","clj",-660495428);
|
||||
cljs.core.cst$kw$f4 = new cljs.core.Keyword(null,"f4","f4",990968764);
|
||||
cljs.core.cst$kw$triangle_DASH_strip = new cljs.core.Keyword(null,"triangle-strip","triangle-strip",221845500);
|
||||
cljs.core.cst$kw$navigation_DASH_2d = new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611);
|
||||
cljs.core.cst$sym$stack = new cljs.core.Symbol(null,"stack","stack",847125597,null);
|
||||
cljs.core.cst$sym$transient_DASH_map = new cljs.core.Symbol(null,"transient-map","transient-map",351764893,null);
|
||||
cljs.core.cst$sym$len = new cljs.core.Symbol(null,"len","len",-1230778691,null);
|
||||
cljs.core.cst$kw$cross = new cljs.core.Keyword(null,"cross","cross",194557789);
|
||||
cljs.core.cst$sym$right = new cljs.core.Symbol(null,"right","right",1187949694,null);
|
||||
cljs.core.cst$sym$throw = new cljs.core.Symbol(null,"throw","throw",595905694,null);
|
||||
cljs.core.cst$kw$p3d = new cljs.core.Keyword(null,"p3d","p3d",-850380194);
|
||||
cljs.core.cst$sym$fseq = new cljs.core.Symbol(null,"fseq","fseq",-1466412450,null);
|
||||
cljs.core.cst$kw$a = new cljs.core.Keyword(null,"a","a",-2123407586);
|
||||
cljs.core.cst$kw$triangles = new cljs.core.Keyword(null,"triangles","triangles",-1525417058);
|
||||
cljs.core.cst$sym$$beginDraw = new cljs.core.Symbol(null,".beginDraw",".beginDraw",1110767550,null);
|
||||
cljs.core.cst$kw$mouse_DASH_dragged = new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441);
|
||||
cljs.core.cst$sym$cljs$core_SLASH_aget = new cljs.core.Symbol("cljs.core","aget","cljs.core/aget",6345791,null);
|
||||
cljs.core.cst$sym$tr__10254__auto__ = new cljs.core.Symbol(null,"tr__10254__auto__","tr__10254__auto__",1519210815,null);
|
||||
cljs.core.cst$kw$left = new cljs.core.Keyword(null,"left","left",-399115937);
|
||||
cljs.core.cst$kw$cljs$core_SLASH_not_DASH_found = new cljs.core.Keyword("cljs.core","not-found","cljs.core/not-found",-1572889185);
|
||||
cljs.core.cst$sym$more = new cljs.core.Symbol(null,"more","more",-418290273,null);
|
||||
cljs.core.cst$sym$def = new cljs.core.Symbol(null,"def","def",597100991,null);
|
||||
cljs.core.cst$kw$invert = new cljs.core.Keyword(null,"invert","invert",1553577503);
|
||||
cljs.core.cst$kw$text = new cljs.core.Keyword(null,"text","text",-1790561697);
|
||||
cljs.core.cst$kw$enable_DASH_texture_DASH_mipmaps = new cljs.core.Keyword(null,"enable-texture-mipmaps","enable-texture-mipmaps",1241892671);
|
||||
cljs.core.cst$kw$model = new cljs.core.Keyword(null,"model","model",331153215);
|
||||
cljs.core.cst$sym$f = new cljs.core.Symbol(null,"f","f",43394975,null);
|
||||
cljs.core.cst$sym$next_DASH_iter = new cljs.core.Symbol(null,"next-iter","next-iter",1526626239,null);
|
||||
cljs.core.cst$sym$gr__10066__auto__ = new cljs.core.Symbol(null,"gr__10066__auto__","gr__10066__auto__",-614350849,null);
|
1
assets/viz/2/cljs/user/debug9D984AE.cljs.cache.json
Normal file
1
assets/viz/2/cljs/user/debug9D984AE.cljs.cache.json
Normal file
@ -0,0 +1 @@
|
||||
["^ ","~:defs",["^ "],"~:cljs.spec/registry-ref",[],"~:cljs.spec/speced-vars",[]]
|
3
assets/viz/2/cljs/user/debug9D984AE.js
Normal file
3
assets/viz/2/cljs/user/debug9D984AE.js
Normal file
@ -0,0 +1,3 @@
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
|
||||
//# sourceMappingURL=debug9D984AE.js.map
|
1
assets/viz/2/cljs/user/debug9D984AE.js.map
Normal file
1
assets/viz/2/cljs/user/debug9D984AE.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/cljs\/user\/debug9D984AE.js","sources":["debug.cljs"],"lineCount":3,"mappings":"","names":[]}
|
@ -1,8 +1,9 @@
|
||||
goog.addDependency("base.js", ['goog'], []);
|
||||
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.math.Integer', 'goog.string.StringBuffer', 'goog.array', 'goog.math.Long']);
|
||||
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.Uri', 'goog.object', 'goog.math.Integer', 'goog.string.StringBuffer', 'goog.array', 'goog.math.Long']);
|
||||
goog.addDependency("../process/env.js", ['process.env'], ['cljs.core']);
|
||||
goog.addDependency("../viz/grid.js", ['viz.grid'], ['cljs.core']);
|
||||
goog.addDependency("../viz/forest.js", ['viz.forest'], ['cljs.core', 'viz.grid']);
|
||||
goog.addDependency("../processing.js", ['org.processingjs.Processing'], []);
|
||||
goog.addDependency("../processing.js", ['org.processingjs.Processing'], [], {'foreign-lib': true});
|
||||
goog.addDependency("../quil/middlewares/deprecated_options.js", ['quil.middlewares.deprecated_options'], ['cljs.core']);
|
||||
goog.addDependency("../clojure/string.js", ['clojure.string'], ['goog.string', 'cljs.core', 'goog.string.StringBuffer']);
|
||||
goog.addDependency("../quil/util.js", ['quil.util'], ['cljs.core', 'clojure.string']);
|
||||
@ -13,6 +14,6 @@ goog.addDependency("../quil/middlewares/navigation_2d.js", ['quil.middlewares.na
|
||||
goog.addDependency("../quil/middlewares/fun_mode.js", ['quil.middlewares.fun_mode'], ['cljs.core', 'quil.core']);
|
||||
goog.addDependency("../quil/middleware.js", ['quil.middleware'], ['cljs.core', 'quil.middlewares.navigation_3d', 'quil.middlewares.navigation_2d', 'quil.middlewares.fun_mode']);
|
||||
goog.addDependency("../clojure/set.js", ['clojure.set'], ['cljs.core']);
|
||||
goog.addDependency("../viz/ghost.js", ['viz.ghost'], ['cljs.core', 'viz.forest', 'clojure.set', 'viz.grid']);
|
||||
goog.addDependency("../viz/ghost.js", ['viz.ghost'], ['cljs.core', 'viz.forest', 'clojure.set', 'quil.core', 'quil.middleware', 'viz.grid']);
|
||||
goog.addDependency("../viz/dial.js", ['viz.dial'], ['cljs.core', 'quil.core']);
|
||||
goog.addDependency("../viz/core.js", ['viz.core'], ['goog.string', 'cljs.core', 'viz.forest', 'quil.core', 'quil.middleware', 'goog.string.format', 'viz.ghost', 'viz.grid', 'viz.dial']);
|
||||
|
1
assets/viz/2/cljsc_opts.edn
Normal file
1
assets/viz/2/cljsc_opts.edn
Normal file
@ -0,0 +1 @@
|
||||
{:output-wrapper false, :externs ["closure-js/externs"], :libs ["closure-js/libs"], :output-to "js/main.js", :output-dir "out", :main "viz.core", :preamble ["processing.min.js"], :optimizations :none, :pretty-print false}
|
File diff suppressed because one or more lines are too long
1
assets/viz/2/clojure/set.cljs.cache.json
Normal file
1
assets/viz/2/clojure/set.cljs.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,12 +1,12 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('clojure.set');
|
||||
goog.require('cljs.core');
|
||||
clojure.set.bubble_max_key = (function clojure$set$bubble_max_key(k,coll){
|
||||
|
||||
var max = cljs.core.apply.call(null,cljs.core.max_key,k,coll);
|
||||
return cljs.core.cons.call(null,max,cljs.core.remove.call(null,((function (max){
|
||||
return (function (p1__9452_SHARP_){
|
||||
return (max === p1__9452_SHARP_);
|
||||
return (function (p1__2145_SHARP_){
|
||||
return (max === p1__2145_SHARP_);
|
||||
});})(max))
|
||||
,coll));
|
||||
});
|
||||
@ -14,23 +14,8 @@ return (max === p1__9452_SHARP_);
|
||||
* Return a set that is the union of the input sets
|
||||
*/
|
||||
clojure.set.union = (function clojure$set$union(var_args){
|
||||
var args9453 = [];
|
||||
var len__7927__auto___9459 = arguments.length;
|
||||
var i__7928__auto___9460 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9460 < len__7927__auto___9459)){
|
||||
args9453.push((arguments[i__7928__auto___9460]));
|
||||
|
||||
var G__9461 = (i__7928__auto___9460 + (1));
|
||||
i__7928__auto___9460 = G__9461;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__9458 = args9453.length;
|
||||
switch (G__9458) {
|
||||
var G__2150 = arguments.length;
|
||||
switch (G__2150) {
|
||||
case 0:
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$0();
|
||||
|
||||
@ -44,8 +29,23 @@ return clojure.set.union.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(argumen
|
||||
|
||||
break;
|
||||
default:
|
||||
var argseq__7946__auto__ = (new cljs.core.IndexedSeq(args9453.slice((2)),(0),null));
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__7946__auto__);
|
||||
var args_arr__4662__auto__ = [];
|
||||
var len__4641__auto___2152 = arguments.length;
|
||||
var i__4642__auto___2153 = (0);
|
||||
while(true){
|
||||
if((i__4642__auto___2153 < len__4641__auto___2152)){
|
||||
args_arr__4662__auto__.push((arguments[i__4642__auto___2153]));
|
||||
|
||||
var G__2154 = (i__4642__auto___2153 + (1));
|
||||
i__4642__auto___2153 = G__2154;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__4663__auto__ = (new cljs.core.IndexedSeq(args_arr__4662__auto__.slice((2)),(0),null));
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__4663__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
@ -71,12 +71,14 @@ var bubbled_sets = clojure.set.bubble_max_key.call(null,cljs.core.count,cljs.cor
|
||||
return cljs.core.reduce.call(null,cljs.core.into,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
|
||||
});
|
||||
|
||||
clojure.set.union.cljs$lang$applyTo = (function (seq9454){
|
||||
var G__9455 = cljs.core.first.call(null,seq9454);
|
||||
var seq9454__$1 = cljs.core.next.call(null,seq9454);
|
||||
var G__9456 = cljs.core.first.call(null,seq9454__$1);
|
||||
var seq9454__$2 = cljs.core.next.call(null,seq9454__$1);
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic(G__9455,G__9456,seq9454__$2);
|
||||
/** @this {Function} */
|
||||
clojure.set.union.cljs$lang$applyTo = (function (seq2147){
|
||||
var G__2148 = cljs.core.first.call(null,seq2147);
|
||||
var seq2147__$1 = cljs.core.next.call(null,seq2147);
|
||||
var G__2149 = cljs.core.first.call(null,seq2147__$1);
|
||||
var seq2147__$2 = cljs.core.next.call(null,seq2147__$1);
|
||||
var self__4628__auto__ = this;
|
||||
return self__4628__auto__.cljs$core$IFn$_invoke$arity$variadic(G__2148,G__2149,seq2147__$2);
|
||||
});
|
||||
|
||||
clojure.set.union.cljs$lang$maxFixedArity = (2);
|
||||
@ -85,23 +87,8 @@ clojure.set.union.cljs$lang$maxFixedArity = (2);
|
||||
* Return a set that is the intersection of the input sets
|
||||
*/
|
||||
clojure.set.intersection = (function clojure$set$intersection(var_args){
|
||||
var args9464 = [];
|
||||
var len__7927__auto___9470 = arguments.length;
|
||||
var i__7928__auto___9471 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9471 < len__7927__auto___9470)){
|
||||
args9464.push((arguments[i__7928__auto___9471]));
|
||||
|
||||
var G__9472 = (i__7928__auto___9471 + (1));
|
||||
i__7928__auto___9471 = G__9472;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__9469 = args9464.length;
|
||||
switch (G__9469) {
|
||||
var G__2160 = arguments.length;
|
||||
switch (G__2160) {
|
||||
case 1:
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
@ -111,8 +98,23 @@ return clojure.set.intersection.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(
|
||||
|
||||
break;
|
||||
default:
|
||||
var argseq__7946__auto__ = (new cljs.core.IndexedSeq(args9464.slice((2)),(0),null));
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__7946__auto__);
|
||||
var args_arr__4662__auto__ = [];
|
||||
var len__4641__auto___2162 = arguments.length;
|
||||
var i__4642__auto___2163 = (0);
|
||||
while(true){
|
||||
if((i__4642__auto___2163 < len__4641__auto___2162)){
|
||||
args_arr__4662__auto__.push((arguments[i__4642__auto___2163]));
|
||||
|
||||
var G__2164 = (i__4642__auto___2163 + (1));
|
||||
i__4642__auto___2163 = G__2164;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__4663__auto__ = (new cljs.core.IndexedSeq(args_arr__4662__auto__.slice((2)),(0),null));
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__4663__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
@ -124,10 +126,10 @@ return s1;
|
||||
clojure.set.intersection.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
|
||||
while(true){
|
||||
if((cljs.core.count.call(null,s2) < cljs.core.count.call(null,s1))){
|
||||
var G__9474 = s2;
|
||||
var G__9475 = s1;
|
||||
s1 = G__9474;
|
||||
s2 = G__9475;
|
||||
var G__2165 = s2;
|
||||
var G__2166 = s1;
|
||||
s1 = G__2165;
|
||||
s2 = G__2166;
|
||||
continue;
|
||||
} else {
|
||||
return cljs.core.reduce.call(null,((function (s1,s2){
|
||||
@ -145,18 +147,20 @@ break;
|
||||
});
|
||||
|
||||
clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
|
||||
var bubbled_sets = clojure.set.bubble_max_key.call(null,(function (p1__9463_SHARP_){
|
||||
return (- cljs.core.count.call(null,p1__9463_SHARP_));
|
||||
var bubbled_sets = clojure.set.bubble_max_key.call(null,(function (p1__2155_SHARP_){
|
||||
return (- cljs.core.count.call(null,p1__2155_SHARP_));
|
||||
}),cljs.core.conj.call(null,sets,s2,s1));
|
||||
return cljs.core.reduce.call(null,clojure.set.intersection,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
|
||||
});
|
||||
|
||||
clojure.set.intersection.cljs$lang$applyTo = (function (seq9465){
|
||||
var G__9466 = cljs.core.first.call(null,seq9465);
|
||||
var seq9465__$1 = cljs.core.next.call(null,seq9465);
|
||||
var G__9467 = cljs.core.first.call(null,seq9465__$1);
|
||||
var seq9465__$2 = cljs.core.next.call(null,seq9465__$1);
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic(G__9466,G__9467,seq9465__$2);
|
||||
/** @this {Function} */
|
||||
clojure.set.intersection.cljs$lang$applyTo = (function (seq2157){
|
||||
var G__2158 = cljs.core.first.call(null,seq2157);
|
||||
var seq2157__$1 = cljs.core.next.call(null,seq2157);
|
||||
var G__2159 = cljs.core.first.call(null,seq2157__$1);
|
||||
var seq2157__$2 = cljs.core.next.call(null,seq2157__$1);
|
||||
var self__4628__auto__ = this;
|
||||
return self__4628__auto__.cljs$core$IFn$_invoke$arity$variadic(G__2158,G__2159,seq2157__$2);
|
||||
});
|
||||
|
||||
clojure.set.intersection.cljs$lang$maxFixedArity = (2);
|
||||
@ -165,23 +169,8 @@ clojure.set.intersection.cljs$lang$maxFixedArity = (2);
|
||||
* Return a set that is the first set without elements of the remaining sets
|
||||
*/
|
||||
clojure.set.difference = (function clojure$set$difference(var_args){
|
||||
var args9476 = [];
|
||||
var len__7927__auto___9482 = arguments.length;
|
||||
var i__7928__auto___9483 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9483 < len__7927__auto___9482)){
|
||||
args9476.push((arguments[i__7928__auto___9483]));
|
||||
|
||||
var G__9484 = (i__7928__auto___9483 + (1));
|
||||
i__7928__auto___9483 = G__9484;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__9481 = args9476.length;
|
||||
switch (G__9481) {
|
||||
var G__2171 = arguments.length;
|
||||
switch (G__2171) {
|
||||
case 1:
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
@ -191,8 +180,23 @@ return clojure.set.difference.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(ar
|
||||
|
||||
break;
|
||||
default:
|
||||
var argseq__7946__auto__ = (new cljs.core.IndexedSeq(args9476.slice((2)),(0),null));
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__7946__auto__);
|
||||
var args_arr__4662__auto__ = [];
|
||||
var len__4641__auto___2173 = arguments.length;
|
||||
var i__4642__auto___2174 = (0);
|
||||
while(true){
|
||||
if((i__4642__auto___2174 < len__4641__auto___2173)){
|
||||
args_arr__4662__auto__.push((arguments[i__4642__auto___2174]));
|
||||
|
||||
var G__2175 = (i__4642__auto___2174 + (1));
|
||||
i__4642__auto___2174 = G__2175;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__4663__auto__ = (new cljs.core.IndexedSeq(args_arr__4662__auto__.slice((2)),(0),null));
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__4663__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
@ -219,12 +223,14 @@ clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,s
|
||||
return cljs.core.reduce.call(null,clojure.set.difference,s1,cljs.core.conj.call(null,sets,s2));
|
||||
});
|
||||
|
||||
clojure.set.difference.cljs$lang$applyTo = (function (seq9477){
|
||||
var G__9478 = cljs.core.first.call(null,seq9477);
|
||||
var seq9477__$1 = cljs.core.next.call(null,seq9477);
|
||||
var G__9479 = cljs.core.first.call(null,seq9477__$1);
|
||||
var seq9477__$2 = cljs.core.next.call(null,seq9477__$1);
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic(G__9478,G__9479,seq9477__$2);
|
||||
/** @this {Function} */
|
||||
clojure.set.difference.cljs$lang$applyTo = (function (seq2168){
|
||||
var G__2169 = cljs.core.first.call(null,seq2168);
|
||||
var seq2168__$1 = cljs.core.next.call(null,seq2168);
|
||||
var G__2170 = cljs.core.first.call(null,seq2168__$1);
|
||||
var seq2168__$2 = cljs.core.next.call(null,seq2168__$1);
|
||||
var self__4628__auto__ = this;
|
||||
return self__4628__auto__.cljs$core$IFn$_invoke$arity$variadic(G__2169,G__2170,seq2168__$2);
|
||||
});
|
||||
|
||||
clojure.set.difference.cljs$lang$maxFixedArity = (2);
|
||||
@ -245,18 +251,18 @@ return cljs.core.disj.call(null,s,k);
|
||||
* Returns a rel of the elements of xrel with only the keys in ks
|
||||
*/
|
||||
clojure.set.project = (function clojure$set$project(xrel,ks){
|
||||
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__9486_SHARP_){
|
||||
return cljs.core.select_keys.call(null,p1__9486_SHARP_,ks);
|
||||
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__2176_SHARP_){
|
||||
return cljs.core.select_keys.call(null,p1__2176_SHARP_,ks);
|
||||
}),xrel));
|
||||
});
|
||||
/**
|
||||
* Returns the map with the keys in kmap renamed to the vals in kmap
|
||||
*/
|
||||
clojure.set.rename_keys = (function clojure$set$rename_keys(map,kmap){
|
||||
return cljs.core.reduce.call(null,(function (m,p__9491){
|
||||
var vec__9492 = p__9491;
|
||||
var old = cljs.core.nth.call(null,vec__9492,(0),null);
|
||||
var new$ = cljs.core.nth.call(null,vec__9492,(1),null);
|
||||
return cljs.core.reduce.call(null,(function (m,p__2177){
|
||||
var vec__2178 = p__2177;
|
||||
var old = cljs.core.nth.call(null,vec__2178,(0),null);
|
||||
var new$ = cljs.core.nth.call(null,vec__2178,(1),null);
|
||||
if(cljs.core.contains_QMARK_.call(null,map,old)){
|
||||
return cljs.core.assoc.call(null,m,new$,cljs.core.get.call(null,map,old));
|
||||
} else {
|
||||
@ -268,8 +274,8 @@ return m;
|
||||
* Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
|
||||
*/
|
||||
clojure.set.rename = (function clojure$set$rename(xrel,kmap){
|
||||
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__9495_SHARP_){
|
||||
return clojure.set.rename_keys.call(null,p1__9495_SHARP_,kmap);
|
||||
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__2181_SHARP_){
|
||||
return clojure.set.rename_keys.call(null,p1__2181_SHARP_,kmap);
|
||||
}),xrel));
|
||||
});
|
||||
/**
|
||||
@ -286,10 +292,10 @@ return cljs.core.assoc.call(null,m,ik,cljs.core.conj.call(null,cljs.core.get.cal
|
||||
* Returns the map with the vals mapped to the keys.
|
||||
*/
|
||||
clojure.set.map_invert = (function clojure$set$map_invert(m){
|
||||
return cljs.core.reduce.call(null,(function (m__$1,p__9500){
|
||||
var vec__9501 = p__9500;
|
||||
var k = cljs.core.nth.call(null,vec__9501,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__9501,(1),null);
|
||||
return cljs.core.reduce.call(null,(function (m__$1,p__2182){
|
||||
var vec__2183 = p__2182;
|
||||
var k = cljs.core.nth.call(null,vec__2183,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__2183,(1),null);
|
||||
return cljs.core.assoc.call(null,m__$1,v,k);
|
||||
}),cljs.core.PersistentArrayMap.EMPTY,m);
|
||||
});
|
||||
@ -299,23 +305,8 @@ return cljs.core.assoc.call(null,m__$1,v,k);
|
||||
* keys.
|
||||
*/
|
||||
clojure.set.join = (function clojure$set$join(var_args){
|
||||
var args9508 = [];
|
||||
var len__7927__auto___9517 = arguments.length;
|
||||
var i__7928__auto___9518 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9518 < len__7927__auto___9517)){
|
||||
args9508.push((arguments[i__7928__auto___9518]));
|
||||
|
||||
var G__9519 = (i__7928__auto___9518 + (1));
|
||||
i__7928__auto___9518 = G__9519;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__9510 = args9508.length;
|
||||
switch (G__9510) {
|
||||
var G__2191 = arguments.length;
|
||||
switch (G__2191) {
|
||||
case 2:
|
||||
return clojure.set.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -325,31 +316,31 @@ return clojure.set.join.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(argument
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args9508.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
clojure.set.join.cljs$core$IFn$_invoke$arity$2 = (function (xrel,yrel){
|
||||
if((cljs.core.seq.call(null,xrel)) && (cljs.core.seq.call(null,yrel))){
|
||||
if(((cljs.core.seq.call(null,xrel)) && (cljs.core.seq.call(null,yrel)))){
|
||||
var ks = clojure.set.intersection.call(null,cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,xrel))),cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,yrel))));
|
||||
var vec__9511 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel], null));
|
||||
var r = cljs.core.nth.call(null,vec__9511,(0),null);
|
||||
var s = cljs.core.nth.call(null,vec__9511,(1),null);
|
||||
var vec__2192 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel], null));
|
||||
var r = cljs.core.nth.call(null,vec__2192,(0),null);
|
||||
var s = cljs.core.nth.call(null,vec__2192,(1),null);
|
||||
var idx = clojure.set.index.call(null,r,ks);
|
||||
return cljs.core.reduce.call(null,((function (ks,vec__9511,r,s,idx){
|
||||
return cljs.core.reduce.call(null,((function (ks,vec__2192,r,s,idx){
|
||||
return (function (ret,x){
|
||||
var found = idx.call(null,cljs.core.select_keys.call(null,x,ks));
|
||||
if(cljs.core.truth_(found)){
|
||||
return cljs.core.reduce.call(null,((function (found,ks,vec__9511,r,s,idx){
|
||||
return (function (p1__9504_SHARP_,p2__9505_SHARP_){
|
||||
return cljs.core.conj.call(null,p1__9504_SHARP_,cljs.core.merge.call(null,p2__9505_SHARP_,x));
|
||||
});})(found,ks,vec__9511,r,s,idx))
|
||||
return cljs.core.reduce.call(null,((function (found,ks,vec__2192,r,s,idx){
|
||||
return (function (p1__2186_SHARP_,p2__2187_SHARP_){
|
||||
return cljs.core.conj.call(null,p1__2186_SHARP_,cljs.core.merge.call(null,p2__2187_SHARP_,x));
|
||||
});})(found,ks,vec__2192,r,s,idx))
|
||||
,ret,found);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
});})(ks,vec__9511,r,s,idx))
|
||||
});})(ks,vec__2192,r,s,idx))
|
||||
,cljs.core.PersistentHashSet.EMPTY,s);
|
||||
} else {
|
||||
return cljs.core.PersistentHashSet.EMPTY;
|
||||
@ -357,24 +348,24 @@ return cljs.core.PersistentHashSet.EMPTY;
|
||||
});
|
||||
|
||||
clojure.set.join.cljs$core$IFn$_invoke$arity$3 = (function (xrel,yrel,km){
|
||||
var vec__9514 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel,clojure.set.map_invert.call(null,km)], null):new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel,km], null));
|
||||
var r = cljs.core.nth.call(null,vec__9514,(0),null);
|
||||
var s = cljs.core.nth.call(null,vec__9514,(1),null);
|
||||
var k = cljs.core.nth.call(null,vec__9514,(2),null);
|
||||
var vec__2195 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel,clojure.set.map_invert.call(null,km)], null):new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel,km], null));
|
||||
var r = cljs.core.nth.call(null,vec__2195,(0),null);
|
||||
var s = cljs.core.nth.call(null,vec__2195,(1),null);
|
||||
var k = cljs.core.nth.call(null,vec__2195,(2),null);
|
||||
var idx = clojure.set.index.call(null,r,cljs.core.vals.call(null,k));
|
||||
return cljs.core.reduce.call(null,((function (vec__9514,r,s,k,idx){
|
||||
return cljs.core.reduce.call(null,((function (vec__2195,r,s,k,idx){
|
||||
return (function (ret,x){
|
||||
var found = idx.call(null,clojure.set.rename_keys.call(null,cljs.core.select_keys.call(null,x,cljs.core.keys.call(null,k)),k));
|
||||
if(cljs.core.truth_(found)){
|
||||
return cljs.core.reduce.call(null,((function (found,vec__9514,r,s,k,idx){
|
||||
return (function (p1__9506_SHARP_,p2__9507_SHARP_){
|
||||
return cljs.core.conj.call(null,p1__9506_SHARP_,cljs.core.merge.call(null,p2__9507_SHARP_,x));
|
||||
});})(found,vec__9514,r,s,k,idx))
|
||||
return cljs.core.reduce.call(null,((function (found,vec__2195,r,s,k,idx){
|
||||
return (function (p1__2188_SHARP_,p2__2189_SHARP_){
|
||||
return cljs.core.conj.call(null,p1__2188_SHARP_,cljs.core.merge.call(null,p2__2189_SHARP_,x));
|
||||
});})(found,vec__2195,r,s,k,idx))
|
||||
,ret,found);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
});})(vec__9514,r,s,k,idx))
|
||||
});})(vec__2195,r,s,k,idx))
|
||||
,cljs.core.PersistentHashSet.EMPTY,s);
|
||||
});
|
||||
|
||||
@ -384,17 +375,17 @@ clojure.set.join.cljs$lang$maxFixedArity = 3;
|
||||
* Is set1 a subset of set2?
|
||||
*/
|
||||
clojure.set.subset_QMARK_ = (function clojure$set$subset_QMARK_(set1,set2){
|
||||
return ((cljs.core.count.call(null,set1) <= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__9521_SHARP_){
|
||||
return cljs.core.contains_QMARK_.call(null,set2,p1__9521_SHARP_);
|
||||
}),set1));
|
||||
return (((cljs.core.count.call(null,set1) <= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__2199_SHARP_){
|
||||
return cljs.core.contains_QMARK_.call(null,set2,p1__2199_SHARP_);
|
||||
}),set1)));
|
||||
});
|
||||
/**
|
||||
* Is set1 a superset of set2?
|
||||
*/
|
||||
clojure.set.superset_QMARK_ = (function clojure$set$superset_QMARK_(set1,set2){
|
||||
return ((cljs.core.count.call(null,set1) >= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__9522_SHARP_){
|
||||
return cljs.core.contains_QMARK_.call(null,set1,p1__9522_SHARP_);
|
||||
}),set2));
|
||||
return (((cljs.core.count.call(null,set1) >= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__2200_SHARP_){
|
||||
return cljs.core.contains_QMARK_.call(null,set1,p1__2200_SHARP_);
|
||||
}),set2)));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=set.js.map
|
||||
//# sourceMappingURL=set.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -26,7 +26,12 @@
|
||||
|
||||
(defn- replace-all
|
||||
[s re replacement]
|
||||
(.replace s (js/RegExp. (.-source re) "g") replacement))
|
||||
(let [r (js/RegExp. (.-source re)
|
||||
(cond-> "g"
|
||||
(.-ignoreCase re) (str "i")
|
||||
(.-multiline re) (str "m")
|
||||
(.-unicode re) (str "u")))]
|
||||
(.replace s r replacement)))
|
||||
|
||||
(defn- replace-with
|
||||
[f]
|
||||
@ -38,10 +43,24 @@
|
||||
|
||||
(defn replace
|
||||
"Replaces all instance of match with replacement in s.
|
||||
|
||||
match/replacement can be:
|
||||
|
||||
string / string
|
||||
pattern / (string or function of match)."
|
||||
pattern / (string or function of match).
|
||||
|
||||
See also replace-first.
|
||||
|
||||
The replacement is literal (i.e. none of its characters are treated
|
||||
specially) for all cases above except pattern / string.
|
||||
|
||||
For pattern / string, $1, $2, etc. in the replacement string are
|
||||
substituted with the string that matched the corresponding
|
||||
parenthesized group in the pattern.
|
||||
|
||||
Example:
|
||||
(clojure.string/replace \"Almost Pig Latin\" #\"\\b(\\w)(\\w+)\\b\" \"$2$1ay\")
|
||||
-> \"lmostAay igPay atinLay\""
|
||||
[s match replacement]
|
||||
(cond
|
||||
(string? match)
|
||||
@ -56,10 +75,25 @@
|
||||
|
||||
(defn replace-first
|
||||
"Replaces the first instance of match with replacement in s.
|
||||
|
||||
match/replacement can be:
|
||||
|
||||
string / string
|
||||
pattern / (string or function of match)."
|
||||
pattern / (string or function of match).
|
||||
|
||||
See also replace.
|
||||
|
||||
The replacement is literal (i.e. none of its characters are treated
|
||||
specially) for all cases above except pattern / string.
|
||||
|
||||
For pattern / string, $1, $2, etc. in the replacement string are
|
||||
substituted with the string that matched the corresponding
|
||||
parenthesized group in the pattern.
|
||||
|
||||
Example:
|
||||
(clojure.string/replace-first \"swap first two words\"
|
||||
#\"(\\w+)(\\s+)(\\w+)\" \"$3$2$1\")
|
||||
-> \"first swap two words\""
|
||||
[s match replacement]
|
||||
(.replace s match replacement))
|
||||
|
||||
@ -96,10 +130,7 @@
|
||||
"Converts first character of the string to upper-case, all other
|
||||
characters to lower-case."
|
||||
[s]
|
||||
(if (< (count s) 2)
|
||||
(upper-case s)
|
||||
(str (upper-case (subs s 0 1))
|
||||
(lower-case (subs s 1)))))
|
||||
(gstring/capitalize s))
|
||||
|
||||
;; The JavaScript split function takes a limit argument but the return
|
||||
;; value is not the same as the Java split function.
|
||||
@ -158,7 +189,7 @@
|
||||
(conj parts s))))))))))
|
||||
|
||||
(defn split-lines
|
||||
"Splits s on \n or \r\n."
|
||||
"Splits s on \\n or \\r\\n."
|
||||
[s]
|
||||
(split s #"\n|\r\n"))
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
1
assets/viz/2/clojure/string.cljs.cache.json
Normal file
1
assets/viz/2/clojure/string.cljs.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('clojure.string');
|
||||
goog.require('cljs.core');
|
||||
goog.require('goog.string');
|
||||
@ -14,11 +14,20 @@ clojure.string.reverse = (function clojure$string$reverse(s){
|
||||
return s.replace(clojure.string.re_surrogate_pair,"$2$1").split("").reverse().join("");
|
||||
});
|
||||
clojure.string.replace_all = (function clojure$string$replace_all(s,re,replacement){
|
||||
return s.replace((new RegExp(re.source,"g")),replacement);
|
||||
var r = (new RegExp(re.source,(function (){var G__1125 = "g";
|
||||
var G__1125__$1 = (cljs.core.truth_(re.ignoreCase)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__1125),"i"].join(''):G__1125);
|
||||
var G__1125__$2 = (cljs.core.truth_(re.multiline)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__1125__$1),"m"].join(''):G__1125__$1);
|
||||
if(cljs.core.truth_(re.unicode)){
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__1125__$2),"u"].join('');
|
||||
} else {
|
||||
return G__1125__$2;
|
||||
}
|
||||
})()));
|
||||
return s.replace(r,replacement);
|
||||
});
|
||||
clojure.string.replace_with = (function clojure$string$replace_with(f){
|
||||
return (function() {
|
||||
var G__8074__delegate = function (args){
|
||||
var G__1126__delegate = function (args){
|
||||
var matches = cljs.core.drop_last.call(null,(2),args);
|
||||
if(cljs.core._EQ_.call(null,cljs.core.count.call(null,matches),(1))){
|
||||
return f.call(null,cljs.core.first.call(null,matches));
|
||||
@ -26,30 +35,44 @@ return f.call(null,cljs.core.first.call(null,matches));
|
||||
return f.call(null,cljs.core.vec.call(null,matches));
|
||||
}
|
||||
};
|
||||
var G__8074 = function (var_args){
|
||||
var G__1126 = function (var_args){
|
||||
var args = null;
|
||||
if (arguments.length > 0) {
|
||||
var G__8075__i = 0, G__8075__a = new Array(arguments.length - 0);
|
||||
while (G__8075__i < G__8075__a.length) {G__8075__a[G__8075__i] = arguments[G__8075__i + 0]; ++G__8075__i;}
|
||||
args = new cljs.core.IndexedSeq(G__8075__a,0);
|
||||
var G__1127__i = 0, G__1127__a = new Array(arguments.length - 0);
|
||||
while (G__1127__i < G__1127__a.length) {G__1127__a[G__1127__i] = arguments[G__1127__i + 0]; ++G__1127__i;}
|
||||
args = new cljs.core.IndexedSeq(G__1127__a,0,null);
|
||||
}
|
||||
return G__8074__delegate.call(this,args);};
|
||||
G__8074.cljs$lang$maxFixedArity = 0;
|
||||
G__8074.cljs$lang$applyTo = (function (arglist__8076){
|
||||
var args = cljs.core.seq(arglist__8076);
|
||||
return G__8074__delegate(args);
|
||||
return G__1126__delegate.call(this,args);};
|
||||
G__1126.cljs$lang$maxFixedArity = 0;
|
||||
G__1126.cljs$lang$applyTo = (function (arglist__1128){
|
||||
var args = cljs.core.seq(arglist__1128);
|
||||
return G__1126__delegate(args);
|
||||
});
|
||||
G__8074.cljs$core$IFn$_invoke$arity$variadic = G__8074__delegate;
|
||||
return G__8074;
|
||||
G__1126.cljs$core$IFn$_invoke$arity$variadic = G__1126__delegate;
|
||||
return G__1126;
|
||||
})()
|
||||
;
|
||||
});
|
||||
/**
|
||||
* Replaces all instance of match with replacement in s.
|
||||
*
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*
|
||||
* See also replace-first.
|
||||
*
|
||||
* The replacement is literal (i.e. none of its characters are treated
|
||||
* specially) for all cases above except pattern / string.
|
||||
*
|
||||
* For pattern / string, $1, $2, etc. in the replacement string are
|
||||
* substituted with the string that matched the corresponding
|
||||
* parenthesized group in the pattern.
|
||||
*
|
||||
* Example:
|
||||
* (clojure.string/replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay")
|
||||
* -> "lmostAay igPay atinLay"
|
||||
*/
|
||||
clojure.string.replace = (function clojure$string$replace(s,match,replacement){
|
||||
if(typeof match === 'string'){
|
||||
@ -62,17 +85,32 @@ return clojure.string.replace_all.call(null,s,match,replacement);
|
||||
return clojure.string.replace_all.call(null,s,match,clojure.string.replace_with.call(null,replacement));
|
||||
}
|
||||
} else {
|
||||
throw [cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid match arg: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(match)].join('');
|
||||
throw ["Invalid match arg: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(match)].join('');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Replaces the first instance of match with replacement in s.
|
||||
*
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*
|
||||
* See also replace.
|
||||
*
|
||||
* The replacement is literal (i.e. none of its characters are treated
|
||||
* specially) for all cases above except pattern / string.
|
||||
*
|
||||
* For pattern / string, $1, $2, etc. in the replacement string are
|
||||
* substituted with the string that matched the corresponding
|
||||
* parenthesized group in the pattern.
|
||||
*
|
||||
* Example:
|
||||
* (clojure.string/replace-first "swap first two words"
|
||||
* #"(\w+)(\s+)(\w+)" "$3$2$1")
|
||||
* -> "first swap two words"
|
||||
*/
|
||||
clojure.string.replace_first = (function clojure$string$replace_first(s,match,replacement){
|
||||
return s.replace(match,replacement);
|
||||
@ -82,23 +120,8 @@ return s.replace(match,replacement);
|
||||
* separated by an optional separator.
|
||||
*/
|
||||
clojure.string.join = (function clojure$string$join(var_args){
|
||||
var args8077 = [];
|
||||
var len__7927__auto___8080 = arguments.length;
|
||||
var i__7928__auto___8081 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8081 < len__7927__auto___8080)){
|
||||
args8077.push((arguments[i__7928__auto___8081]));
|
||||
|
||||
var G__8082 = (i__7928__auto___8081 + (1));
|
||||
i__7928__auto___8081 = G__8082;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8079 = args8077.length;
|
||||
switch (G__8079) {
|
||||
var G__1130 = arguments.length;
|
||||
switch (G__1130) {
|
||||
case 1:
|
||||
return clojure.string.join.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
@ -108,7 +131,7 @@ return clojure.string.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(argum
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8077.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -117,11 +140,11 @@ clojure.string.join.cljs$core$IFn$_invoke$arity$1 = (function (coll){
|
||||
var sb = (new goog.string.StringBuffer());
|
||||
var coll__$1 = cljs.core.seq.call(null,coll);
|
||||
while(true){
|
||||
if(!((coll__$1 == null))){
|
||||
var G__8084 = sb.append([cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,coll__$1))].join(''));
|
||||
var G__8085 = cljs.core.next.call(null,coll__$1);
|
||||
sb = G__8084;
|
||||
coll__$1 = G__8085;
|
||||
if((!((coll__$1 == null)))){
|
||||
var G__1132 = sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,coll__$1)));
|
||||
var G__1133 = cljs.core.next.call(null,coll__$1);
|
||||
sb = G__1132;
|
||||
coll__$1 = G__1133;
|
||||
continue;
|
||||
} else {
|
||||
return sb.toString();
|
||||
@ -134,8 +157,8 @@ clojure.string.join.cljs$core$IFn$_invoke$arity$2 = (function (separator,coll){
|
||||
var sb = (new goog.string.StringBuffer());
|
||||
var coll__$1 = cljs.core.seq.call(null,coll);
|
||||
while(true){
|
||||
if(!((coll__$1 == null))){
|
||||
sb.append([cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,coll__$1))].join(''));
|
||||
if((!((coll__$1 == null)))){
|
||||
sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,coll__$1)));
|
||||
|
||||
var coll__$2 = cljs.core.next.call(null,coll__$1);
|
||||
if((coll__$2 == null)){
|
||||
@ -143,10 +166,10 @@ if((coll__$2 == null)){
|
||||
sb.append(separator);
|
||||
}
|
||||
|
||||
var G__8086 = sb;
|
||||
var G__8087 = coll__$2;
|
||||
sb = G__8086;
|
||||
coll__$1 = G__8087;
|
||||
var G__1134 = sb;
|
||||
var G__1135 = coll__$2;
|
||||
sb = G__1134;
|
||||
coll__$1 = G__1135;
|
||||
continue;
|
||||
} else {
|
||||
return sb.toString();
|
||||
@ -174,18 +197,14 @@ return s.toLowerCase();
|
||||
* characters to lower-case.
|
||||
*/
|
||||
clojure.string.capitalize = (function clojure$string$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(clojure.string.lower_case.call(null,cljs.core.subs.call(null,s,(1))))].join('');
|
||||
}
|
||||
return goog.string.capitalize(s);
|
||||
});
|
||||
clojure.string.pop_last_while_empty = (function clojure$string$pop_last_while_empty(v){
|
||||
var v__$1 = v;
|
||||
while(true){
|
||||
if(("" === cljs.core.peek.call(null,v__$1))){
|
||||
var G__8088 = cljs.core.pop.call(null,v__$1);
|
||||
v__$1 = G__8088;
|
||||
var G__1136 = cljs.core.pop.call(null,v__$1);
|
||||
v__$1 = G__1136;
|
||||
continue;
|
||||
} else {
|
||||
return v__$1;
|
||||
@ -194,22 +213,22 @@ break;
|
||||
}
|
||||
});
|
||||
clojure.string.discard_trailing_if_needed = (function clojure$string$discard_trailing_if_needed(limit,v){
|
||||
if((((0) === limit)) && (((1) < cljs.core.count.call(null,v)))){
|
||||
if(((((0) === limit)) && (((1) < cljs.core.count.call(null,v))))){
|
||||
return clojure.string.pop_last_while_empty.call(null,v);
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
});
|
||||
clojure.string.split_with_empty_regex = (function clojure$string$split_with_empty_regex(s,limit){
|
||||
if(((limit <= (0))) || ((limit >= ((2) + cljs.core.count.call(null,s))))){
|
||||
if((((limit <= (0))) || ((limit >= ((2) + cljs.core.count.call(null,s)))))){
|
||||
return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s)))),"");
|
||||
} else {
|
||||
var pred__8092 = cljs.core._EQ__EQ_;
|
||||
var expr__8093 = limit;
|
||||
if(cljs.core.truth_(pred__8092.call(null,(1),expr__8093))){
|
||||
var pred__1137 = cljs.core._EQ__EQ_;
|
||||
var expr__1138 = limit;
|
||||
if(cljs.core.truth_(pred__1137.call(null,(1),expr__1138))){
|
||||
return (new cljs.core.PersistentVector(null,1,(5),cljs.core.PersistentVector.EMPTY_NODE,[s],null));
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8092.call(null,(2),expr__8093))){
|
||||
if(cljs.core.truth_(pred__1137.call(null,(2),expr__1138))){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,["",s],null));
|
||||
} else {
|
||||
var c = (limit - (2));
|
||||
@ -223,23 +242,8 @@ return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null
|
||||
* the maximum number of splits. Not lazy. Returns vector of the splits.
|
||||
*/
|
||||
clojure.string.split = (function clojure$string$split(var_args){
|
||||
var args8095 = [];
|
||||
var len__7927__auto___8098 = arguments.length;
|
||||
var i__7928__auto___8099 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8099 < len__7927__auto___8098)){
|
||||
args8095.push((arguments[i__7928__auto___8099]));
|
||||
|
||||
var G__8100 = (i__7928__auto___8099 + (1));
|
||||
i__7928__auto___8099 = G__8100;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8097 = args8095.length;
|
||||
switch (G__8097) {
|
||||
var G__1141 = arguments.length;
|
||||
switch (G__1141) {
|
||||
case 2:
|
||||
return clojure.string.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -249,7 +253,7 @@ return clojure.string.split.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(argu
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8095.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -259,7 +263,7 @@ return clojure.string.split.call(null,s,re,(0));
|
||||
});
|
||||
|
||||
clojure.string.split.cljs$core$IFn$_invoke$arity$3 = (function (s,re,limit){
|
||||
return clojure.string.discard_trailing_if_needed.call(null,limit,((("/(?:)/" === [cljs.core.str.cljs$core$IFn$_invoke$arity$1(re)].join('')))?clojure.string.split_with_empty_regex.call(null,s,limit):(((limit < (1)))?cljs.core.vec.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1(s)].join('').split(re)):(function (){var s__$1 = s;
|
||||
return clojure.string.discard_trailing_if_needed.call(null,limit,((("/(?:)/" === cljs.core.str.cljs$core$IFn$_invoke$arity$1(re)))?clojure.string.split_with_empty_regex.call(null,s,limit):(((limit < (1)))?cljs.core.vec.call(null,cljs.core.str.cljs$core$IFn$_invoke$arity$1(s).split(re)):(function (){var s__$1 = s;
|
||||
var limit__$1 = limit;
|
||||
var parts = cljs.core.PersistentVector.EMPTY;
|
||||
while(true){
|
||||
@ -267,14 +271,14 @@ if(((1) === limit__$1)){
|
||||
return cljs.core.conj.call(null,parts,s__$1);
|
||||
} else {
|
||||
var m = cljs.core.re_find.call(null,re,s__$1);
|
||||
if(!((m == null))){
|
||||
if((!((m == null)))){
|
||||
var index = s__$1.indexOf(m);
|
||||
var G__8102 = s__$1.substring((index + cljs.core.count.call(null,m)));
|
||||
var G__8103 = (limit__$1 - (1));
|
||||
var G__8104 = cljs.core.conj.call(null,parts,s__$1.substring((0),index));
|
||||
s__$1 = G__8102;
|
||||
limit__$1 = G__8103;
|
||||
parts = G__8104;
|
||||
var G__1143 = s__$1.substring((index + cljs.core.count.call(null,m)));
|
||||
var G__1144 = (limit__$1 - (1));
|
||||
var G__1145 = cljs.core.conj.call(null,parts,s__$1.substring((0),index));
|
||||
s__$1 = G__1143;
|
||||
limit__$1 = G__1144;
|
||||
parts = G__1145;
|
||||
continue;
|
||||
} else {
|
||||
return cljs.core.conj.call(null,parts,s__$1);
|
||||
@ -288,9 +292,7 @@ break;
|
||||
clojure.string.split.cljs$lang$maxFixedArity = 3;
|
||||
|
||||
/**
|
||||
* Splits s on
|
||||
* or
|
||||
* .
|
||||
* Splits s on \n or \r\n.
|
||||
*/
|
||||
clojure.string.split_lines = (function clojure$string$split_lines(s){
|
||||
return clojure.string.split.call(null,s,/\n|\r\n/);
|
||||
@ -324,9 +326,9 @@ if((index === (0))){
|
||||
return "";
|
||||
} else {
|
||||
var ch = cljs.core.get.call(null,s,(index - (1)));
|
||||
if((("\n" === ch)) || (("\r" === ch))){
|
||||
var G__8105 = (index - (1));
|
||||
index = G__8105;
|
||||
if(((("\n" === ch)) || (("\r" === ch)))){
|
||||
var G__1146 = (index - (1));
|
||||
index = G__1146;
|
||||
continue;
|
||||
} else {
|
||||
return s.substring((0),index);
|
||||
@ -358,14 +360,14 @@ return buffer.toString();
|
||||
} else {
|
||||
var ch = s.charAt(index);
|
||||
var replacement = cljs.core.get.call(null,cmap,ch);
|
||||
if(!((replacement == null))){
|
||||
buffer.append([cljs.core.str.cljs$core$IFn$_invoke$arity$1(replacement)].join(''));
|
||||
if((!((replacement == null)))){
|
||||
buffer.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(replacement));
|
||||
} else {
|
||||
buffer.append(ch);
|
||||
}
|
||||
|
||||
var G__8106 = (index + (1));
|
||||
index = G__8106;
|
||||
var G__1147 = (index + (1));
|
||||
index = G__1147;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@ -376,23 +378,8 @@ break;
|
||||
* forward from from-index or nil if not found.
|
||||
*/
|
||||
clojure.string.index_of = (function clojure$string$index_of(var_args){
|
||||
var args8107 = [];
|
||||
var len__7927__auto___8110 = arguments.length;
|
||||
var i__7928__auto___8111 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8111 < len__7927__auto___8110)){
|
||||
args8107.push((arguments[i__7928__auto___8111]));
|
||||
|
||||
var G__8112 = (i__7928__auto___8111 + (1));
|
||||
i__7928__auto___8111 = G__8112;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8109 = args8107.length;
|
||||
switch (G__8109) {
|
||||
var G__1149 = arguments.length;
|
||||
switch (G__1149) {
|
||||
case 2:
|
||||
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -402,7 +389,7 @@ return clojure.string.index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(a
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8107.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -432,23 +419,8 @@ clojure.string.index_of.cljs$lang$maxFixedArity = 3;
|
||||
* searching backward from from-index or nil if not found.
|
||||
*/
|
||||
clojure.string.last_index_of = (function clojure$string$last_index_of(var_args){
|
||||
var args8114 = [];
|
||||
var len__7927__auto___8117 = arguments.length;
|
||||
var i__7928__auto___8118 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8118 < len__7927__auto___8117)){
|
||||
args8114.push((arguments[i__7928__auto___8118]));
|
||||
|
||||
var G__8119 = (i__7928__auto___8118 + (1));
|
||||
i__7928__auto___8118 = G__8119;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8116 = args8114.length;
|
||||
switch (G__8116) {
|
||||
var G__1152 = arguments.length;
|
||||
switch (G__1152) {
|
||||
case 2:
|
||||
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -458,7 +430,7 @@ return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8114.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -502,4 +474,4 @@ clojure.string.includes_QMARK_ = (function clojure$string$includes_QMARK_(s,subs
|
||||
return goog.string.contains(s,substr);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=string.js.map
|
||||
//# sourceMappingURL=string.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -791,7 +791,7 @@ goog.array.removeAllIf = function(arr, f, opt_obj) {
|
||||
* @return {!Array<?>} The new resultant array.
|
||||
*/
|
||||
goog.array.concat = function(var_args) {
|
||||
return Array.prototype.concat.apply(Array.prototype, arguments);
|
||||
return Array.prototype.concat.apply([], arguments);
|
||||
};
|
||||
|
||||
|
||||
@ -802,7 +802,7 @@ goog.array.concat = function(var_args) {
|
||||
* @template T
|
||||
*/
|
||||
goog.array.join = function(var_args) {
|
||||
return Array.prototype.concat.apply(Array.prototype, arguments);
|
||||
return Array.prototype.concat.apply([], arguments);
|
||||
};
|
||||
|
||||
|
||||
@ -1366,14 +1366,14 @@ goog.array.binaryRemove = function(array, value, opt_compareFn) {
|
||||
/**
|
||||
* Splits an array into disjoint buckets according to a splitting function.
|
||||
* @param {Array<T>} array The array.
|
||||
* @param {function(this:S, T,number,Array<T>):?} sorter Function to call for
|
||||
* @param {function(this:S, T, number, !Array<T>):?} sorter Function to call for
|
||||
* every element. This takes 3 arguments (the element, the index and the
|
||||
* array) and must return a valid object key (a string, number, etc), or
|
||||
* undefined, if that object should not be placed in a bucket.
|
||||
* @param {S=} opt_obj The object to be used as the value of 'this' within
|
||||
* sorter.
|
||||
* @return {!Object} An object, with keys being all of the unique return values
|
||||
* of sorter, and values being arrays containing the items for
|
||||
* @return {!Object<!Array<T>>} An object, with keys being all of the unique
|
||||
* return values of sorter, and values being arrays containing the items for
|
||||
* which the splitter returned that key.
|
||||
* @template T,S
|
||||
*/
|
||||
|
@ -15,19 +15,19 @@
|
||||
/**
|
||||
* @fileoverview Bootstrap for the Google JS Library (Closure).
|
||||
*
|
||||
* In uncompiled mode base.js will write out Closure's deps file, unless the
|
||||
* global <code>CLOSURE_NO_DEPS</code> is set to true. This allows projects to
|
||||
* include their own deps file(s) from different locations.
|
||||
* In uncompiled mode base.js will attempt to load Closure's deps file, unless
|
||||
* the global <code>CLOSURE_NO_DEPS</code> is set to true. This allows projects
|
||||
* to include their own deps file(s) from different locations.
|
||||
*
|
||||
* @author arv@google.com (Erik Arvidsson)
|
||||
* Avoid including base.js more than once. This is strictly discouraged and not
|
||||
* supported. goog.require(...) won't work properly in that case.
|
||||
*
|
||||
* @provideGoog
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @define {boolean} Overridden to true by the compiler when
|
||||
* --process_closure_primitives is specified.
|
||||
* @define {boolean} Overridden to true by the compiler.
|
||||
*/
|
||||
var COMPILED = false;
|
||||
|
||||
@ -90,8 +90,6 @@ goog.global.CLOSURE_DEFINES;
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is not undefined.
|
||||
* WARNING: Do not use this to test if an object has a property. Use the in
|
||||
* operator instead.
|
||||
*
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is defined.
|
||||
@ -102,6 +100,35 @@ goog.isDef = function(val) {
|
||||
return val !== void 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a string.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is a string.
|
||||
*/
|
||||
goog.isString = function(val) {
|
||||
return typeof val == 'string';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a boolean.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is boolean.
|
||||
*/
|
||||
goog.isBoolean = function(val) {
|
||||
return typeof val == 'boolean';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a number.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is a number.
|
||||
*/
|
||||
goog.isNumber = function(val) {
|
||||
return typeof val == 'number';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Builds an object structure for the provided namespace path, ensuring that
|
||||
@ -111,7 +138,7 @@ goog.isDef = function(val) {
|
||||
* @param {string} name name of the object that this file defines.
|
||||
* @param {*=} opt_object the object to expose at the end of the path.
|
||||
* @param {Object=} opt_objectToExportTo The object to add the path to; default
|
||||
* is |goog.global|.
|
||||
* is `goog.global`.
|
||||
* @private
|
||||
*/
|
||||
goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
|
||||
@ -125,17 +152,11 @@ goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
|
||||
cur.execScript('var ' + parts[0]);
|
||||
}
|
||||
|
||||
// Certain browsers cannot parse code in the form for((a in b); c;);
|
||||
// This pattern is produced by the JSCompiler when it collapses the
|
||||
// statement above into the conditional loop below. To prevent this from
|
||||
// happening, use a for-loop and reserve the init logic as below.
|
||||
|
||||
// Parentheses added to eliminate strict JS warning in Firefox.
|
||||
for (var part; parts.length && (part = parts.shift());) {
|
||||
if (!parts.length && goog.isDef(opt_object)) {
|
||||
// last part and we have an object; use it
|
||||
cur[part] = opt_object;
|
||||
} else if (cur[part]) {
|
||||
} else if (cur[part] && cur[part] !== Object.prototype[part]) {
|
||||
cur = cur[part];
|
||||
} else {
|
||||
cur = cur[part] = {};
|
||||
@ -158,11 +179,16 @@ goog.define = function(name, defaultValue) {
|
||||
var value = defaultValue;
|
||||
if (!COMPILED) {
|
||||
if (goog.global.CLOSURE_UNCOMPILED_DEFINES &&
|
||||
// Anti DOM-clobbering runtime check (b/37736576).
|
||||
/** @type {?} */ (goog.global.CLOSURE_UNCOMPILED_DEFINES).nodeType ===
|
||||
undefined &&
|
||||
Object.prototype.hasOwnProperty.call(
|
||||
goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) {
|
||||
value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name];
|
||||
} else if (
|
||||
goog.global.CLOSURE_DEFINES &&
|
||||
// Anti DOM-clobbering runtime check (b/37736576).
|
||||
/** @type {?} */ (goog.global.CLOSURE_DEFINES).nodeType === undefined &&
|
||||
Object.prototype.hasOwnProperty.call(
|
||||
goog.global.CLOSURE_DEFINES, name)) {
|
||||
value = goog.global.CLOSURE_DEFINES[name];
|
||||
@ -174,11 +200,12 @@ goog.define = function(name, defaultValue) {
|
||||
|
||||
/**
|
||||
* @define {boolean} DEBUG is provided as a convenience so that debugging code
|
||||
* that should not be included in a production js_binary can be easily stripped
|
||||
* by specifying --define goog.DEBUG=false to the JSCompiler. For example, most
|
||||
* toString() methods should be declared inside an "if (goog.DEBUG)" conditional
|
||||
* because they are generally used for debugging purposes and it is difficult
|
||||
* for the JSCompiler to statically determine whether they are used.
|
||||
* that should not be included in a production. It can be easily stripped
|
||||
* by specifying --define goog.DEBUG=false to the Closure Compiler aka
|
||||
* JSCompiler. For example, most toString() methods should be declared inside an
|
||||
* "if (goog.DEBUG)" conditional because they are generally used for debugging
|
||||
* purposes and it is difficult for the JSCompiler to statically determine
|
||||
* whether they are used.
|
||||
*/
|
||||
goog.define('goog.DEBUG', true);
|
||||
|
||||
@ -186,7 +213,7 @@ goog.define('goog.DEBUG', true);
|
||||
/**
|
||||
* @define {string} LOCALE defines the locale being used for compilation. It is
|
||||
* used to select locale specific data to be compiled in js binary. BUILD rule
|
||||
* can specify this value by "--define goog.LOCALE=<locale_name>" as JSCompiler
|
||||
* can specify this value by "--define goog.LOCALE=<locale_name>" as a compiler
|
||||
* option.
|
||||
*
|
||||
* Take into account that the locale code format is important. You should use
|
||||
@ -200,7 +227,8 @@ goog.define('goog.DEBUG', true);
|
||||
* For language codes you should use values defined by ISO 693-1. See it here
|
||||
* http://www.w3.org/WAI/ER/IG/ert/iso639.htm. There is only one exception from
|
||||
* this rule: the Hebrew language. For legacy reasons the old code (iw) should
|
||||
* be used instead of the new code (he), see http://wiki/Main/IIISynonyms.
|
||||
* be used instead of the new code (he).
|
||||
*
|
||||
*/
|
||||
goog.define('goog.LOCALE', 'en'); // default to en
|
||||
|
||||
@ -214,7 +242,7 @@ goog.define('goog.LOCALE', 'en'); // default to en
|
||||
*
|
||||
* If your JavaScript can be loaded by a third party site and you are wary about
|
||||
* relying on non-standard implementations, specify
|
||||
* "--define goog.TRUSTED_SITE=false" to the JSCompiler.
|
||||
* "--define goog.TRUSTED_SITE=false" to the compiler.
|
||||
*/
|
||||
goog.define('goog.TRUSTED_SITE', true);
|
||||
|
||||
@ -345,6 +373,7 @@ goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
|
||||
*
|
||||
* @param {string} name Namespace provided by this file in the form
|
||||
* "goog.package.part", is expected but not required.
|
||||
* @return {void}
|
||||
*/
|
||||
goog.module = function(name) {
|
||||
if (!goog.isString(name) || !name ||
|
||||
@ -352,7 +381,13 @@ goog.module = function(name) {
|
||||
throw Error('Invalid module identifier');
|
||||
}
|
||||
if (!goog.isInModuleLoader_()) {
|
||||
throw Error('Module ' + name + ' has been loaded incorrectly.');
|
||||
throw Error(
|
||||
'Module ' + name + ' has been loaded incorrectly. Note, ' +
|
||||
'modules cannot be loaded as normal scripts. They require some kind of ' +
|
||||
'pre-processing step. You\'re likely trying to load a module via a ' +
|
||||
'script tag or as a part of a concatenated bundle without rewriting the ' +
|
||||
'module. For more info see: ' +
|
||||
'https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.');
|
||||
}
|
||||
if (goog.moduleLoaderState_.moduleName) {
|
||||
throw Error('goog.module may only be called once per module.');
|
||||
@ -393,14 +428,14 @@ goog.module.get = function(name) {
|
||||
*/
|
||||
goog.module.getInternal_ = function(name) {
|
||||
if (!COMPILED) {
|
||||
if (goog.isProvided_(name)) {
|
||||
// goog.require only return a value with-in goog.module files.
|
||||
return name in goog.loadedModules_ ? goog.loadedModules_[name] :
|
||||
goog.getObjectByName(name);
|
||||
} else {
|
||||
return null;
|
||||
if (name in goog.loadedModules_) {
|
||||
return goog.loadedModules_[name];
|
||||
} else if (!goog.implicitNamespaces_[name]) {
|
||||
var ns = goog.getObjectByName(name);
|
||||
return ns != null ? ns : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@ -473,6 +508,9 @@ goog.setTestOnly = function(opt_message) {
|
||||
* into the JavaScript binary. If it is required elsewhere, it will be type
|
||||
* checked as normal.
|
||||
*
|
||||
* Before using goog.forwardDeclare, please read the documentation at
|
||||
* https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation to
|
||||
* understand the options and tradeoffs when working with forward declarations.
|
||||
*
|
||||
* @param {string} name The namespace to forward declare in the form of
|
||||
* "goog.package.part".
|
||||
@ -612,7 +650,7 @@ goog.addDependency = function(relPath, provides, requires, opt_loadFlags) {
|
||||
// Externally: https://developers.google.com/closure/library/docs/depswriter
|
||||
//
|
||||
// Because of legacy clients, the DOM loader can't be easily removed from
|
||||
// base.js. Work is being done to make it disableable or replaceable for
|
||||
// base.js. Work was done to make it disableable or replaceable for
|
||||
// different environments (DOM-less JavaScript interpreters like Rhino or V8,
|
||||
// for example). See bootstrap/ for more information.
|
||||
|
||||
@ -644,8 +682,7 @@ goog.logToConsole_ = function(msg) {
|
||||
/**
|
||||
* Implements a system for the dynamic resolution of dependencies that works in
|
||||
* parallel with the BUILD system. Note that all calls to goog.require will be
|
||||
* stripped by the JSCompiler when the --process_closure_primitives option is
|
||||
* used.
|
||||
* stripped by the compiler.
|
||||
* @see goog.provide
|
||||
* @param {string} name Namespace to include (as was given in goog.provide()) in
|
||||
* the form "goog.package.part".
|
||||
@ -653,7 +690,7 @@ goog.logToConsole_ = function(msg) {
|
||||
* module otherwise null.
|
||||
*/
|
||||
goog.require = function(name) {
|
||||
// If the object already exists we do not need do do anything.
|
||||
// If the object already exists we do not need to do anything.
|
||||
if (!COMPILED) {
|
||||
if (goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_) {
|
||||
goog.maybeProcessDeferredDep_(name);
|
||||
@ -662,23 +699,20 @@ goog.require = function(name) {
|
||||
if (goog.isProvided_(name)) {
|
||||
if (goog.isInModuleLoader_()) {
|
||||
return goog.module.getInternal_(name);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (goog.ENABLE_DEBUG_LOADER) {
|
||||
} else if (goog.ENABLE_DEBUG_LOADER) {
|
||||
var path = goog.getPathFromDeps_(name);
|
||||
if (path) {
|
||||
goog.writeScripts_(path);
|
||||
return null;
|
||||
} else {
|
||||
var errorMessage = 'goog.require could not find: ' + name;
|
||||
goog.logToConsole_(errorMessage);
|
||||
|
||||
throw Error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
var errorMessage = 'goog.require could not find: ' + name;
|
||||
goog.logToConsole_(errorMessage);
|
||||
|
||||
throw Error(errorMessage);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@ -698,7 +732,8 @@ goog.global.CLOSURE_BASE_PATH;
|
||||
|
||||
|
||||
/**
|
||||
* Whether to write out Closure's deps file. By default, the deps are written.
|
||||
* Whether to attempt to load Closure's deps file. By default, when uncompiled,
|
||||
* deps files will attempt to be loaded.
|
||||
* @type {boolean|undefined}
|
||||
*/
|
||||
goog.global.CLOSURE_NO_DEPS;
|
||||
@ -731,9 +766,6 @@ goog.nullFunction = function() {};
|
||||
* Now if a subclass of Foo fails to override bar(), an error will be thrown
|
||||
* when bar() is invoked.
|
||||
*
|
||||
* Note: This does not take the name of the function to override as an argument
|
||||
* because that would make it more difficult to obfuscate our JavaScript code.
|
||||
*
|
||||
* @type {!Function}
|
||||
* @throws {Error} when invoked to indicate the method should be overridden.
|
||||
*/
|
||||
@ -749,6 +781,10 @@ goog.abstractMethod = function() {
|
||||
* method to.
|
||||
*/
|
||||
goog.addSingletonGetter = function(ctor) {
|
||||
// instance_ is immediately set to prevent issues with sealed constructors
|
||||
// such as are encountered when a constructor is returned as the export object
|
||||
// of a goog.module in unoptimized code.
|
||||
ctor.instance_ = undefined;
|
||||
ctor.getInstance = function() {
|
||||
if (ctor.instance_) {
|
||||
return ctor.instance_;
|
||||
@ -870,7 +906,9 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
* @private
|
||||
*/
|
||||
goog.findBasePath_ = function() {
|
||||
if (goog.isDef(goog.global.CLOSURE_BASE_PATH)) {
|
||||
if (goog.isDef(goog.global.CLOSURE_BASE_PATH) &&
|
||||
// Anti DOM-clobbering runtime check (b/37736576).
|
||||
goog.isString(goog.global.CLOSURE_BASE_PATH)) {
|
||||
goog.basePath = goog.global.CLOSURE_BASE_PATH;
|
||||
return;
|
||||
} else if (!goog.inHtmlDocument_()) {
|
||||
@ -878,7 +916,13 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
}
|
||||
/** @type {Document} */
|
||||
var doc = goog.global.document;
|
||||
var scripts = doc.getElementsByTagName('SCRIPT');
|
||||
// If we have a currentScript available, use it exclusively.
|
||||
var currentScript = doc.currentScript;
|
||||
if (currentScript) {
|
||||
var scripts = [currentScript];
|
||||
} else {
|
||||
var scripts = doc.getElementsByTagName('SCRIPT');
|
||||
}
|
||||
// Search backwards since the current script is in almost all cases the one
|
||||
// that has base.js.
|
||||
for (var i = scripts.length - 1; i >= 0; --i) {
|
||||
@ -919,6 +963,17 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
!!(!goog.global.atob && goog.global.document && goog.global.document.all);
|
||||
|
||||
|
||||
/**
|
||||
* Whether IE9 or earlier is waiting on a dependency. This ensures that
|
||||
* deferred modules that have no non-deferred dependencies actually get
|
||||
* loaded, since if we defer them and then never pull in a non-deferred
|
||||
* script, then `goog.loadQueuedModules_` will never be called. Instead,
|
||||
* if not waiting on anything we simply don't defer in the first place.
|
||||
* @private {boolean}
|
||||
*/
|
||||
goog.oldIeWaiting_ = false;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL initiate retrieval and execution of a script that needs
|
||||
* pre-processing.
|
||||
@ -1003,6 +1058,7 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
goog.maybeProcessDeferredPath_(path);
|
||||
}
|
||||
}
|
||||
goog.oldIeWaiting_ = false;
|
||||
};
|
||||
|
||||
|
||||
@ -1028,8 +1084,9 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
goog.isDeferredModule_ = function(name) {
|
||||
var path = goog.getPathFromDeps_(name);
|
||||
var loadFlags = path && goog.dependencies_.loadFlags[path] || {};
|
||||
var languageLevel = loadFlags['lang'] || 'es3';
|
||||
if (path && (loadFlags['module'] == 'goog' ||
|
||||
goog.needsTranspile_(loadFlags['lang']))) {
|
||||
goog.needsTranspile_(languageLevel))) {
|
||||
var abspath = goog.basePath + path;
|
||||
return (abspath) in goog.dependencies_.deferred;
|
||||
}
|
||||
@ -1097,68 +1154,6 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {function(?):?|string} moduleDef The module definition.
|
||||
*/
|
||||
goog.loadModule = function(moduleDef) {
|
||||
// NOTE: we allow function definitions to be either in the from
|
||||
// of a string to eval (which keeps the original source intact) or
|
||||
// in a eval forbidden environment (CSP) we allow a function definition
|
||||
// which in its body must call {@code goog.module}, and return the exports
|
||||
// of the module.
|
||||
var previousState = goog.moduleLoaderState_;
|
||||
try {
|
||||
goog.moduleLoaderState_ = {
|
||||
moduleName: undefined,
|
||||
declareLegacyNamespace: false
|
||||
};
|
||||
var exports;
|
||||
if (goog.isFunction(moduleDef)) {
|
||||
exports = moduleDef.call(goog.global, {});
|
||||
} else if (goog.isString(moduleDef)) {
|
||||
exports = goog.loadModuleFromSource_.call(goog.global, moduleDef);
|
||||
} else {
|
||||
throw Error('Invalid module definition');
|
||||
}
|
||||
|
||||
var moduleName = goog.moduleLoaderState_.moduleName;
|
||||
if (!goog.isString(moduleName) || !moduleName) {
|
||||
throw Error('Invalid module name \"' + moduleName + '\"');
|
||||
}
|
||||
|
||||
// Don't seal legacy namespaces as they may be uses as a parent of
|
||||
// another namespace
|
||||
if (goog.moduleLoaderState_.declareLegacyNamespace) {
|
||||
goog.constructNamespace_(moduleName, exports);
|
||||
} else if (goog.SEAL_MODULE_EXPORTS && Object.seal) {
|
||||
Object.seal(exports);
|
||||
}
|
||||
|
||||
goog.loadedModules_[moduleName] = exports;
|
||||
} finally {
|
||||
goog.moduleLoaderState_ = previousState;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private @const {function(string):?}
|
||||
*
|
||||
* The new type inference warns because this function has no formal
|
||||
* parameters, but its jsdoc says that it takes one argument.
|
||||
* (The argument is used via arguments[0], but NTI does not detect this.)
|
||||
* @suppress {newCheckTypes}
|
||||
*/
|
||||
goog.loadModuleFromSource_ = function() {
|
||||
// NOTE: we avoid declaring parameters or local variables here to avoid
|
||||
// masking globals or leaking values into the module definition.
|
||||
'use strict';
|
||||
var exports = {};
|
||||
eval(arguments[0]);
|
||||
return exports;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Writes a new script pointing to {@code src} directly into the DOM.
|
||||
*
|
||||
@ -1246,8 +1241,9 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
goog.writeScriptSrcNode_(src);
|
||||
}
|
||||
} else {
|
||||
var state = " onreadystatechange='goog.onScriptLoad_(this, " +
|
||||
++goog.lastNonModuleScriptIndex_ + ")' ";
|
||||
goog.oldIeWaiting_ = true;
|
||||
var state = ' onreadystatechange=\'goog.onScriptLoad_(this, ' +
|
||||
++goog.lastNonModuleScriptIndex_ + ')\' ';
|
||||
doc.write(
|
||||
'<script type="text/javascript" src="' + src + '"' + state +
|
||||
'></' +
|
||||
@ -1255,7 +1251,8 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
}
|
||||
} else {
|
||||
doc.write(
|
||||
'<script type="text/javascript">' + opt_sourceText + '</' +
|
||||
'<script type="text/javascript">' +
|
||||
goog.protectScriptTag_(opt_sourceText) + '</' +
|
||||
'script>');
|
||||
}
|
||||
return true;
|
||||
@ -1264,6 +1261,17 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Rewrites closing script tags in input to avoid ending an enclosing script
|
||||
* tag.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
goog.protectScriptTag_ = function(str) {
|
||||
return str.replace(/<\/(SCRIPT)/ig, '\\x3c/$1');
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether the given language needs to be transpiled.
|
||||
@ -1276,53 +1284,18 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
return true;
|
||||
} else if (goog.TRANSPILE == 'never') {
|
||||
return false;
|
||||
} else if (!goog.transpiledLanguages_) {
|
||||
goog.transpiledLanguages_ = {'es5': true, 'es6': true, 'es6-impl': true};
|
||||
/** @preserveTry */
|
||||
try {
|
||||
// Perform some quick conformance checks, to distinguish
|
||||
// between browsers that support es5, es6-impl, or es6.
|
||||
|
||||
// Identify ES3-only browsers by their incorrect treatment of commas.
|
||||
goog.transpiledLanguages_['es5'] = eval('[1,].length!=1');
|
||||
|
||||
// As browsers mature, features will be moved from the full test
|
||||
// into the impl test. This must happen before the corresponding
|
||||
// features are changed in the Closure Compiler's FeatureSet object.
|
||||
|
||||
// Test 1: es6-impl [FF49, Edge 13, Chrome 49]
|
||||
// (a) let/const keyword, (b) class expressions, (c) Map object,
|
||||
// (d) iterable arguments, (e) spread operator
|
||||
var es6implTest =
|
||||
'let a={};const X=class{constructor(){}x(z){return new Map([' +
|
||||
'...arguments]).get(z[0])==3}};return new X().x([a,3])';
|
||||
|
||||
// Test 2: es6 [FF50 (?), Edge 14 (?), Chrome 50]
|
||||
// (a) default params (specifically shadowing locals),
|
||||
// (b) destructuring, (c) block-scoped functions,
|
||||
// (d) for-of (const), (e) new.target/Reflect.construct
|
||||
var es6fullTest =
|
||||
'class X{constructor(){if(new.target!=String)throw 1;this.x=42}}' +
|
||||
'let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof ' +
|
||||
'String))throw 1;for(const a of[2,3]){if(a==2)continue;function ' +
|
||||
'f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()' +
|
||||
'==3}';
|
||||
|
||||
if (eval('(()=>{"use strict";' + es6implTest + '})()')) {
|
||||
goog.transpiledLanguages_['es6-impl'] = false;
|
||||
}
|
||||
if (eval('(()=>{"use strict";' + es6fullTest + '})()')) {
|
||||
goog.transpiledLanguages_['es6'] = false;
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
} else if (!goog.requiresTranspilation_) {
|
||||
goog.requiresTranspilation_ = goog.createRequiresTranspilation_();
|
||||
}
|
||||
if (lang in goog.requiresTranspilation_) {
|
||||
return goog.requiresTranspilation_[lang];
|
||||
} else {
|
||||
throw new Error('Unknown language mode: ' + lang);
|
||||
}
|
||||
return !!goog.transpiledLanguages_[lang];
|
||||
};
|
||||
|
||||
|
||||
/** @private {?Object<string, boolean>} */
|
||||
goog.transpiledLanguages_ = null;
|
||||
goog.requiresTranspilation_ = null;
|
||||
|
||||
|
||||
/** @private {number} */
|
||||
@ -1331,7 +1304,7 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
|
||||
/**
|
||||
* A readystatechange handler for legacy IE
|
||||
* @param {!HTMLScriptElement} script
|
||||
* @param {?} script
|
||||
* @param {number} scriptIndex
|
||||
* @return {boolean}
|
||||
* @private
|
||||
@ -1411,7 +1384,8 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
var path = scripts[i];
|
||||
if (path) {
|
||||
var loadFlags = deps.loadFlags[path] || {};
|
||||
var needsTranspile = goog.needsTranspile_(loadFlags['lang']);
|
||||
var languageLevel = loadFlags['lang'] || 'es3';
|
||||
var needsTranspile = goog.needsTranspile_(languageLevel);
|
||||
if (loadFlags['module'] == 'goog' || needsTranspile) {
|
||||
goog.importProcessedScript_(
|
||||
goog.basePath + path, loadFlags['module'] == 'goog',
|
||||
@ -1454,6 +1428,111 @@ if (goog.DEPENDENCIES_ENABLED) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @package {?boolean}
|
||||
* Visible for testing.
|
||||
*/
|
||||
goog.hasBadLetScoping = null;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @package Visible for testing.
|
||||
*/
|
||||
goog.useSafari10Workaround = function() {
|
||||
if (goog.hasBadLetScoping == null) {
|
||||
var hasBadLetScoping;
|
||||
try {
|
||||
hasBadLetScoping = !eval(
|
||||
'"use strict";' +
|
||||
'let x = 1; function f() { return typeof x; };' +
|
||||
'f() == "number";');
|
||||
} catch (e) {
|
||||
// Assume that ES6 syntax isn't supported.
|
||||
hasBadLetScoping = false;
|
||||
}
|
||||
goog.hasBadLetScoping = hasBadLetScoping;
|
||||
}
|
||||
return goog.hasBadLetScoping;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} moduleDef
|
||||
* @return {string}
|
||||
* @package Visible for testing.
|
||||
*/
|
||||
goog.workaroundSafari10EvalBug = function(moduleDef) {
|
||||
return '(function(){' + moduleDef +
|
||||
'\n' + // Terminate any trailing single line comment.
|
||||
';' + // Terminate any trailing expression.
|
||||
'})();\n';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {function(?):?|string} moduleDef The module definition.
|
||||
*/
|
||||
goog.loadModule = function(moduleDef) {
|
||||
// NOTE: we allow function definitions to be either in the from
|
||||
// of a string to eval (which keeps the original source intact) or
|
||||
// in a eval forbidden environment (CSP) we allow a function definition
|
||||
// which in its body must call {@code goog.module}, and return the exports
|
||||
// of the module.
|
||||
var previousState = goog.moduleLoaderState_;
|
||||
try {
|
||||
goog.moduleLoaderState_ = {
|
||||
moduleName: undefined,
|
||||
declareLegacyNamespace: false
|
||||
};
|
||||
var exports;
|
||||
if (goog.isFunction(moduleDef)) {
|
||||
exports = moduleDef.call(undefined, {});
|
||||
} else if (goog.isString(moduleDef)) {
|
||||
if (goog.useSafari10Workaround()) {
|
||||
moduleDef = goog.workaroundSafari10EvalBug(moduleDef);
|
||||
}
|
||||
|
||||
exports = goog.loadModuleFromSource_.call(undefined, moduleDef);
|
||||
} else {
|
||||
throw Error('Invalid module definition');
|
||||
}
|
||||
|
||||
var moduleName = goog.moduleLoaderState_.moduleName;
|
||||
if (!goog.isString(moduleName) || !moduleName) {
|
||||
throw Error('Invalid module name \"' + moduleName + '\"');
|
||||
}
|
||||
|
||||
// Don't seal legacy namespaces as they may be uses as a parent of
|
||||
// another namespace
|
||||
if (goog.moduleLoaderState_.declareLegacyNamespace) {
|
||||
goog.constructNamespace_(moduleName, exports);
|
||||
} else if (
|
||||
goog.SEAL_MODULE_EXPORTS && Object.seal && typeof exports == 'object' &&
|
||||
exports != null) {
|
||||
Object.seal(exports);
|
||||
}
|
||||
|
||||
goog.loadedModules_[moduleName] = exports;
|
||||
} finally {
|
||||
goog.moduleLoaderState_ = previousState;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private @const
|
||||
*/
|
||||
goog.loadModuleFromSource_ = /** @type {function(string):?} */ (function() {
|
||||
// NOTE: we avoid declaring parameters or local variables here to avoid
|
||||
// masking globals or leaking values into the module definition.
|
||||
'use strict';
|
||||
var exports = {};
|
||||
eval(arguments[0]);
|
||||
return exports;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Normalize a file path by removing redundant ".." and extraneous "." file
|
||||
* path components.
|
||||
@ -1479,6 +1558,15 @@ goog.normalizePath_ = function(path) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Provides a hook for loading a file when using Closure's goog.require() API
|
||||
* with goog.modules. In particular this hook is provided to support Node.js.
|
||||
*
|
||||
* @type {(function(string):string)|undefined}
|
||||
*/
|
||||
goog.global.CLOSURE_LOAD_FILE_SYNC;
|
||||
|
||||
|
||||
/**
|
||||
* Loads file by synchronous XHR. Should not be used in production environments.
|
||||
* @param {string} src Source URL.
|
||||
@ -1540,7 +1628,7 @@ goog.retrieveAndExec_ = function(src, isModule, needsTranspile) {
|
||||
scriptText += '\n//# sourceURL=' + src;
|
||||
}
|
||||
var isOldIE = goog.IS_OLD_IE_;
|
||||
if (isOldIE) {
|
||||
if (isOldIE && goog.oldIeWaiting_) {
|
||||
goog.dependencies_.deferred[originalPath] = scriptText;
|
||||
goog.queuedModules_.push(originalPath);
|
||||
} else {
|
||||
@ -1571,7 +1659,20 @@ goog.transpile_ = function(code, path) {
|
||||
// need it, we're about to load and write the ES6 code synchronously,
|
||||
// so a normal script-tag load will be too slow.
|
||||
eval(transpilerCode + '\n//# sourceURL=' + transpilerPath);
|
||||
// Note: transpile.js reassigns goog.global['$jscomp'] so pull it again.
|
||||
// Even though the transpiler is optional, if $gwtExport is found, it's
|
||||
// a sign the transpiler was loaded and the $jscomp.transpile *should*
|
||||
// be there.
|
||||
if (goog.global['$gwtExport'] && goog.global['$gwtExport']['$jscomp'] &&
|
||||
!goog.global['$gwtExport']['$jscomp']['transpile']) {
|
||||
throw new Error(
|
||||
'The transpiler did not properly export the "transpile" ' +
|
||||
'method. $gwtExport: ' + JSON.stringify(goog.global['$gwtExport']));
|
||||
}
|
||||
// transpile.js only exports a single $jscomp function, transpile. We
|
||||
// grab just that and add it to the existing definition of $jscomp which
|
||||
// contains the polyfills.
|
||||
goog.global['$jscomp'].transpile =
|
||||
goog.global['$gwtExport']['$jscomp']['transpile'];
|
||||
jscomp = goog.global['$jscomp'];
|
||||
transpile = jscomp.transpile;
|
||||
}
|
||||
@ -1755,36 +1856,6 @@ goog.isDateLike = function(val) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a string.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is a string.
|
||||
*/
|
||||
goog.isString = function(val) {
|
||||
return typeof val == 'string';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a boolean.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is boolean.
|
||||
*/
|
||||
goog.isBoolean = function(val) {
|
||||
return typeof val == 'boolean';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a number.
|
||||
* @param {?} val Variable to test.
|
||||
* @return {boolean} Whether variable is a number.
|
||||
*/
|
||||
goog.isNumber = function(val) {
|
||||
return typeof val == 'number';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the specified value is a function.
|
||||
* @param {?} val Variable to test.
|
||||
@ -1858,7 +1929,7 @@ goog.removeUid = function(obj) {
|
||||
if (obj !== null && 'removeAttribute' in obj) {
|
||||
obj.removeAttribute(goog.UID_PROPERTY_);
|
||||
}
|
||||
/** @preserveTry */
|
||||
|
||||
try {
|
||||
delete obj[goog.UID_PROPERTY_];
|
||||
} catch (ex) {
|
||||
@ -1935,17 +2006,15 @@ goog.cloneObject = function(obj) {
|
||||
|
||||
/**
|
||||
* A native implementation of goog.bind.
|
||||
* @param {Function} fn A function to partially apply.
|
||||
* @param {Object|undefined} selfObj Specifies the object which this should
|
||||
* point to when the function is run.
|
||||
* @param {?function(this:T, ...)} fn A function to partially apply.
|
||||
* @param {T} selfObj Specifies the object which this should point to when the
|
||||
* function is run.
|
||||
* @param {...*} var_args Additional arguments that are partially applied to the
|
||||
* function.
|
||||
* @return {!Function} A partially-applied form of the function bind() was
|
||||
* @return {!Function} A partially-applied form of the function goog.bind() was
|
||||
* invoked as a method of.
|
||||
* @template T
|
||||
* @private
|
||||
* @suppress {deprecated} The compiler thinks that Function.prototype.bind is
|
||||
* deprecated because some people have declared a pure-JS version.
|
||||
* Only the pure-JS version is truly deprecated.
|
||||
*/
|
||||
goog.bindNative_ = function(fn, selfObj, var_args) {
|
||||
return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments));
|
||||
@ -1954,13 +2023,14 @@ goog.bindNative_ = function(fn, selfObj, var_args) {
|
||||
|
||||
/**
|
||||
* A pure-JS implementation of goog.bind.
|
||||
* @param {Function} fn A function to partially apply.
|
||||
* @param {Object|undefined} selfObj Specifies the object which this should
|
||||
* point to when the function is run.
|
||||
* @param {?function(this:T, ...)} fn A function to partially apply.
|
||||
* @param {T} selfObj Specifies the object which this should point to when the
|
||||
* function is run.
|
||||
* @param {...*} var_args Additional arguments that are partially applied to the
|
||||
* function.
|
||||
* @return {!Function} A partially-applied form of the function bind() was
|
||||
* @return {!Function} A partially-applied form of the function goog.bind() was
|
||||
* invoked as a method of.
|
||||
* @template T
|
||||
* @private
|
||||
*/
|
||||
goog.bindJs_ = function(fn, selfObj, var_args) {
|
||||
@ -1978,7 +2048,9 @@ goog.bindJs_ = function(fn, selfObj, var_args) {
|
||||
};
|
||||
|
||||
} else {
|
||||
return function() { return fn.apply(selfObj, arguments); };
|
||||
return function() {
|
||||
return fn.apply(selfObj, arguments);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -2158,6 +2230,17 @@ goog.cssNameMapping_;
|
||||
goog.cssNameMappingStyle_;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A hook for modifying the default behavior goog.getCssName. The function
|
||||
* if present, will recieve the standard output of the goog.getCssName as
|
||||
* its input.
|
||||
*
|
||||
* @type {(function(string):string)|undefined}
|
||||
*/
|
||||
goog.global.CLOSURE_CSS_NAME_MAP_FN;
|
||||
|
||||
|
||||
/**
|
||||
* Handles strings that are intended to be used as CSS class names.
|
||||
*
|
||||
@ -2190,6 +2273,14 @@ goog.cssNameMappingStyle_;
|
||||
* the modifier.
|
||||
*/
|
||||
goog.getCssName = function(className, opt_modifier) {
|
||||
// String() is used for compatibility with compiled soy where the passed
|
||||
// className can be non-string objects.
|
||||
if (String(className).charAt(0) == '.') {
|
||||
throw new Error(
|
||||
'className passed in goog.getCssName must not start with ".".' +
|
||||
' You passed: ' + className);
|
||||
}
|
||||
|
||||
var getMapping = function(cssName) {
|
||||
return goog.cssNameMapping_[cssName] || cssName;
|
||||
};
|
||||
@ -2209,14 +2300,21 @@ goog.getCssName = function(className, opt_modifier) {
|
||||
rename =
|
||||
goog.cssNameMappingStyle_ == 'BY_WHOLE' ? getMapping : renameByParts;
|
||||
} else {
|
||||
rename = function(a) { return a; };
|
||||
rename = function(a) {
|
||||
return a;
|
||||
};
|
||||
}
|
||||
|
||||
if (opt_modifier) {
|
||||
return className + '-' + rename(opt_modifier);
|
||||
} else {
|
||||
return rename(className);
|
||||
var result =
|
||||
opt_modifier ? className + '-' + rename(opt_modifier) : rename(className);
|
||||
|
||||
// The special CLOSURE_CSS_NAME_MAP_FN allows users to specify further
|
||||
// processing of the class name.
|
||||
if (goog.global.CLOSURE_CSS_NAME_MAP_FN) {
|
||||
return goog.global.CLOSURE_CSS_NAME_MAP_FN(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
@ -2443,6 +2541,9 @@ goog.inherits = function(childCtor, parentCtor) {
|
||||
* @return {*} The return value of the superclass method.
|
||||
* @suppress {es5Strict} This method can not be used in strict mode, but
|
||||
* all Closure Library consumers must depend on this file.
|
||||
* @deprecated goog.base is not strict mode compatible. Prefer the static
|
||||
* "base" method added to the constructor by goog.inherits
|
||||
* or ES6 classes and the "super" keyword.
|
||||
*/
|
||||
goog.base = function(me, opt_methodName, var_args) {
|
||||
var caller = arguments.callee.caller;
|
||||
@ -2593,7 +2694,6 @@ goog.defineClass = function(superClass, def) {
|
||||
* constructor: (!Function|undefined),
|
||||
* statics: (Object|undefined|function(Function):void)
|
||||
* }}
|
||||
* @suppress {missingProvide}
|
||||
*/
|
||||
goog.defineClass.ClassDescriptor;
|
||||
|
||||
@ -2652,7 +2752,7 @@ goog.defineClass.createSealingConstructor_ = function(ctr, superClass) {
|
||||
|
||||
/**
|
||||
* @param {Function} ctr The constructor to test.
|
||||
* @returns {boolean} Whether the constructor has been tagged as unsealable
|
||||
* @return {boolean} Whether the constructor has been tagged as unsealable
|
||||
* using goog.tagUnsealableClass.
|
||||
* @private
|
||||
*/
|
||||
@ -2725,3 +2825,97 @@ goog.tagUnsealableClass = function(ctr) {
|
||||
* @const @private {string}
|
||||
*/
|
||||
goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = 'goog_defineClass_legacy_unsealable';
|
||||
|
||||
|
||||
/**
|
||||
* Returns a newly created map from language mode string to a boolean
|
||||
* indicating whether transpilation should be done for that mode.
|
||||
*
|
||||
* Guaranteed invariant:
|
||||
* For any two modes, l1 and l2 where l2 is a newer mode than l1,
|
||||
* `map[l1] == true` implies that `map[l2] == true`.
|
||||
* @private
|
||||
* @return {!Object<string, boolean>}
|
||||
*/
|
||||
goog.createRequiresTranspilation_ = function() {
|
||||
var /** !Object<string, boolean> */ requiresTranspilation = {'es3': false};
|
||||
var transpilationRequiredForAllLaterModes = false;
|
||||
|
||||
/**
|
||||
* Adds an entry to requiresTranspliation for the given language mode.
|
||||
*
|
||||
* IMPORTANT: Calls must be made in order from oldest to newest language
|
||||
* mode.
|
||||
* @param {string} modeName
|
||||
* @param {function(): boolean} isSupported Returns true if the JS engine
|
||||
* supports the given mode.
|
||||
*/
|
||||
function addNewerLanguageTranspilationCheck(modeName, isSupported) {
|
||||
if (transpilationRequiredForAllLaterModes) {
|
||||
requiresTranspilation[modeName] = true;
|
||||
} else if (isSupported()) {
|
||||
requiresTranspilation[modeName] = false;
|
||||
} else {
|
||||
requiresTranspilation[modeName] = true;
|
||||
transpilationRequiredForAllLaterModes = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the given code evaluate without syntax errors and return a truthy
|
||||
* result?
|
||||
*/
|
||||
function /** boolean */ evalCheck(/** string */ code) {
|
||||
try {
|
||||
return !!eval(code);
|
||||
} catch (ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var userAgent = goog.global.navigator && goog.global.navigator.userAgent ?
|
||||
goog.global.navigator.userAgent :
|
||||
'';
|
||||
|
||||
// Identify ES3-only browsers by their incorrect treatment of commas.
|
||||
addNewerLanguageTranspilationCheck('es5', function() {
|
||||
return evalCheck('[1,].length==1');
|
||||
});
|
||||
addNewerLanguageTranspilationCheck('es6', function() {
|
||||
// Edge has a non-deterministic (i.e., not reproducible) bug with ES6:
|
||||
// https://github.com/Microsoft/ChakraCore/issues/1496.
|
||||
var re = /Edge\/(\d+)(\.\d)*/i;
|
||||
var edgeUserAgent = userAgent.match(re);
|
||||
if (edgeUserAgent && Number(edgeUserAgent[1]) < 15) {
|
||||
return false;
|
||||
}
|
||||
// Test es6: [FF50 (?), Edge 14 (?), Chrome 50]
|
||||
// (a) default params (specifically shadowing locals),
|
||||
// (b) destructuring, (c) block-scoped functions,
|
||||
// (d) for-of (const), (e) new.target/Reflect.construct
|
||||
var es6fullTest =
|
||||
'class X{constructor(){if(new.target!=String)throw 1;this.x=42}}' +
|
||||
'let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof ' +
|
||||
'String))throw 1;for(const a of[2,3]){if(a==2)continue;function ' +
|
||||
'f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()' +
|
||||
'==3}';
|
||||
|
||||
return evalCheck('(()=>{"use strict";' + es6fullTest + '})()');
|
||||
});
|
||||
// TODO(joeltine): Remove es6-impl references for b/31340605.
|
||||
// Consider es6-impl (widely-implemented es6 features) to be supported
|
||||
// whenever es6 is supported. Technically es6-impl is a lower level of
|
||||
// support than es6, but we don't have tests specifically for it.
|
||||
addNewerLanguageTranspilationCheck('es6-impl', function() {
|
||||
return true;
|
||||
});
|
||||
// ** and **= are the only new features in 'es7'
|
||||
addNewerLanguageTranspilationCheck('es7', function() {
|
||||
return evalCheck('2 ** 2 == 4');
|
||||
});
|
||||
// async functions are the only new features in 'es8'
|
||||
addNewerLanguageTranspilationCheck('es8', function() {
|
||||
return evalCheck('async () => 1, true');
|
||||
});
|
||||
return requiresTranspilation;
|
||||
};
|
||||
|
File diff suppressed because one or more lines are too long
@ -20,9 +20,7 @@
|
||||
|
||||
|
||||
goog.provide('goog.Disposable');
|
||||
/** @suppress {extraProvide} */
|
||||
goog.provide('goog.dispose');
|
||||
/** @suppress {extraProvide} */
|
||||
goog.provide('goog.disposeAll');
|
||||
|
||||
goog.require('goog.disposable.IDisposable');
|
||||
@ -38,6 +36,13 @@ goog.require('goog.disposable.IDisposable');
|
||||
* @implements {goog.disposable.IDisposable}
|
||||
*/
|
||||
goog.Disposable = function() {
|
||||
/**
|
||||
* If monitoring the goog.Disposable instances is enabled, stores the creation
|
||||
* stack trace of the Disposable instance.
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.creationStack;
|
||||
|
||||
if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) {
|
||||
if (goog.Disposable.INCLUDE_STACK_ON_CREATION) {
|
||||
this.creationStack = new Error().stack;
|
||||
@ -139,14 +144,6 @@ goog.Disposable.prototype.disposed_ = false;
|
||||
goog.Disposable.prototype.onDisposeCallbacks_;
|
||||
|
||||
|
||||
/**
|
||||
* If monitoring the goog.Disposable instances is enabled, stores the creation
|
||||
* stack trace of the Disposable instance.
|
||||
* @const {string}
|
||||
*/
|
||||
goog.Disposable.prototype.creationStack;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the object has been disposed of.
|
||||
* @override
|
||||
@ -215,7 +212,7 @@ goog.Disposable.prototype.registerDisposable = function(disposable) {
|
||||
*/
|
||||
goog.Disposable.prototype.addOnDisposeCallback = function(callback, opt_scope) {
|
||||
if (this.disposed_) {
|
||||
callback.call(opt_scope);
|
||||
goog.isDef(opt_scope) ? callback.call(opt_scope) : callback();
|
||||
return;
|
||||
}
|
||||
if (!this.onDisposeCallbacks_) {
|
||||
|
@ -25,9 +25,9 @@ goog.provide('goog.disposable.IDisposable');
|
||||
|
||||
/**
|
||||
* Interface for a disposable object. If a instance requires cleanup
|
||||
* (references COM objects, DOM notes, or other disposable objects), it should
|
||||
* (references COM objects, DOM nodes, or other disposable objects), it should
|
||||
* implement this interface (it may subclass goog.Disposable).
|
||||
* @interface
|
||||
* @record
|
||||
*/
|
||||
goog.disposable.IDisposable = function() {};
|
||||
|
||||
|
311
assets/viz/2/goog/dom/asserts.js
Normal file
311
assets/viz/2/goog/dom/asserts.js
Normal file
@ -0,0 +1,311 @@
|
||||
// Copyright 2017 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
goog.provide('goog.dom.asserts');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
|
||||
/**
|
||||
* @fileoverview Custom assertions to ensure that an element has the appropriate
|
||||
* type.
|
||||
*
|
||||
* Using a goog.dom.safe wrapper on an object on the incorrect type (via an
|
||||
* incorrect static type cast) can result in security bugs: For instance,
|
||||
* g.d.s.setAnchorHref ensures that the URL assigned to the .href attribute
|
||||
* satisfies the SafeUrl contract, i.e., is safe to dereference as a hyperlink.
|
||||
* However, the value assigned to a HTMLLinkElement's .href property requires
|
||||
* the stronger TrustedResourceUrl contract, since it can refer to a stylesheet.
|
||||
* Thus, using g.d.s.setAnchorHref on an (incorrectly statically typed) object
|
||||
* of type HTMLLinkElement can result in a security vulnerability.
|
||||
* Assertions of the correct run-time type help prevent such incorrect use.
|
||||
*
|
||||
* In some cases, code using the DOM API is tested using mock objects (e.g., a
|
||||
* plain object such as {'href': url} instead of an actual Location object).
|
||||
* To allow such mocking, the assertions permit objects of types that are not
|
||||
* relevant DOM API objects at all (for instance, not Element or Location).
|
||||
*
|
||||
* Note that instanceof checks don't work straightforwardly in older versions of
|
||||
* IE, or across frames (see,
|
||||
* http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object,
|
||||
* http://stackoverflow.com/questions/26248599/instanceof-htmlelement-in-iframe-is-not-element-or-object).
|
||||
*
|
||||
* Hence, these assertions may pass vacuously in such scenarios. The resulting
|
||||
* risk of security bugs is limited by the following factors:
|
||||
* - A bug can only arise in scenarios involving incorrect static typing (the
|
||||
* wrapper methods are statically typed to demand objects of the appropriate,
|
||||
* precise type).
|
||||
* - Typically, code is tested and exercised in multiple browsers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a Location.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where DOM APIs might
|
||||
* be mocked, also accepts any other type except for subtypes of {!Element}.
|
||||
* This is to ensure that, for instance, HTMLLinkElement is not being used in
|
||||
* place of a Location, since this could result in security bugs due to stronger
|
||||
* contracts required for assignments to the href property of the latter.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!Location}
|
||||
*/
|
||||
goog.dom.asserts.assertIsLocation = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.Location != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o && (o instanceof win.Location || !(o instanceof win.Element)),
|
||||
'Argument is not a Location (or a non-Element mock); got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!Location} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLAnchorElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not of type Location nor a subtype
|
||||
* of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLAnchorElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLAnchorElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLAnchorElement != 'undefined' &&
|
||||
typeof win.Location != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLAnchorElement ||
|
||||
!((o instanceof win.Location) || (o instanceof win.Element))),
|
||||
'Argument is not a HTMLAnchorElement (or a non-Element mock); ' +
|
||||
'got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLAnchorElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLLinkElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLLinkElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLLinkElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLLinkElement != 'undefined' &&
|
||||
typeof win.Location != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLLinkElement ||
|
||||
!((o instanceof win.Location) || (o instanceof win.Element))),
|
||||
'Argument is not a HTMLLinkElement (or a non-Element mock); got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLLinkElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLImageElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLImageElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLImageElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLImageElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLImageElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLImageElement (or a non-Element mock); got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLImageElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLEmbedElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLEmbedElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLEmbedElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLEmbedElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLEmbedElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLEmbedElement (or a non-Element mock); got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLEmbedElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLFrameElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLFrameElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLFrameElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLFrameElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLFrameElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLFrameElement (or a non-Element mock); got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLFrameElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLIFrameElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLIFrameElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLIFrameElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLIFrameElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLIFrameElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLIFrameElement (or a non-Element mock); ' +
|
||||
'got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLIFrameElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLObjectElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLObjectElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLObjectElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLObjectElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLObjectElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLObjectElement (or a non-Element mock); ' +
|
||||
'got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLObjectElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that a given object is a HTMLScriptElement.
|
||||
*
|
||||
* To permit this assertion to pass in the context of tests where elements might
|
||||
* be mocked, also accepts objects that are not a subtype of Element.
|
||||
*
|
||||
* @param {?Object} o The object whose type to assert.
|
||||
* @return {!HTMLScriptElement}
|
||||
*/
|
||||
goog.dom.asserts.assertIsHTMLScriptElement = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (typeof win.HTMLScriptElement != 'undefined' &&
|
||||
typeof win.Element != 'undefined') {
|
||||
goog.asserts.assert(
|
||||
o &&
|
||||
(o instanceof win.HTMLScriptElement ||
|
||||
!(o instanceof win.Element)),
|
||||
'Argument is not a HTMLScriptElement (or a non-Element mock); ' +
|
||||
'got: %s',
|
||||
goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
return /** @type {!HTMLScriptElement} */ (o);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a string representation of a value's type.
|
||||
*
|
||||
* @param {*} value An object, or primitive.
|
||||
* @return {string} The best display name for the value.
|
||||
* @private
|
||||
*/
|
||||
goog.dom.asserts.debugStringForType_ = function(value) {
|
||||
if (goog.isObject(value)) {
|
||||
return value.constructor.displayName || value.constructor.name ||
|
||||
Object.prototype.toString.call(value);
|
||||
} else {
|
||||
return value === undefined ? 'undefined' :
|
||||
value === null ? 'null' : typeof value;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets window of element.
|
||||
* @param {?Object} o
|
||||
* @return {!Window}
|
||||
* @private
|
||||
*/
|
||||
goog.dom.asserts.getWindow_ = function(o) {
|
||||
var doc = o && o.ownerDocument;
|
||||
var win = doc && /** @type {?Window} */ (doc.defaultView || doc.parentWindow);
|
||||
return win || /** @type {!Window} */ (goog.global);
|
||||
};
|
@ -170,6 +170,24 @@ goog.dom.getRequiredElementHelper_ = function(doc, id) {
|
||||
goog.dom.$ = goog.dom.getElement;
|
||||
|
||||
|
||||
/**
|
||||
* Gets elements by tag name.
|
||||
* @param {!goog.dom.TagName<T>} tagName
|
||||
* @param {(!Document|!Element)=} opt_parent Parent element or document where to
|
||||
* look for elements. Defaults to document.
|
||||
* @return {!NodeList<R>} List of elements. The members of the list are
|
||||
* {!Element} if tagName is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.getElementsByTagName = function(tagName, opt_parent) {
|
||||
var parent = opt_parent || document;
|
||||
return parent.getElementsByTagName(String(tagName));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Looks up elements by both tag and class name, using browser native functions
|
||||
* ({@code querySelectorAll}, {@code getElementsByTagName} or
|
||||
@ -189,11 +207,16 @@ goog.dom.$ = goog.dom.getElement;
|
||||
*
|
||||
* @see {goog.dom.query}
|
||||
*
|
||||
* @param {?string=} opt_tag Element tag name.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {!IArrayLike<!Element>} Array-like list of elements (only a length
|
||||
* property and numerical indices are guaranteed to exist).
|
||||
* @return {!IArrayLike<R>} Array-like list of elements (only a length property
|
||||
* and numerical indices are guaranteed to exist). The members of the array
|
||||
* are {!Element} if opt_tag is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {
|
||||
return goog.dom.getElementsByTagNameAndClass_(
|
||||
@ -201,6 +224,24 @@ goog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets the first element matching the tag and the class.
|
||||
*
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {?R} Reference to a DOM node. The return type is {?Element} if
|
||||
* tagName is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.getElementByTagNameAndClass = function(opt_tag, opt_class, opt_el) {
|
||||
return goog.dom.getElementByTagNameAndClass_(
|
||||
document, opt_tag, opt_class, opt_el);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a static, array-like list of the elements with the provided
|
||||
* className.
|
||||
@ -231,11 +272,9 @@ goog.dom.getElementByClass = function(className, opt_el) {
|
||||
var retVal = null;
|
||||
if (parent.getElementsByClassName) {
|
||||
retVal = parent.getElementsByClassName(className)[0];
|
||||
} else if (goog.dom.canUseQuerySelector_(parent)) {
|
||||
retVal = parent.querySelector('.' + className);
|
||||
} else {
|
||||
retVal = goog.dom.getElementsByTagNameAndClass_(
|
||||
document, '*', className, opt_el)[0];
|
||||
retVal =
|
||||
goog.dom.getElementByTagNameAndClass_(document, '*', className, opt_el);
|
||||
}
|
||||
return retVal || null;
|
||||
};
|
||||
@ -273,17 +312,23 @@ goog.dom.canUseQuerySelector_ = function(parent) {
|
||||
/**
|
||||
* Helper for {@code getElementsByTagNameAndClass}.
|
||||
* @param {!Document} doc The document to get the elements in.
|
||||
* @param {?string=} opt_tag Element tag name.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {!IArrayLike<!Element>} Array-like list of elements (only a length
|
||||
* property and numerical indices are guaranteed to exist).
|
||||
* @return {!IArrayLike<R>} Array-like list of elements (only a length property
|
||||
* and numerical indices are guaranteed to exist). The members of the array
|
||||
* are {!Element} if opt_tag is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @private
|
||||
*/
|
||||
goog.dom.getElementsByTagNameAndClass_ = function(
|
||||
doc, opt_tag, opt_class, opt_el) {
|
||||
var parent = opt_el || doc;
|
||||
var tagName = (opt_tag && opt_tag != '*') ? opt_tag.toUpperCase() : '';
|
||||
var tagName =
|
||||
(opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';
|
||||
|
||||
if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) {
|
||||
var query = tagName + (opt_class ? '.' + opt_class : '');
|
||||
@ -335,25 +380,81 @@ goog.dom.getElementsByTagNameAndClass_ = function(
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Helper for goog.dom.getElementByTagNameAndClass.
|
||||
*
|
||||
* @param {!Document} doc The document to get the elements in.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {?R} Reference to a DOM node. The return type is {?Element} if
|
||||
* tagName is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @private
|
||||
*/
|
||||
goog.dom.getElementByTagNameAndClass_ = function(
|
||||
doc, opt_tag, opt_class, opt_el) {
|
||||
var parent = opt_el || doc;
|
||||
var tag = (opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';
|
||||
if (goog.dom.canUseQuerySelector_(parent) && (tag || opt_class)) {
|
||||
return parent.querySelector(tag + (opt_class ? '.' + opt_class : ''));
|
||||
}
|
||||
var elements =
|
||||
goog.dom.getElementsByTagNameAndClass_(doc, opt_tag, opt_class, opt_el);
|
||||
return elements[0] || null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Alias for {@code getElementsByTagNameAndClass}.
|
||||
* @param {?string=} opt_tag Element tag name.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {Element=} opt_el Optional element to look in.
|
||||
* @return {!IArrayLike<!Element>} Array-like list of elements (only a length
|
||||
* property and numerical indices are guaranteed to exist).
|
||||
* @return {!IArrayLike<R>} Array-like list of elements (only a length property
|
||||
* and numerical indices are guaranteed to exist). The members of the array
|
||||
* are {!Element} if opt_tag is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @deprecated Use {@link goog.dom.getElementsByTagNameAndClass} instead.
|
||||
*/
|
||||
goog.dom.$$ = goog.dom.getElementsByTagNameAndClass;
|
||||
|
||||
|
||||
/**
|
||||
* Sets multiple properties on a node.
|
||||
* Sets multiple properties, and sometimes attributes, on an element. Note that
|
||||
* properties are simply object properties on the element instance, while
|
||||
* attributes are visible in the DOM. Many properties map to attributes with the
|
||||
* same names, some with different names, and there are also unmappable cases.
|
||||
*
|
||||
* This method sets properties by default (which means that custom attributes
|
||||
* are not supported). These are the exeptions (some of which is legacy):
|
||||
* - "style": Even though this is an attribute name, it is translated to a
|
||||
* property, "style.cssText". Note that this property sanitizes and formats
|
||||
* its value, unlike the attribute.
|
||||
* - "class": This is an attribute name, it is translated to the "className"
|
||||
* property.
|
||||
* - "for": This is an attribute name, it is translated to the "htmlFor"
|
||||
* property.
|
||||
* - Entries in {@see goog.dom.DIRECT_ATTRIBUTE_MAP_} are set as attributes,
|
||||
* this is probably due to browser quirks.
|
||||
* - "aria-*", "data-*": Always set as attributes, they have no property
|
||||
* counterparts.
|
||||
*
|
||||
* @param {Element} element DOM node to set properties on.
|
||||
* @param {Object} properties Hash of property:value pairs.
|
||||
* Property values can be strings or goog.string.TypedString values (such as
|
||||
* goog.html.SafeUrl).
|
||||
*/
|
||||
goog.dom.setProperties = function(element, properties) {
|
||||
goog.object.forEach(properties, function(val, key) {
|
||||
if (val && val.implementsGoogStringTypedString) {
|
||||
val = val.getTypedStringValue();
|
||||
}
|
||||
if (key == 'style') {
|
||||
element.style.cssText = val;
|
||||
} else if (key == 'class') {
|
||||
@ -674,7 +775,7 @@ goog.dom.getWindow = function(opt_doc) {
|
||||
* @private
|
||||
*/
|
||||
goog.dom.getWindow_ = function(doc) {
|
||||
return doc.parentWindow || doc.defaultView;
|
||||
return /** @type {!Window} */ (doc.parentWindow || doc.defaultView);
|
||||
};
|
||||
|
||||
|
||||
@ -684,18 +785,26 @@ goog.dom.getWindow_ = function(doc) {
|
||||
* first node as childNodes.
|
||||
*
|
||||
* So:
|
||||
* <code>createDom('div', null, createDom('p'), createDom('p'));</code>
|
||||
* would return a div with two child paragraphs
|
||||
* <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),
|
||||
* createDom(goog.dom.TagName.P));</code> would return a div with two child
|
||||
* paragraphs
|
||||
*
|
||||
* @param {string} tagName Tag to create.
|
||||
* @param {(Object|Array<string>|string)=} opt_attributes If object, then a map
|
||||
* For passing properties, please see {@link goog.dom.setProperties} for more
|
||||
* information.
|
||||
*
|
||||
* @param {string|!goog.dom.TagName<T>} tagName Tag to create.
|
||||
* @param {?Object|?Array<string>|string=} opt_attributes If object, then a map
|
||||
* of name-value pairs for attributes. If a string, then this is the
|
||||
* className of the new element. If an array, the elements will be joined
|
||||
* together as the className of the new element.
|
||||
* @param {...(Object|string|Array|NodeList)} var_args Further DOM nodes or
|
||||
* strings for text nodes. If one of the var_args is an array or NodeList,
|
||||
* its elements will be added as childNodes instead.
|
||||
* @return {!Element} Reference to a DOM node.
|
||||
* @return {R} Reference to a DOM node. The return type is {!Element} if tagName
|
||||
* is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.createDom = function(tagName, opt_attributes, var_args) {
|
||||
return goog.dom.createDom_(document, arguments);
|
||||
@ -711,7 +820,7 @@ goog.dom.createDom = function(tagName, opt_attributes, var_args) {
|
||||
* @private
|
||||
*/
|
||||
goog.dom.createDom_ = function(doc, args) {
|
||||
var tagName = args[0];
|
||||
var tagName = String(args[0]);
|
||||
var attributes = args[1];
|
||||
|
||||
// Internet Explorer is dumb:
|
||||
@ -797,14 +906,19 @@ goog.dom.append_ = function(doc, parent, args, startIndex) {
|
||||
|
||||
/**
|
||||
* Alias for {@code createDom}.
|
||||
* @param {string} tagName Tag to create.
|
||||
* @param {(string|Object)=} opt_attributes If object, then a map of name-value
|
||||
* pairs for attributes. If a string, then this is the className of the new
|
||||
* element.
|
||||
* @param {string|!goog.dom.TagName<T>} tagName Tag to create.
|
||||
* @param {?Object|?Array<string>|string=} opt_attributes If object, then a map
|
||||
* of name-value pairs for attributes. If a string, then this is the
|
||||
* className of the new element. If an array, the elements will be joined
|
||||
* together as the className of the new element.
|
||||
* @param {...(Object|string|Array|NodeList)} var_args Further DOM nodes or
|
||||
* strings for text nodes. If one of the var_args is an array, its
|
||||
* children will be added as childNodes instead.
|
||||
* @return {!Element} Reference to a DOM node.
|
||||
* @return {R} Reference to a DOM node. The return type is {!Element} if tagName
|
||||
* is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @deprecated Use {@link goog.dom.createDom} instead.
|
||||
*/
|
||||
goog.dom.$dom = goog.dom.createDom;
|
||||
@ -812,11 +926,31 @@ goog.dom.$dom = goog.dom.createDom;
|
||||
|
||||
/**
|
||||
* Creates a new element.
|
||||
* @param {string} name Tag name.
|
||||
* @return {!Element} The new element.
|
||||
* @param {string|!goog.dom.TagName<T>} name Tag to create.
|
||||
* @return {R} The new element. The return type is {!Element} if name is
|
||||
* a string or a more specific type if it is a member of goog.dom.TagName
|
||||
* (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.createElement = function(name) {
|
||||
return document.createElement(name);
|
||||
return goog.dom.createElement_(document, name);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new element.
|
||||
* @param {!Document} doc The document to create the element in.
|
||||
* @param {string|!goog.dom.TagName<T>} name Tag to create.
|
||||
* @return {R} The new element. The return type is {!Element} if name is
|
||||
* a string or a more specific type if it is a member of goog.dom.TagName
|
||||
* (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @private
|
||||
*/
|
||||
goog.dom.createElement_ = function(doc, name) {
|
||||
return doc.createElement(String(name));
|
||||
};
|
||||
|
||||
|
||||
@ -839,7 +973,7 @@ goog.dom.createTextNode = function(content) {
|
||||
* @return {!Element} The created table.
|
||||
*/
|
||||
goog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {
|
||||
// TODO(user): Return HTMLTableElement, also in prototype function.
|
||||
// TODO(mlourenco): Return HTMLTableElement, also in prototype function.
|
||||
// Callers need to be updated to e.g. not assign numbers to table.cellSpacing.
|
||||
return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp);
|
||||
};
|
||||
@ -856,13 +990,13 @@ goog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {
|
||||
* @private
|
||||
*/
|
||||
goog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) {
|
||||
var table = /** @type {!HTMLTableElement} */
|
||||
(doc.createElement(goog.dom.TagName.TABLE));
|
||||
var tbody = table.appendChild(doc.createElement(goog.dom.TagName.TBODY));
|
||||
var table = goog.dom.createElement_(doc, goog.dom.TagName.TABLE);
|
||||
var tbody =
|
||||
table.appendChild(goog.dom.createElement_(doc, goog.dom.TagName.TBODY));
|
||||
for (var i = 0; i < rows; i++) {
|
||||
var tr = doc.createElement(goog.dom.TagName.TR);
|
||||
var tr = goog.dom.createElement_(doc, goog.dom.TagName.TR);
|
||||
for (var j = 0; j < columns; j++) {
|
||||
var td = doc.createElement(goog.dom.TagName.TD);
|
||||
var td = goog.dom.createElement_(doc, goog.dom.TagName.TD);
|
||||
// IE <= 9 will create a text node if we set text content to the empty
|
||||
// string, so we avoid doing it unless necessary. This ensures that the
|
||||
// same DOM tree is returned on all browsers.
|
||||
@ -916,7 +1050,7 @@ goog.dom.safeHtmlToNode = function(html) {
|
||||
* @private
|
||||
*/
|
||||
goog.dom.safeHtmlToNode_ = function(doc, html) {
|
||||
var tempDiv = doc.createElement(goog.dom.TagName.DIV);
|
||||
var tempDiv = goog.dom.createElement_(doc, goog.dom.TagName.DIV);
|
||||
if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) {
|
||||
goog.dom.safe.setInnerHtml(
|
||||
tempDiv, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, html));
|
||||
@ -986,7 +1120,7 @@ goog.dom.isCss1CompatMode_ = function(doc) {
|
||||
* the behavior is inconsistent:
|
||||
*
|
||||
* <pre>
|
||||
* var a = document.createElement(goog.dom.TagName.BR);
|
||||
* var a = goog.dom.createElement(goog.dom.TagName.BR);
|
||||
* a.appendChild(document.createTextNode('foo'));
|
||||
* a.appendChild(document.createTextNode('bar'));
|
||||
* console.log(a.childNodes.length); // 2
|
||||
@ -1006,31 +1140,31 @@ goog.dom.canHaveChildren = function(node) {
|
||||
return false;
|
||||
}
|
||||
switch (/** @type {!Element} */ (node).tagName) {
|
||||
case goog.dom.TagName.APPLET:
|
||||
case goog.dom.TagName.AREA:
|
||||
case goog.dom.TagName.BASE:
|
||||
case goog.dom.TagName.BR:
|
||||
case goog.dom.TagName.COL:
|
||||
case goog.dom.TagName.COMMAND:
|
||||
case goog.dom.TagName.EMBED:
|
||||
case goog.dom.TagName.FRAME:
|
||||
case goog.dom.TagName.HR:
|
||||
case goog.dom.TagName.IMG:
|
||||
case goog.dom.TagName.INPUT:
|
||||
case goog.dom.TagName.IFRAME:
|
||||
case goog.dom.TagName.ISINDEX:
|
||||
case goog.dom.TagName.KEYGEN:
|
||||
case goog.dom.TagName.LINK:
|
||||
case goog.dom.TagName.NOFRAMES:
|
||||
case goog.dom.TagName.NOSCRIPT:
|
||||
case goog.dom.TagName.META:
|
||||
case goog.dom.TagName.OBJECT:
|
||||
case goog.dom.TagName.PARAM:
|
||||
case goog.dom.TagName.SCRIPT:
|
||||
case goog.dom.TagName.SOURCE:
|
||||
case goog.dom.TagName.STYLE:
|
||||
case goog.dom.TagName.TRACK:
|
||||
case goog.dom.TagName.WBR:
|
||||
case String(goog.dom.TagName.APPLET):
|
||||
case String(goog.dom.TagName.AREA):
|
||||
case String(goog.dom.TagName.BASE):
|
||||
case String(goog.dom.TagName.BR):
|
||||
case String(goog.dom.TagName.COL):
|
||||
case String(goog.dom.TagName.COMMAND):
|
||||
case String(goog.dom.TagName.EMBED):
|
||||
case String(goog.dom.TagName.FRAME):
|
||||
case String(goog.dom.TagName.HR):
|
||||
case String(goog.dom.TagName.IMG):
|
||||
case String(goog.dom.TagName.INPUT):
|
||||
case String(goog.dom.TagName.IFRAME):
|
||||
case String(goog.dom.TagName.ISINDEX):
|
||||
case String(goog.dom.TagName.KEYGEN):
|
||||
case String(goog.dom.TagName.LINK):
|
||||
case String(goog.dom.TagName.NOFRAMES):
|
||||
case String(goog.dom.TagName.NOSCRIPT):
|
||||
case String(goog.dom.TagName.META):
|
||||
case String(goog.dom.TagName.OBJECT):
|
||||
case String(goog.dom.TagName.PARAM):
|
||||
case String(goog.dom.TagName.SCRIPT):
|
||||
case String(goog.dom.TagName.SOURCE):
|
||||
case String(goog.dom.TagName.STYLE):
|
||||
case String(goog.dom.TagName.TRACK):
|
||||
case String(goog.dom.TagName.WBR):
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1363,8 +1497,8 @@ goog.dom.getParentElement = function(element) {
|
||||
|
||||
/**
|
||||
* Whether a node contains another node.
|
||||
* @param {?Node} parent The node that should contain the other node.
|
||||
* @param {?Node} descendant The node to test presence of.
|
||||
* @param {?Node|undefined} parent The node that should contain the other node.
|
||||
* @param {?Node|undefined} descendant The node to test presence of.
|
||||
* @return {boolean} Whether the parent node contains the descendent node.
|
||||
*/
|
||||
goog.dom.contains = function(parent, descendant) {
|
||||
@ -1623,7 +1757,7 @@ goog.dom.setTextContent = function(node, text) {
|
||||
if ('textContent' in node) {
|
||||
node.textContent = text;
|
||||
} else if (node.nodeType == goog.dom.NodeType.TEXT) {
|
||||
node.data = text;
|
||||
/** @type {!Text} */ (node).data = String(text);
|
||||
} else if (
|
||||
node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) {
|
||||
// If the first child is a text node we just change its data and remove the
|
||||
@ -1631,7 +1765,7 @@ goog.dom.setTextContent = function(node, text) {
|
||||
while (node.lastChild != node.firstChild) {
|
||||
node.removeChild(node.lastChild);
|
||||
}
|
||||
node.firstChild.data = text;
|
||||
/** @type {!Text} */ (node.firstChild).data = String(text);
|
||||
} else {
|
||||
goog.dom.removeChildren(node);
|
||||
var doc = goog.dom.getOwnerDocument(node);
|
||||
@ -1655,7 +1789,7 @@ goog.dom.getOuterHtml = function(element) {
|
||||
return element.outerHTML;
|
||||
} else {
|
||||
var doc = goog.dom.getOwnerDocument(element);
|
||||
var div = doc.createElement(goog.dom.TagName.DIV);
|
||||
var div = goog.dom.createElement_(doc, goog.dom.TagName.DIV);
|
||||
div.appendChild(element.cloneNode(true));
|
||||
return div.innerHTML;
|
||||
}
|
||||
@ -1828,11 +1962,14 @@ goog.dom.isFocusable = function(element) {
|
||||
* @private
|
||||
*/
|
||||
goog.dom.hasSpecifiedTabIndex_ = function(element) {
|
||||
// IE returns 0 for an unset tabIndex, so we must use getAttributeNode(),
|
||||
// which returns an object with a 'specified' property if tabIndex is
|
||||
// specified. This works on other browsers, too.
|
||||
var attrNode = element.getAttributeNode('tabindex'); // Must be lowercase!
|
||||
return goog.isDefAndNotNull(attrNode) && attrNode.specified;
|
||||
// IE8 and below don't support hasAttribute(), instead check whether the
|
||||
// 'tabindex' attributeNode is specified. Otherwise check hasAttribute().
|
||||
if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')) {
|
||||
var attrNode = element.getAttributeNode('tabindex'); // Must be lowercase!
|
||||
return goog.isDefAndNotNull(attrNode) && attrNode.specified;
|
||||
} else {
|
||||
return element.hasAttribute('tabindex');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -2085,21 +2222,25 @@ goog.dom.isNodeList = function(val) {
|
||||
* tag name and/or class name. If the passed element matches the specified
|
||||
* criteria, the element itself is returned.
|
||||
* @param {Node} element The DOM node to start with.
|
||||
* @param {?(goog.dom.TagName|string)=} opt_tag The tag name to match (or
|
||||
* @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or
|
||||
* null/undefined to match only based on class name).
|
||||
* @param {?string=} opt_class The class name to match (or null/undefined to
|
||||
* match only based on tag name).
|
||||
* @param {number=} opt_maxSearchSteps Maximum number of levels to search up the
|
||||
* dom.
|
||||
* @return {Element} The first ancestor that matches the passed criteria, or
|
||||
* null if no match is found.
|
||||
* @return {?R} The first ancestor that matches the passed criteria, or
|
||||
* null if no match is found. The return type is {?Element} if opt_tag is
|
||||
* not a member of goog.dom.TagName or a more specific type if it is (e.g.
|
||||
* {?HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.getAncestorByTagNameAndClass = function(
|
||||
element, opt_tag, opt_class, opt_maxSearchSteps) {
|
||||
if (!opt_tag && !opt_class) {
|
||||
return null;
|
||||
}
|
||||
var tagName = opt_tag ? opt_tag.toUpperCase() : null;
|
||||
var tagName = opt_tag ? String(opt_tag).toUpperCase() : null;
|
||||
return /** @type {Element} */ (goog.dom.getAncestor(element, function(node) {
|
||||
return (!tagName || node.nodeName == tagName) &&
|
||||
(!opt_class ||
|
||||
@ -2142,7 +2283,7 @@ goog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) {
|
||||
*/
|
||||
goog.dom.getAncestor = function(
|
||||
element, matcher, opt_includeNode, opt_maxSearchSteps) {
|
||||
if (!opt_includeNode) {
|
||||
if (element && !opt_includeNode) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
var steps = 0;
|
||||
@ -2201,9 +2342,11 @@ goog.dom.getPixelRatio = function() {
|
||||
if (goog.isDef(win.devicePixelRatio)) {
|
||||
return win.devicePixelRatio;
|
||||
} else if (win.matchMedia) {
|
||||
return goog.dom.matchesPixelRatio_(.75) ||
|
||||
goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(2) ||
|
||||
goog.dom.matchesPixelRatio_(3) || 1;
|
||||
// Should be for IE10 and FF6-17 (this basically clamps to lower)
|
||||
// Note that the order of these statements is important
|
||||
return goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) ||
|
||||
goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) ||
|
||||
.75;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
@ -2218,14 +2361,35 @@ goog.dom.getPixelRatio = function() {
|
||||
*/
|
||||
goog.dom.matchesPixelRatio_ = function(pixelRatio) {
|
||||
var win = goog.dom.getWindow();
|
||||
/**
|
||||
* Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to
|
||||
* 96dpi.
|
||||
* @const {number}
|
||||
*/
|
||||
var dpiPerDppx = 96;
|
||||
var query =
|
||||
('(-webkit-min-device-pixel-ratio: ' + pixelRatio + '),' +
|
||||
'(min--moz-device-pixel-ratio: ' + pixelRatio + '),' +
|
||||
'(min-resolution: ' + pixelRatio + 'dppx)');
|
||||
// FF16-17
|
||||
'(min-resolution: ' + pixelRatio + 'dppx),' +
|
||||
// FF6-15
|
||||
'(min--moz-device-pixel-ratio: ' + pixelRatio + '),' +
|
||||
// IE10 (this works for the two browsers above too but I don't want to
|
||||
// trust the 1:96 fixed ratio magic)
|
||||
'(min-resolution: ' + (pixelRatio * dpiPerDppx) + 'dpi)';
|
||||
return win.matchMedia(query).matches ? pixelRatio : 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a
|
||||
* type information.
|
||||
* @param {!HTMLCanvasElement} canvas
|
||||
* @return {!CanvasRenderingContext2D}
|
||||
*/
|
||||
goog.dom.getCanvasContext2D = function(canvas) {
|
||||
return /** @type {!CanvasRenderingContext2D} */ (canvas.getContext('2d'));
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create an instance of a DOM helper with a new document object.
|
||||
@ -2303,6 +2467,25 @@ goog.dom.DomHelper.prototype.getRequiredElement = function(id) {
|
||||
goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;
|
||||
|
||||
|
||||
/**
|
||||
* Gets elements by tag name.
|
||||
* @param {!goog.dom.TagName<T>} tagName
|
||||
* @param {(!Document|!Element)=} opt_parent Parent element or document where to
|
||||
* look for elements. Defaults to document of this DomHelper.
|
||||
* @return {!NodeList<R>} List of elements. The members of the list are
|
||||
* {!Element} if tagName is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getElementsByTagName =
|
||||
function(tagName, opt_parent) {
|
||||
var parent = opt_parent || this.document_;
|
||||
return parent.getElementsByTagName(String(tagName));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Looks up elements by both tag and class name, using browser native functions
|
||||
* ({@code querySelectorAll}, {@code getElementsByTagName} or
|
||||
@ -2311,11 +2494,17 @@ goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;
|
||||
*
|
||||
* @see goog.dom.query
|
||||
*
|
||||
* @param {?string=} opt_tag Element tag name or * for all tags.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name or * for all
|
||||
* tags.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {!IArrayLike<!Element>} Array-like list of elements (only a length
|
||||
* property and numerical indices are guaranteed to exist).
|
||||
* @return {!IArrayLike<R>} Array-like list of elements (only a length property
|
||||
* and numerical indices are guaranteed to exist). The members of the array
|
||||
* are {!Element} if opt_tag is not a member of goog.dom.TagName or more
|
||||
* specific types if it is (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(
|
||||
opt_tag, opt_class, opt_el) {
|
||||
@ -2324,6 +2513,25 @@ goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets the first element matching the tag and the class.
|
||||
*
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {(Document|Element)=} opt_el Optional element to look in.
|
||||
* @return {?R} Reference to a DOM node. The return type is {?Element} if
|
||||
* tagName is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getElementByTagNameAndClass = function(
|
||||
opt_tag, opt_class, opt_el) {
|
||||
return goog.dom.getElementByTagNameAndClass_(
|
||||
this.document_, opt_tag, opt_class, opt_el);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of all the elements with the provided className.
|
||||
* @see {goog.dom.query}
|
||||
@ -2372,11 +2580,16 @@ goog.dom.DomHelper.prototype.getRequiredElementByClass = function(
|
||||
* @deprecated Use DomHelper getElementsByTagNameAndClass.
|
||||
* @see goog.dom.query
|
||||
*
|
||||
* @param {?string=} opt_tag Element tag name.
|
||||
* @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.
|
||||
* @param {?string=} opt_class Optional class name.
|
||||
* @param {Element=} opt_el Optional element to look in.
|
||||
* @return {!IArrayLike<!Element>} Array-like list of elements (only a length
|
||||
* property and numerical indices are guaranteed to exist).
|
||||
* @return {!IArrayLike<R>} Array-like list of elements (only a length property
|
||||
* and numerical indices are guaranteed to exist). The members of the array
|
||||
* are {!Element} if opt_tag is a string or more specific types if it is
|
||||
* a member of goog.dom.TagName (e.g. {!HTMLAnchorElement} for
|
||||
* goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.$$ =
|
||||
goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;
|
||||
@ -2426,23 +2639,29 @@ goog.dom.Appendable;
|
||||
* first node as childNodes.
|
||||
*
|
||||
* So:
|
||||
* <code>createDom('div', null, createDom('p'), createDom('p'));</code>
|
||||
* would return a div with two child paragraphs
|
||||
* <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),
|
||||
* createDom(goog.dom.TagName.P));</code> would return a div with two child
|
||||
* paragraphs
|
||||
*
|
||||
* An easy way to move all child nodes of an existing element to a new parent
|
||||
* element is:
|
||||
* <code>createDom('div', null, oldElement.childNodes);</code>
|
||||
* <code>createDom(goog.dom.TagName.DIV, null, oldElement.childNodes);</code>
|
||||
* which will remove all child nodes from the old element and add them as
|
||||
* child nodes of the new DIV.
|
||||
*
|
||||
* @param {string} tagName Tag to create.
|
||||
* @param {Object|string=} opt_attributes If object, then a map of name-value
|
||||
* pairs for attributes. If a string, then this is the className of the new
|
||||
* element.
|
||||
* @param {string|!goog.dom.TagName<T>} tagName Tag to create.
|
||||
* @param {?Object|?Array<string>|string=} opt_attributes If object, then a map
|
||||
* of name-value pairs for attributes. If a string, then this is the
|
||||
* className of the new element. If an array, the elements will be joined
|
||||
* together as the className of the new element.
|
||||
* @param {...goog.dom.Appendable} var_args Further DOM nodes or
|
||||
* strings for text nodes. If one of the var_args is an array or
|
||||
* NodeList, its elements will be added as childNodes instead.
|
||||
* @return {!Element} Reference to a DOM node.
|
||||
* @return {R} Reference to a DOM node. The return type is {!Element} if tagName
|
||||
* is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.createDom = function(
|
||||
tagName, opt_attributes, var_args) {
|
||||
@ -2452,14 +2671,19 @@ goog.dom.DomHelper.prototype.createDom = function(
|
||||
|
||||
/**
|
||||
* Alias for {@code createDom}.
|
||||
* @param {string} tagName Tag to create.
|
||||
* @param {(Object|string)=} opt_attributes If object, then a map of name-value
|
||||
* pairs for attributes. If a string, then this is the className of the new
|
||||
* element.
|
||||
* @param {string|!goog.dom.TagName<T>} tagName Tag to create.
|
||||
* @param {?Object|?Array<string>|string=} opt_attributes If object, then a map
|
||||
* of name-value pairs for attributes. If a string, then this is the
|
||||
* className of the new element. If an array, the elements will be joined
|
||||
* together as the className of the new element.
|
||||
* @param {...goog.dom.Appendable} var_args Further DOM nodes or strings for
|
||||
* text nodes. If one of the var_args is an array, its children will be
|
||||
* added as childNodes instead.
|
||||
* @return {!Element} Reference to a DOM node.
|
||||
* @return {R} Reference to a DOM node. The return type is {!Element} if tagName
|
||||
* is a string or a more specific type if it is a member of
|
||||
* goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
* @deprecated Use {@link goog.dom.DomHelper.prototype.createDom} instead.
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;
|
||||
@ -2467,11 +2691,15 @@ goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;
|
||||
|
||||
/**
|
||||
* Creates a new element.
|
||||
* @param {string} name Tag name.
|
||||
* @return {!Element} The new element.
|
||||
* @param {string|!goog.dom.TagName<T>} name Tag to create.
|
||||
* @return {R} The new element. The return type is {!Element} if name is
|
||||
* a string or a more specific type if it is a member of goog.dom.TagName
|
||||
* (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.createElement = function(name) {
|
||||
return this.document_.createElement(name);
|
||||
return goog.dom.createElement_(this.document_, name);
|
||||
};
|
||||
|
||||
|
||||
@ -2948,14 +3176,18 @@ goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;
|
||||
* tag name and/or class name. If the passed element matches the specified
|
||||
* criteria, the element itself is returned.
|
||||
* @param {Node} element The DOM node to start with.
|
||||
* @param {?(goog.dom.TagName|string)=} opt_tag The tag name to match (or
|
||||
* @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or
|
||||
* null/undefined to match only based on class name).
|
||||
* @param {?string=} opt_class The class name to match (or null/undefined to
|
||||
* match only based on tag name).
|
||||
* @param {number=} opt_maxSearchSteps Maximum number of levels to search up the
|
||||
* dom.
|
||||
* @return {Element} The first ancestor that matches the passed criteria, or
|
||||
* null if no match is found.
|
||||
* @return {?R} The first ancestor that matches the passed criteria, or
|
||||
* null if no match is found. The return type is {?Element} if opt_tag is
|
||||
* not a member of goog.dom.TagName or a more specific type if it is (e.g.
|
||||
* {?HTMLAnchorElement} for goog.dom.TagName.A).
|
||||
* @template T
|
||||
* @template R := cond(isUnknown(T), 'Element', T) =:
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass =
|
||||
goog.dom.getAncestorByTagNameAndClass;
|
||||
@ -2990,3 +3222,12 @@ goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;
|
||||
* no match.
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;
|
||||
|
||||
|
||||
/**
|
||||
* Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a
|
||||
* type information.
|
||||
* @param {!HTMLCanvasElement} canvas
|
||||
* @return {!CanvasRenderingContext2D}
|
||||
*/
|
||||
goog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;
|
||||
|
29
assets/viz/2/goog/dom/htmlelement.js
Normal file
29
assets/viz/2/goog/dom/htmlelement.js
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2017 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
goog.provide('goog.dom.HtmlElement');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This subclass of HTMLElement is used when only a HTMLElement is possible and
|
||||
* not any of its subclasses. Normally, a type can refer to an instance of
|
||||
* itself or an instance of any subtype. More concretely, if HTMLElement is used
|
||||
* then the compiler must assume that it might still be e.g. HTMLScriptElement.
|
||||
* With this, the type check knows that it couldn't be any special element.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {HTMLElement}
|
||||
*/
|
||||
goog.dom.HtmlElement = function() {};
|
@ -29,19 +29,22 @@
|
||||
*
|
||||
* For example, assigning to an element's .innerHTML property a string that is
|
||||
* derived (even partially) from untrusted input typically results in an XSS
|
||||
* vulnerability. The type-safe wrapper goog.html.setInnerHtml consumes a value
|
||||
* of type goog.html.SafeHtml, whose contract states that using its values in a
|
||||
* HTML context will not result in XSS. Hence a program that is free of direct
|
||||
* assignments to any element's innerHTML property (with the exception of the
|
||||
* assignment to .innerHTML in this file) is guaranteed to be free of XSS due to
|
||||
* assignment of untrusted strings to the innerHTML property.
|
||||
* vulnerability. The type-safe wrapper goog.dom.safe.setInnerHtml consumes a
|
||||
* value of type goog.html.SafeHtml, whose contract states that using its values
|
||||
* in a HTML context will not result in XSS. Hence a program that is free of
|
||||
* direct assignments to any element's innerHTML property (with the exception of
|
||||
* the assignment to .innerHTML in this file) is guaranteed to be free of XSS
|
||||
* due to assignment of untrusted strings to the innerHTML property.
|
||||
*/
|
||||
|
||||
goog.provide('goog.dom.safe');
|
||||
goog.provide('goog.dom.safe.InsertAdjacentHtmlPosition');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.asserts');
|
||||
goog.require('goog.html.SafeHtml');
|
||||
goog.require('goog.html.SafeScript');
|
||||
goog.require('goog.html.SafeStyle');
|
||||
goog.require('goog.html.SafeUrl');
|
||||
goog.require('goog.html.TrustedResourceUrl');
|
||||
goog.require('goog.string');
|
||||
@ -69,12 +72,35 @@ goog.dom.safe.insertAdjacentHtml = function(node, position, html) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tags not allowed in goog.dom.safe.setInnerHtml.
|
||||
* @private @const {!Object<string, boolean>}
|
||||
*/
|
||||
goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = {
|
||||
'MATH': true,
|
||||
'SCRIPT': true,
|
||||
'STYLE': true,
|
||||
'SVG': true,
|
||||
'TEMPLATE': true
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Assigns known-safe HTML to an element's innerHTML property.
|
||||
* @param {!Element} elem The element whose innerHTML is to be assigned to.
|
||||
* @param {!goog.html.SafeHtml} html The known-safe HTML to assign.
|
||||
* @throws {Error} If called with one of these tags: math, script, style, svg,
|
||||
* template.
|
||||
*/
|
||||
goog.dom.safe.setInnerHtml = function(elem, html) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var tagName = elem.tagName.toUpperCase();
|
||||
if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[tagName]) {
|
||||
throw Error(
|
||||
'goog.dom.safe.setInnerHtml cannot be used to set content of ' +
|
||||
elem.tagName + '.');
|
||||
}
|
||||
}
|
||||
elem.innerHTML = goog.html.SafeHtml.unwrap(html);
|
||||
};
|
||||
|
||||
@ -89,6 +115,17 @@ goog.dom.safe.setOuterHtml = function(elem, html) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Sets the given element's style property to the contents of the provided
|
||||
* SafeStyle object.
|
||||
* @param {!Element} elem
|
||||
* @param {!goog.html.SafeStyle} style
|
||||
*/
|
||||
goog.dom.safe.setStyle = function(elem, style) {
|
||||
elem.style.cssText = goog.html.SafeStyle.unwrap(style);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Writes known-safe HTML to a document.
|
||||
* @param {!Document} doc The document to be written to.
|
||||
@ -119,12 +156,13 @@ goog.dom.safe.documentWrite = function(doc, html) {
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setAnchorHref = function(anchor, url) {
|
||||
goog.dom.asserts.assertIsHTMLAnchorElement(anchor);
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
|
||||
}
|
||||
anchor.href = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
@ -143,12 +181,13 @@ goog.dom.safe.setAnchorHref = function(anchor, url) {
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setImageSrc = function(imageElement, url) {
|
||||
goog.dom.asserts.assertIsHTMLImageElement(imageElement);
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
|
||||
}
|
||||
imageElement.src = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
@ -169,6 +208,7 @@ goog.dom.safe.setImageSrc = function(imageElement, url) {
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setEmbedSrc = function(embed, url) {
|
||||
goog.dom.asserts.assertIsHTMLEmbedElement(embed);
|
||||
embed.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
@ -188,6 +228,7 @@ goog.dom.safe.setEmbedSrc = function(embed, url) {
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setFrameSrc = function(frame, url) {
|
||||
goog.dom.asserts.assertIsHTMLFrameElement(frame);
|
||||
frame.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
@ -207,10 +248,30 @@ goog.dom.safe.setFrameSrc = function(frame, url) {
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setIframeSrc = function(iframe, url) {
|
||||
goog.dom.asserts.assertIsHTMLIFrameElement(iframe);
|
||||
iframe.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns HTML to an iframe element's srcdoc property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setIframeSrcdoc(iframeEl, safeHtml);
|
||||
* which is a safe alternative to
|
||||
* iframeEl.srcdoc = html;
|
||||
* The latter can result in loading untrusted code.
|
||||
*
|
||||
* @param {!HTMLIFrameElement} iframe The iframe element whose srcdoc property
|
||||
* is to be assigned to.
|
||||
* @param {!goog.html.SafeHtml} html The HTML to assign.
|
||||
*/
|
||||
goog.dom.safe.setIframeSrcdoc = function(iframe, html) {
|
||||
goog.dom.asserts.assertIsHTMLIFrameElement(iframe);
|
||||
iframe.srcdoc = goog.html.SafeHtml.unwrap(html);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely sets a link element's href and rel properties. Whether or not
|
||||
* the URL assigned to href has to be a goog.html.TrustedResourceUrl
|
||||
@ -237,6 +298,7 @@ goog.dom.safe.setIframeSrc = function(iframe, url) {
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
|
||||
goog.dom.asserts.assertIsHTMLLinkElement(link);
|
||||
link.rel = rel;
|
||||
if (goog.string.caseInsensitiveContains(rel, 'stylesheet')) {
|
||||
goog.asserts.assert(
|
||||
@ -249,7 +311,8 @@ goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
|
||||
link.href = goog.html.SafeUrl.unwrap(url);
|
||||
} else { // string
|
||||
// SafeUrl.sanitize must return legitimate SafeUrl when passed a string.
|
||||
link.href = goog.html.SafeUrl.sanitize(url).getTypedStringValue();
|
||||
link.href =
|
||||
goog.html.SafeUrl.sanitizeAssertUnchanged(url).getTypedStringValue();
|
||||
}
|
||||
};
|
||||
|
||||
@ -269,12 +332,13 @@ goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setObjectData = function(object, url) {
|
||||
goog.dom.asserts.assertIsHTMLObjectElement(object);
|
||||
object.data = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to an iframe element's src property.
|
||||
* Safely assigns a URL to a script element's src property.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setScriptSrc(scriptEl, url);
|
||||
@ -288,10 +352,31 @@ goog.dom.safe.setObjectData = function(object, url) {
|
||||
* @param {!goog.html.TrustedResourceUrl} url The URL to assign.
|
||||
*/
|
||||
goog.dom.safe.setScriptSrc = function(script, url) {
|
||||
goog.dom.asserts.assertIsHTMLScriptElement(script);
|
||||
script.src = goog.html.TrustedResourceUrl.unwrap(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a value to a script element's content.
|
||||
*
|
||||
* Example usage:
|
||||
* goog.dom.safe.setScriptContent(scriptEl, content);
|
||||
* which is a safe alternative to
|
||||
* scriptEl.text = content;
|
||||
* The latter can result in executing untrusted code unless it is ensured that
|
||||
* the code is loaded from a trustworthy resource.
|
||||
*
|
||||
* @param {!HTMLScriptElement} script The script element whose content is being
|
||||
* set.
|
||||
* @param {!goog.html.SafeScript} content The content to assign.
|
||||
*/
|
||||
goog.dom.safe.setScriptContent = function(script, content) {
|
||||
goog.dom.asserts.assertIsHTMLScriptElement(script);
|
||||
script.text = goog.html.SafeScript.unwrap(content);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safely assigns a URL to a Location object's href property.
|
||||
*
|
||||
@ -312,12 +397,13 @@ goog.dom.safe.setScriptSrc = function(script, url) {
|
||||
* @see goog.html.SafeUrl#sanitize
|
||||
*/
|
||||
goog.dom.safe.setLocationHref = function(loc, url) {
|
||||
goog.dom.asserts.assertIsLocation(loc);
|
||||
/** @type {!goog.html.SafeUrl} */
|
||||
var safeUrl;
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
|
||||
}
|
||||
loc.href = goog.html.SafeUrl.unwrap(safeUrl);
|
||||
};
|
||||
@ -358,7 +444,7 @@ goog.dom.safe.openInWindow = function(
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
safeUrl = url;
|
||||
} else {
|
||||
safeUrl = goog.html.SafeUrl.sanitize(url);
|
||||
safeUrl = goog.html.SafeUrl.sanitizeAssertUnchanged(url);
|
||||
}
|
||||
var win = opt_openerWin || window;
|
||||
return win.open(
|
||||
|
@ -13,148 +13,550 @@
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Defines the goog.dom.TagName enum. This enumerates
|
||||
* @fileoverview Defines the goog.dom.TagName class. Its constants enumerate
|
||||
* all HTML tag names specified in either the the W3C HTML 4.01 index of
|
||||
* elements or the HTML5 draft specification.
|
||||
*
|
||||
* References:
|
||||
* http://www.w3.org/TR/html401/index/elements.html
|
||||
* http://dev.w3.org/html5/spec/section-index.html
|
||||
*
|
||||
*/
|
||||
goog.provide('goog.dom.TagName');
|
||||
|
||||
goog.require('goog.dom.HtmlElement');
|
||||
|
||||
|
||||
/**
|
||||
* Enum of all html tag names specified by the W3C HTML4.01 and HTML5
|
||||
* specifications.
|
||||
* @enum {string}
|
||||
* A tag name with the type of the element stored in the generic.
|
||||
* @param {string} tagName
|
||||
* @constructor
|
||||
* @template T
|
||||
*/
|
||||
goog.dom.TagName = {
|
||||
A: 'A',
|
||||
ABBR: 'ABBR',
|
||||
ACRONYM: 'ACRONYM',
|
||||
ADDRESS: 'ADDRESS',
|
||||
APPLET: 'APPLET',
|
||||
AREA: 'AREA',
|
||||
ARTICLE: 'ARTICLE',
|
||||
ASIDE: 'ASIDE',
|
||||
AUDIO: 'AUDIO',
|
||||
B: 'B',
|
||||
BASE: 'BASE',
|
||||
BASEFONT: 'BASEFONT',
|
||||
BDI: 'BDI',
|
||||
BDO: 'BDO',
|
||||
BIG: 'BIG',
|
||||
BLOCKQUOTE: 'BLOCKQUOTE',
|
||||
BODY: 'BODY',
|
||||
BR: 'BR',
|
||||
BUTTON: 'BUTTON',
|
||||
CANVAS: 'CANVAS',
|
||||
CAPTION: 'CAPTION',
|
||||
CENTER: 'CENTER',
|
||||
CITE: 'CITE',
|
||||
CODE: 'CODE',
|
||||
COL: 'COL',
|
||||
COLGROUP: 'COLGROUP',
|
||||
COMMAND: 'COMMAND',
|
||||
DATA: 'DATA',
|
||||
DATALIST: 'DATALIST',
|
||||
DD: 'DD',
|
||||
DEL: 'DEL',
|
||||
DETAILS: 'DETAILS',
|
||||
DFN: 'DFN',
|
||||
DIALOG: 'DIALOG',
|
||||
DIR: 'DIR',
|
||||
DIV: 'DIV',
|
||||
DL: 'DL',
|
||||
DT: 'DT',
|
||||
EM: 'EM',
|
||||
EMBED: 'EMBED',
|
||||
FIELDSET: 'FIELDSET',
|
||||
FIGCAPTION: 'FIGCAPTION',
|
||||
FIGURE: 'FIGURE',
|
||||
FONT: 'FONT',
|
||||
FOOTER: 'FOOTER',
|
||||
FORM: 'FORM',
|
||||
FRAME: 'FRAME',
|
||||
FRAMESET: 'FRAMESET',
|
||||
H1: 'H1',
|
||||
H2: 'H2',
|
||||
H3: 'H3',
|
||||
H4: 'H4',
|
||||
H5: 'H5',
|
||||
H6: 'H6',
|
||||
HEAD: 'HEAD',
|
||||
HEADER: 'HEADER',
|
||||
HGROUP: 'HGROUP',
|
||||
HR: 'HR',
|
||||
HTML: 'HTML',
|
||||
I: 'I',
|
||||
IFRAME: 'IFRAME',
|
||||
IMG: 'IMG',
|
||||
INPUT: 'INPUT',
|
||||
INS: 'INS',
|
||||
ISINDEX: 'ISINDEX',
|
||||
KBD: 'KBD',
|
||||
KEYGEN: 'KEYGEN',
|
||||
LABEL: 'LABEL',
|
||||
LEGEND: 'LEGEND',
|
||||
LI: 'LI',
|
||||
LINK: 'LINK',
|
||||
MAP: 'MAP',
|
||||
MARK: 'MARK',
|
||||
MATH: 'MATH',
|
||||
MENU: 'MENU',
|
||||
META: 'META',
|
||||
METER: 'METER',
|
||||
NAV: 'NAV',
|
||||
NOFRAMES: 'NOFRAMES',
|
||||
NOSCRIPT: 'NOSCRIPT',
|
||||
OBJECT: 'OBJECT',
|
||||
OL: 'OL',
|
||||
OPTGROUP: 'OPTGROUP',
|
||||
OPTION: 'OPTION',
|
||||
OUTPUT: 'OUTPUT',
|
||||
P: 'P',
|
||||
PARAM: 'PARAM',
|
||||
PRE: 'PRE',
|
||||
PROGRESS: 'PROGRESS',
|
||||
Q: 'Q',
|
||||
RP: 'RP',
|
||||
RT: 'RT',
|
||||
RUBY: 'RUBY',
|
||||
S: 'S',
|
||||
SAMP: 'SAMP',
|
||||
SCRIPT: 'SCRIPT',
|
||||
SECTION: 'SECTION',
|
||||
SELECT: 'SELECT',
|
||||
SMALL: 'SMALL',
|
||||
SOURCE: 'SOURCE',
|
||||
SPAN: 'SPAN',
|
||||
STRIKE: 'STRIKE',
|
||||
STRONG: 'STRONG',
|
||||
STYLE: 'STYLE',
|
||||
SUB: 'SUB',
|
||||
SUMMARY: 'SUMMARY',
|
||||
SUP: 'SUP',
|
||||
SVG: 'SVG',
|
||||
TABLE: 'TABLE',
|
||||
TBODY: 'TBODY',
|
||||
TD: 'TD',
|
||||
TEMPLATE: 'TEMPLATE',
|
||||
TEXTAREA: 'TEXTAREA',
|
||||
TFOOT: 'TFOOT',
|
||||
TH: 'TH',
|
||||
THEAD: 'THEAD',
|
||||
TIME: 'TIME',
|
||||
TITLE: 'TITLE',
|
||||
TR: 'TR',
|
||||
TRACK: 'TRACK',
|
||||
TT: 'TT',
|
||||
U: 'U',
|
||||
UL: 'UL',
|
||||
VAR: 'VAR',
|
||||
VIDEO: 'VIDEO',
|
||||
WBR: 'WBR'
|
||||
goog.dom.TagName = function(tagName) {
|
||||
/** @private {string} */
|
||||
this.tagName_ = tagName;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the tag name.
|
||||
* @return {string}
|
||||
* @override
|
||||
*/
|
||||
goog.dom.TagName.prototype.toString = function() {
|
||||
return this.tagName_;
|
||||
};
|
||||
|
||||
|
||||
// Closure Compiler unconditionally converts the following constants to their
|
||||
// string value (goog.dom.TagName.A -> 'A'). These are the consequences:
|
||||
// 1. Don't add any members or static members to goog.dom.TagName as they
|
||||
// couldn't be accessed after this optimization.
|
||||
// 2. Keep the constant name and its string value the same:
|
||||
// goog.dom.TagName.X = new goog.dom.TagName('Y');
|
||||
// is converted to 'X', not 'Y'.
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLAnchorElement>} */
|
||||
goog.dom.TagName.A = new goog.dom.TagName('A');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.ABBR = new goog.dom.TagName('ABBR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.ACRONYM = new goog.dom.TagName('ACRONYM');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.ADDRESS = new goog.dom.TagName('ADDRESS');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLAppletElement>} */
|
||||
goog.dom.TagName.APPLET = new goog.dom.TagName('APPLET');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLAreaElement>} */
|
||||
goog.dom.TagName.AREA = new goog.dom.TagName('AREA');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.ARTICLE = new goog.dom.TagName('ARTICLE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.ASIDE = new goog.dom.TagName('ASIDE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLAudioElement>} */
|
||||
goog.dom.TagName.AUDIO = new goog.dom.TagName('AUDIO');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.B = new goog.dom.TagName('B');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLBaseElement>} */
|
||||
goog.dom.TagName.BASE = new goog.dom.TagName('BASE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLBaseFontElement>} */
|
||||
goog.dom.TagName.BASEFONT = new goog.dom.TagName('BASEFONT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.BDI = new goog.dom.TagName('BDI');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.BDO = new goog.dom.TagName('BDO');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.BIG = new goog.dom.TagName('BIG');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLQuoteElement>} */
|
||||
goog.dom.TagName.BLOCKQUOTE = new goog.dom.TagName('BLOCKQUOTE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLBodyElement>} */
|
||||
goog.dom.TagName.BODY = new goog.dom.TagName('BODY');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLBRElement>} */
|
||||
goog.dom.TagName.BR = new goog.dom.TagName('BR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLButtonElement>} */
|
||||
goog.dom.TagName.BUTTON = new goog.dom.TagName('BUTTON');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLCanvasElement>} */
|
||||
goog.dom.TagName.CANVAS = new goog.dom.TagName('CANVAS');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableCaptionElement>} */
|
||||
goog.dom.TagName.CAPTION = new goog.dom.TagName('CAPTION');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.CENTER = new goog.dom.TagName('CENTER');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.CITE = new goog.dom.TagName('CITE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.CODE = new goog.dom.TagName('CODE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableColElement>} */
|
||||
goog.dom.TagName.COL = new goog.dom.TagName('COL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableColElement>} */
|
||||
goog.dom.TagName.COLGROUP = new goog.dom.TagName('COLGROUP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.COMMAND = new goog.dom.TagName('COMMAND');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.DATA = new goog.dom.TagName('DATA');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDataListElement>} */
|
||||
goog.dom.TagName.DATALIST = new goog.dom.TagName('DATALIST');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.DD = new goog.dom.TagName('DD');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLModElement>} */
|
||||
goog.dom.TagName.DEL = new goog.dom.TagName('DEL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDetailsElement>} */
|
||||
goog.dom.TagName.DETAILS = new goog.dom.TagName('DETAILS');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.DFN = new goog.dom.TagName('DFN');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDialogElement>} */
|
||||
goog.dom.TagName.DIALOG = new goog.dom.TagName('DIALOG');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDirectoryElement>} */
|
||||
goog.dom.TagName.DIR = new goog.dom.TagName('DIR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDivElement>} */
|
||||
goog.dom.TagName.DIV = new goog.dom.TagName('DIV');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLDListElement>} */
|
||||
goog.dom.TagName.DL = new goog.dom.TagName('DL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.DT = new goog.dom.TagName('DT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.EM = new goog.dom.TagName('EM');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLEmbedElement>} */
|
||||
goog.dom.TagName.EMBED = new goog.dom.TagName('EMBED');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLFieldSetElement>} */
|
||||
goog.dom.TagName.FIELDSET = new goog.dom.TagName('FIELDSET');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.FIGCAPTION = new goog.dom.TagName('FIGCAPTION');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.FIGURE = new goog.dom.TagName('FIGURE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLFontElement>} */
|
||||
goog.dom.TagName.FONT = new goog.dom.TagName('FONT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.FOOTER = new goog.dom.TagName('FOOTER');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLFormElement>} */
|
||||
goog.dom.TagName.FORM = new goog.dom.TagName('FORM');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLFrameElement>} */
|
||||
goog.dom.TagName.FRAME = new goog.dom.TagName('FRAME');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLFrameSetElement>} */
|
||||
goog.dom.TagName.FRAMESET = new goog.dom.TagName('FRAMESET');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H1 = new goog.dom.TagName('H1');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H2 = new goog.dom.TagName('H2');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H3 = new goog.dom.TagName('H3');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H4 = new goog.dom.TagName('H4');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H5 = new goog.dom.TagName('H5');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadingElement>} */
|
||||
goog.dom.TagName.H6 = new goog.dom.TagName('H6');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHeadElement>} */
|
||||
goog.dom.TagName.HEAD = new goog.dom.TagName('HEAD');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.HEADER = new goog.dom.TagName('HEADER');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.HGROUP = new goog.dom.TagName('HGROUP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHRElement>} */
|
||||
goog.dom.TagName.HR = new goog.dom.TagName('HR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLHtmlElement>} */
|
||||
goog.dom.TagName.HTML = new goog.dom.TagName('HTML');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.I = new goog.dom.TagName('I');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLIFrameElement>} */
|
||||
goog.dom.TagName.IFRAME = new goog.dom.TagName('IFRAME');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLImageElement>} */
|
||||
goog.dom.TagName.IMG = new goog.dom.TagName('IMG');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLInputElement>} */
|
||||
goog.dom.TagName.INPUT = new goog.dom.TagName('INPUT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLModElement>} */
|
||||
goog.dom.TagName.INS = new goog.dom.TagName('INS');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLIsIndexElement>} */
|
||||
goog.dom.TagName.ISINDEX = new goog.dom.TagName('ISINDEX');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.KBD = new goog.dom.TagName('KBD');
|
||||
|
||||
|
||||
// HTMLKeygenElement is deprecated.
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.KEYGEN = new goog.dom.TagName('KEYGEN');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLLabelElement>} */
|
||||
goog.dom.TagName.LABEL = new goog.dom.TagName('LABEL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLLegendElement>} */
|
||||
goog.dom.TagName.LEGEND = new goog.dom.TagName('LEGEND');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLLIElement>} */
|
||||
goog.dom.TagName.LI = new goog.dom.TagName('LI');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLLinkElement>} */
|
||||
goog.dom.TagName.LINK = new goog.dom.TagName('LINK');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLMapElement>} */
|
||||
goog.dom.TagName.MAP = new goog.dom.TagName('MAP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.MARK = new goog.dom.TagName('MARK');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.MATH = new goog.dom.TagName('MATH');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLMenuElement>} */
|
||||
goog.dom.TagName.MENU = new goog.dom.TagName('MENU');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLMetaElement>} */
|
||||
goog.dom.TagName.META = new goog.dom.TagName('META');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLMeterElement>} */
|
||||
goog.dom.TagName.METER = new goog.dom.TagName('METER');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.NAV = new goog.dom.TagName('NAV');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.NOFRAMES = new goog.dom.TagName('NOFRAMES');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.NOSCRIPT = new goog.dom.TagName('NOSCRIPT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLObjectElement>} */
|
||||
goog.dom.TagName.OBJECT = new goog.dom.TagName('OBJECT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLOListElement>} */
|
||||
goog.dom.TagName.OL = new goog.dom.TagName('OL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLOptGroupElement>} */
|
||||
goog.dom.TagName.OPTGROUP = new goog.dom.TagName('OPTGROUP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLOptionElement>} */
|
||||
goog.dom.TagName.OPTION = new goog.dom.TagName('OPTION');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLOutputElement>} */
|
||||
goog.dom.TagName.OUTPUT = new goog.dom.TagName('OUTPUT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLParagraphElement>} */
|
||||
goog.dom.TagName.P = new goog.dom.TagName('P');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLParamElement>} */
|
||||
goog.dom.TagName.PARAM = new goog.dom.TagName('PARAM');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLPreElement>} */
|
||||
goog.dom.TagName.PRE = new goog.dom.TagName('PRE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLProgressElement>} */
|
||||
goog.dom.TagName.PROGRESS = new goog.dom.TagName('PROGRESS');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLQuoteElement>} */
|
||||
goog.dom.TagName.Q = new goog.dom.TagName('Q');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.RP = new goog.dom.TagName('RP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.RT = new goog.dom.TagName('RT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.RUBY = new goog.dom.TagName('RUBY');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.S = new goog.dom.TagName('S');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SAMP = new goog.dom.TagName('SAMP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLScriptElement>} */
|
||||
goog.dom.TagName.SCRIPT = new goog.dom.TagName('SCRIPT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SECTION = new goog.dom.TagName('SECTION');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLSelectElement>} */
|
||||
goog.dom.TagName.SELECT = new goog.dom.TagName('SELECT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SMALL = new goog.dom.TagName('SMALL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLSourceElement>} */
|
||||
goog.dom.TagName.SOURCE = new goog.dom.TagName('SOURCE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLSpanElement>} */
|
||||
goog.dom.TagName.SPAN = new goog.dom.TagName('SPAN');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.STRIKE = new goog.dom.TagName('STRIKE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.STRONG = new goog.dom.TagName('STRONG');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLStyleElement>} */
|
||||
goog.dom.TagName.STYLE = new goog.dom.TagName('STYLE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SUB = new goog.dom.TagName('SUB');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SUMMARY = new goog.dom.TagName('SUMMARY');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SUP = new goog.dom.TagName('SUP');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.SVG = new goog.dom.TagName('SVG');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableElement>} */
|
||||
goog.dom.TagName.TABLE = new goog.dom.TagName('TABLE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableSectionElement>} */
|
||||
goog.dom.TagName.TBODY = new goog.dom.TagName('TBODY');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableCellElement>} */
|
||||
goog.dom.TagName.TD = new goog.dom.TagName('TD');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTemplateElement>} */
|
||||
goog.dom.TagName.TEMPLATE = new goog.dom.TagName('TEMPLATE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTextAreaElement>} */
|
||||
goog.dom.TagName.TEXTAREA = new goog.dom.TagName('TEXTAREA');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableSectionElement>} */
|
||||
goog.dom.TagName.TFOOT = new goog.dom.TagName('TFOOT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableCellElement>} */
|
||||
goog.dom.TagName.TH = new goog.dom.TagName('TH');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableSectionElement>} */
|
||||
goog.dom.TagName.THEAD = new goog.dom.TagName('THEAD');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.TIME = new goog.dom.TagName('TIME');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTitleElement>} */
|
||||
goog.dom.TagName.TITLE = new goog.dom.TagName('TITLE');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTableRowElement>} */
|
||||
goog.dom.TagName.TR = new goog.dom.TagName('TR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLTrackElement>} */
|
||||
goog.dom.TagName.TRACK = new goog.dom.TagName('TRACK');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.TT = new goog.dom.TagName('TT');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.U = new goog.dom.TagName('U');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLUListElement>} */
|
||||
goog.dom.TagName.UL = new goog.dom.TagName('UL');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.VAR = new goog.dom.TagName('VAR');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!HTMLVideoElement>} */
|
||||
goog.dom.TagName.VIDEO = new goog.dom.TagName('VIDEO');
|
||||
|
||||
|
||||
/** @type {!goog.dom.TagName<!goog.dom.HtmlElement>} */
|
||||
goog.dom.TagName.WBR = new goog.dom.TagName('WBR');
|
||||
|
@ -129,6 +129,12 @@ goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {
|
||||
*/
|
||||
this.button = 0;
|
||||
|
||||
/**
|
||||
* Key of key press.
|
||||
* @type {string}
|
||||
*/
|
||||
this.key = '';
|
||||
|
||||
/**
|
||||
* Keycode of key press.
|
||||
* @type {number}
|
||||
@ -281,6 +287,7 @@ goog.events.BrowserEvent.prototype.init = function(e, opt_currentTarget) {
|
||||
this.button = e.button;
|
||||
|
||||
this.keyCode = e.keyCode || 0;
|
||||
this.key = e.key || '';
|
||||
this.charCode = e.charCode || (type == 'keypress' ? e.keyCode : 0);
|
||||
this.ctrlKey = e.ctrlKey;
|
||||
this.altKey = e.altKey;
|
||||
@ -363,7 +370,7 @@ goog.events.BrowserEvent.prototype.preventDefault = function() {
|
||||
if (!be.preventDefault) {
|
||||
be.returnValue = false;
|
||||
if (goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT) {
|
||||
/** @preserveTry */
|
||||
|
||||
try {
|
||||
// Most keys can be prevented using returnValue. Some special keys
|
||||
// require setting the keyCode to -1 as well:
|
||||
|
@ -21,6 +21,8 @@
|
||||
goog.provide('goog.events.BrowserFeature');
|
||||
|
||||
goog.require('goog.userAgent');
|
||||
goog.scope(function() {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -80,5 +82,41 @@ goog.events.BrowserFeature = {
|
||||
'ontouchstart' in document.documentElement) ||
|
||||
// IE10 uses non-standard touch events, so it has a different check.
|
||||
!!(goog.global['navigator'] &&
|
||||
goog.global['navigator']['msMaxTouchPoints']))
|
||||
goog.global['navigator']['msMaxTouchPoints'])),
|
||||
|
||||
/**
|
||||
* Whether addEventListener supports {passive: true}.
|
||||
* https://developers.google.com/web/updates/2016/06/passive-event-listeners
|
||||
*/
|
||||
PASSIVE_EVENTS: purify(function() {
|
||||
// If we're in a web worker or other custom environment, we can't tell.
|
||||
if (!goog.global.addEventListener || !Object.defineProperty) { // IE 8
|
||||
return false;
|
||||
}
|
||||
|
||||
var passive = false;
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function() {
|
||||
passive = true;
|
||||
}
|
||||
});
|
||||
goog.global.addEventListener('test', goog.nullFunction, options);
|
||||
goog.global.removeEventListener('test', goog.nullFunction, options);
|
||||
|
||||
return passive;
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tricks Closure Compiler into believing that a function is pure. The compiler
|
||||
* assumes that any `valueOf` function is pure, without analyzing its contents.
|
||||
*
|
||||
* @param {function(): T} fn
|
||||
* @return {T}
|
||||
* @template T
|
||||
*/
|
||||
function purify(fn) {
|
||||
return ({valueOf: fn}).valueOf();
|
||||
}
|
||||
}); // goog.scope
|
||||
|
@ -99,8 +99,6 @@ goog.events.Event = function(type, opt_target) {
|
||||
* Return value for in internal capture/bubble processing for IE.
|
||||
* @type {boolean}
|
||||
* @public
|
||||
* @suppress {underscore|visibility} Technically public, but referencing this
|
||||
* outside this package is strongly discouraged.
|
||||
*/
|
||||
this.returnValue_ = true;
|
||||
};
|
||||
|
@ -160,30 +160,34 @@ goog.events.listenerCountEstimate_ = 0;
|
||||
* @param {function(this:T, EVENTOBJ):?|{handleEvent:function(?):?}|null}
|
||||
* listener Callback method, or an object with a handleEvent function.
|
||||
* WARNING: passing an Object is now softly deprecated.
|
||||
* @param {boolean=} opt_capt Whether to fire in capture phase (defaults to
|
||||
* false).
|
||||
* @param {(boolean|!AddEventListenerOptions)=} opt_options
|
||||
* @param {T=} opt_handler Element in whose scope to call the listener.
|
||||
* @return {goog.events.Key} Unique key for the listener.
|
||||
* @template T,EVENTOBJ
|
||||
*/
|
||||
goog.events.listen = function(src, type, listener, opt_capt, opt_handler) {
|
||||
goog.events.listen = function(src, type, listener, opt_options, opt_handler) {
|
||||
if (opt_options && opt_options.once) {
|
||||
return goog.events.listenOnce(
|
||||
src, type, listener, opt_options, opt_handler);
|
||||
}
|
||||
if (goog.isArray(type)) {
|
||||
for (var i = 0; i < type.length; i++) {
|
||||
goog.events.listen(src, type[i], listener, opt_capt, opt_handler);
|
||||
goog.events.listen(src, type[i], listener, opt_options, opt_handler);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
listener = goog.events.wrapListener(listener);
|
||||
if (goog.events.Listenable.isImplementedBy(src)) {
|
||||
var capture =
|
||||
goog.isObject(opt_options) ? !!opt_options.capture : !!opt_options;
|
||||
return src.listen(
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, opt_capt,
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, capture,
|
||||
opt_handler);
|
||||
} else {
|
||||
return goog.events.listen_(
|
||||
/** @type {!EventTarget} */ (src),
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener,
|
||||
/* callOnce */ false, opt_capt, opt_handler);
|
||||
/** @type {!EventTarget} */ (src), type, listener,
|
||||
/* callOnce */ false, opt_options, opt_handler);
|
||||
}
|
||||
};
|
||||
|
||||
@ -198,23 +202,24 @@ goog.events.listen = function(src, type, listener, opt_capt, opt_handler) {
|
||||
* one-off listener to become a normal listener.
|
||||
*
|
||||
* @param {EventTarget} src The node to listen to events on.
|
||||
* @param {string|!goog.events.EventId} type Event type.
|
||||
* @param {string|?goog.events.EventId<EVENTOBJ>} type Event type.
|
||||
* @param {!Function} listener Callback function.
|
||||
* @param {boolean} callOnce Whether the listener is a one-off
|
||||
* listener or otherwise.
|
||||
* @param {boolean=} opt_capt Whether to fire in capture phase (defaults to
|
||||
* false).
|
||||
* @param {(boolean|!AddEventListenerOptions)=} opt_options
|
||||
* @param {Object=} opt_handler Element in whose scope to call the listener.
|
||||
* @return {goog.events.ListenableKey} Unique key for the listener.
|
||||
* @template EVENTOBJ
|
||||
* @private
|
||||
*/
|
||||
goog.events.listen_ = function(
|
||||
src, type, listener, callOnce, opt_capt, opt_handler) {
|
||||
src, type, listener, callOnce, opt_options, opt_handler) {
|
||||
if (!type) {
|
||||
throw Error('Invalid event type');
|
||||
}
|
||||
|
||||
var capture = !!opt_capt;
|
||||
var capture =
|
||||
goog.isObject(opt_options) ? !!opt_options.capture : !!opt_options;
|
||||
if (capture && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
|
||||
if (goog.events.CAPTURE_SIMULATION_MODE ==
|
||||
goog.events.CaptureSimulationMode.OFF_AND_FAIL) {
|
||||
@ -233,8 +238,8 @@ goog.events.listen_ = function(
|
||||
new goog.events.ListenerMap(src);
|
||||
}
|
||||
|
||||
var listenerObj =
|
||||
listenerMap.add(type, listener, callOnce, opt_capt, opt_handler);
|
||||
var listenerObj = /** @type {goog.events.Listener} */ (
|
||||
listenerMap.add(type, listener, callOnce, capture, opt_handler));
|
||||
|
||||
// If the listenerObj already has a proxy, it has been set up
|
||||
// previously. We simply return.
|
||||
@ -250,7 +255,13 @@ goog.events.listen_ = function(
|
||||
|
||||
// Attach the proxy through the browser's API
|
||||
if (src.addEventListener) {
|
||||
src.addEventListener(type.toString(), proxy, capture);
|
||||
// Don't pass an object as `capture` if the browser doesn't support that.
|
||||
if (!goog.events.BrowserFeature.PASSIVE_EVENTS) {
|
||||
opt_options = capture;
|
||||
}
|
||||
// Don't break tests that expect a boolean.
|
||||
if (opt_options === undefined) opt_options = false;
|
||||
src.addEventListener(type.toString(), proxy, opt_options);
|
||||
} else if (src.attachEvent) {
|
||||
// The else if above used to be an unconditional else. It would call
|
||||
// exception on IE11, spoiling the day of some callers. The previous
|
||||
@ -310,29 +321,31 @@ goog.events.getProxy = function() {
|
||||
* type Event type or array of event types.
|
||||
* @param {function(this:T, EVENTOBJ):?|{handleEvent:function(?):?}|null}
|
||||
* listener Callback method.
|
||||
* @param {boolean=} opt_capt Fire in capture phase?.
|
||||
* @param {(boolean|!AddEventListenerOptions)=} opt_options
|
||||
* @param {T=} opt_handler Element in whose scope to call the listener.
|
||||
* @return {goog.events.Key} Unique key for the listener.
|
||||
* @template T,EVENTOBJ
|
||||
*/
|
||||
goog.events.listenOnce = function(src, type, listener, opt_capt, opt_handler) {
|
||||
goog.events.listenOnce = function(
|
||||
src, type, listener, opt_options, opt_handler) {
|
||||
if (goog.isArray(type)) {
|
||||
for (var i = 0; i < type.length; i++) {
|
||||
goog.events.listenOnce(src, type[i], listener, opt_capt, opt_handler);
|
||||
goog.events.listenOnce(src, type[i], listener, opt_options, opt_handler);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
listener = goog.events.wrapListener(listener);
|
||||
if (goog.events.Listenable.isImplementedBy(src)) {
|
||||
var capture =
|
||||
goog.isObject(opt_options) ? !!opt_options.capture : !!opt_options;
|
||||
return src.listenOnce(
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, opt_capt,
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, capture,
|
||||
opt_handler);
|
||||
} else {
|
||||
return goog.events.listen_(
|
||||
/** @type {!EventTarget} */ (src),
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener,
|
||||
/* callOnce */ true, opt_capt, opt_handler);
|
||||
/** @type {!EventTarget} */ (src), type, listener,
|
||||
/* callOnce */ true, opt_options, opt_handler);
|
||||
}
|
||||
};
|
||||
|
||||
@ -368,25 +381,27 @@ goog.events.listenWithWrapper = function(
|
||||
* type Event type or array of event types to unlisten to.
|
||||
* @param {function(?):?|{handleEvent:function(?):?}|null} listener The
|
||||
* listener function to remove.
|
||||
* @param {boolean=} opt_capt In DOM-compliant browsers, this determines
|
||||
* @param {(boolean|!EventListenerOptions)=} opt_options
|
||||
* whether the listener is fired during the capture or bubble phase of the
|
||||
* event.
|
||||
* @param {Object=} opt_handler Element in whose scope to call the listener.
|
||||
* @return {?boolean} indicating whether the listener was there to remove.
|
||||
* @template EVENTOBJ
|
||||
*/
|
||||
goog.events.unlisten = function(src, type, listener, opt_capt, opt_handler) {
|
||||
goog.events.unlisten = function(src, type, listener, opt_options, opt_handler) {
|
||||
if (goog.isArray(type)) {
|
||||
for (var i = 0; i < type.length; i++) {
|
||||
goog.events.unlisten(src, type[i], listener, opt_capt, opt_handler);
|
||||
goog.events.unlisten(src, type[i], listener, opt_options, opt_handler);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var capture =
|
||||
goog.isObject(opt_options) ? !!opt_options.capture : !!opt_options;
|
||||
|
||||
listener = goog.events.wrapListener(listener);
|
||||
if (goog.events.Listenable.isImplementedBy(src)) {
|
||||
return src.unlisten(
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, opt_capt,
|
||||
/** @type {string|!goog.events.EventId} */ (type), listener, capture,
|
||||
opt_handler);
|
||||
}
|
||||
|
||||
@ -396,7 +411,6 @@ goog.events.unlisten = function(src, type, listener, opt_capt, opt_handler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var capture = !!opt_capt;
|
||||
var listenerMap = goog.events.getListenerMap_(
|
||||
/** @type {!EventTarget} */ (src));
|
||||
if (listenerMap) {
|
||||
@ -461,7 +475,7 @@ goog.events.unlistenByKey = function(key) {
|
||||
src[goog.events.LISTENER_MAP_PROP_] = null;
|
||||
}
|
||||
} else {
|
||||
listener.markAsRemoved();
|
||||
/** @type {!goog.events.Listener} */ (listener).markAsRemoved();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -718,7 +732,7 @@ goog.events.fireListeners_ = function(obj, type, capture, eventObject) {
|
||||
*
|
||||
* @param {goog.events.Listener} listener The listener object to call.
|
||||
* @param {Object} eventObject The event object to pass to the listener.
|
||||
* @return {boolean} Result of listener.
|
||||
* @return {*} Result of listener.
|
||||
*/
|
||||
goog.events.fireListener = function(listener, eventObject) {
|
||||
var listenerFn = listener.listener;
|
||||
@ -789,7 +803,7 @@ goog.events.protectBrowserEventEntryPoint = function(errorHandler) {
|
||||
* @param {goog.events.Listener} listener The listener object.
|
||||
* @param {Event=} opt_evt Optional event object that gets passed in via the
|
||||
* native event handlers.
|
||||
* @return {boolean} Result of the event handler.
|
||||
* @return {*} Result of the event handler.
|
||||
* @this {EventTarget} The object or Element that fired the event.
|
||||
* @private
|
||||
*/
|
||||
@ -804,7 +818,7 @@ goog.events.handleBrowserEvent_ = function(listener, opt_evt) {
|
||||
var ieEvent = opt_evt ||
|
||||
/** @type {Event} */ (goog.getObjectByName('window.event'));
|
||||
var evt = new goog.events.BrowserEvent(ieEvent, this);
|
||||
/** @type {boolean} */
|
||||
/** @type {*} */
|
||||
var retval = true;
|
||||
|
||||
if (goog.events.CAPTURE_SIMULATION_MODE ==
|
||||
@ -880,7 +894,7 @@ goog.events.markIeEvent_ = function(e) {
|
||||
// We could test that that is the case but that would allocate 3 objects.
|
||||
// If we use try/catch we will only allocate extra objects in the case of a
|
||||
// failure.
|
||||
/** @preserveTry */
|
||||
|
||||
try {
|
||||
e.keyCode = -1;
|
||||
return;
|
||||
|
@ -55,8 +55,10 @@ goog.events.EventType = {
|
||||
MOUSEMOVE: 'mousemove',
|
||||
MOUSEENTER: 'mouseenter',
|
||||
MOUSELEAVE: 'mouseleave',
|
||||
// Select start is non-standard.
|
||||
// See http://msdn.microsoft.com/en-us/library/ie/ms536969(v=vs.85).aspx.
|
||||
|
||||
// Selection events.
|
||||
// https://www.w3.org/TR/selection-api/
|
||||
SELECTIONCHANGE: 'selectionchange',
|
||||
SELECTSTART: 'selectstart', // IE, Safari, Chrome
|
||||
|
||||
// Wheel events
|
||||
@ -112,6 +114,8 @@ goog.events.EventType = {
|
||||
BEFOREUNLOAD: 'beforeunload',
|
||||
CONSOLEMESSAGE: 'consolemessage',
|
||||
CONTEXTMENU: 'contextmenu',
|
||||
DEVICEMOTION: 'devicemotion',
|
||||
DEVICEORIENTATION: 'deviceorientation',
|
||||
DOMCONTENTLOADED: 'DOMContentLoaded',
|
||||
ERROR: 'error',
|
||||
HELP: 'help',
|
||||
@ -121,9 +125,39 @@ goog.events.EventType = {
|
||||
READYSTATECHANGE: 'readystatechange',
|
||||
RESIZE: 'resize',
|
||||
SCROLL: 'scroll',
|
||||
TIMEUPDATE: 'timeupdate',
|
||||
UNLOAD: 'unload',
|
||||
|
||||
// Media events
|
||||
CANPLAY: 'canplay',
|
||||
CANPLAYTHROUGH: 'canplaythrough',
|
||||
DURATIONCHANGE: 'durationchange',
|
||||
EMPTIED: 'emptied',
|
||||
ENDED: 'ended',
|
||||
LOADEDDATA: 'loadeddata',
|
||||
LOADEDMETADATA: 'loadedmetadata',
|
||||
PAUSE: 'pause',
|
||||
PLAY: 'play',
|
||||
PLAYING: 'playing',
|
||||
RATECHANGE: 'ratechange',
|
||||
SEEKED: 'seeked',
|
||||
SEEKING: 'seeking',
|
||||
STALLED: 'stalled',
|
||||
SUSPEND: 'suspend',
|
||||
TIMEUPDATE: 'timeupdate',
|
||||
VOLUMECHANGE: 'volumechange',
|
||||
WAITING: 'waiting',
|
||||
|
||||
// Media Source Extensions events
|
||||
// https://www.w3.org/TR/media-source/#mediasource-events
|
||||
SOURCEOPEN: 'sourceopen',
|
||||
SOURCEENDED: 'sourceended',
|
||||
SOURCECLOSED: 'sourceclosed',
|
||||
// https://www.w3.org/TR/media-source/#sourcebuffer-events
|
||||
ABORT: 'abort',
|
||||
UPDATE: 'update',
|
||||
UPDATESTART: 'updatestart',
|
||||
UPDATEEND: 'updateend',
|
||||
|
||||
// HTML 5 History events
|
||||
// See http://www.w3.org/TR/html5/browsers.html#event-definitions-0
|
||||
HASHCHANGE: 'hashchange',
|
||||
@ -151,6 +185,21 @@ goog.events.EventType = {
|
||||
MESSAGE: 'message',
|
||||
CONNECT: 'connect',
|
||||
|
||||
// Service Worker Events - ServiceWorkerGlobalScope context
|
||||
// See https://w3c.github.io/ServiceWorker/#execution-context-events
|
||||
// Note: message event defined in worker events section
|
||||
INSTALL: 'install',
|
||||
ACTIVATE: 'activate',
|
||||
FETCH: 'fetch',
|
||||
FOREIGNFETCH: 'foreignfetch',
|
||||
MESSAGEERROR: 'messageerror',
|
||||
|
||||
// Service Worker Events - Document context
|
||||
// See https://w3c.github.io/ServiceWorker/#document-context-events
|
||||
STATECHANGE: 'statechange',
|
||||
UPDATEFOUND: 'updatefound',
|
||||
CONTROLLERCHANGE: 'controllerchange',
|
||||
|
||||
// CSS animation events.
|
||||
/** @suppress {missingRequire} */
|
||||
ANIMATIONSTART: goog.events.getVendorPrefixedName_('AnimationStart'),
|
||||
@ -200,11 +249,18 @@ goog.events.EventType = {
|
||||
|
||||
// Native IMEs/input tools events.
|
||||
TEXT: 'text',
|
||||
TEXTINPUT: 'textInput',
|
||||
// The textInput event is supported in IE9+, but only in lower case. All other
|
||||
// browsers use the camel-case event name.
|
||||
TEXTINPUT: goog.userAgent.IE ? 'textinput' : 'textInput',
|
||||
COMPOSITIONSTART: 'compositionstart',
|
||||
COMPOSITIONUPDATE: 'compositionupdate',
|
||||
COMPOSITIONEND: 'compositionend',
|
||||
|
||||
// The beforeinput event is initially only supported in Safari. See
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome
|
||||
// implementation tracking.
|
||||
BEFOREINPUT: 'beforeinput',
|
||||
|
||||
// Webview tag events
|
||||
// See http://developer.chrome.com/dev/apps/webview_tag.html
|
||||
EXIT: 'exit',
|
||||
|
@ -75,8 +75,8 @@ goog.events.Listenable.IMPLEMENTED_BY_PROP =
|
||||
* Marks a given class (constructor) as an implementation of
|
||||
* Listenable, do that we can query that fact at runtime. The class
|
||||
* must have already implemented the interface.
|
||||
* @param {!Function} cls The class constructor. The corresponding
|
||||
* class must have already implemented the interface.
|
||||
* @param {!function(new:goog.events.Listenable,...)} cls The class constructor.
|
||||
* The corresponding class must have already implemented the interface.
|
||||
*/
|
||||
goog.events.Listenable.addImplementation = function(cls) {
|
||||
cls.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = true;
|
||||
|
@ -25,7 +25,7 @@ goog.require('goog.events.ListenableKey');
|
||||
|
||||
/**
|
||||
* Simple class that stores information about a listener
|
||||
* @param {!Function} listener Callback function.
|
||||
* @param {function(?):?} listener Callback function.
|
||||
* @param {Function} proxy Wrapper for the listener that patches the event.
|
||||
* @param {EventTarget|goog.events.Listenable} src Source object for
|
||||
* the event.
|
||||
@ -41,10 +41,7 @@ goog.events.Listener = function(
|
||||
this.creationStack = new Error().stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function.
|
||||
* @type {Function}
|
||||
*/
|
||||
/** @override */
|
||||
this.listener = listener;
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@
|
||||
* WARNING: Do not use this class from outside goog.events package.
|
||||
*
|
||||
* @visibility {//closure/goog/bin/sizetests:__pkg__}
|
||||
* @visibility {//closure/goog:__pkg__}
|
||||
* @visibility {//closure/goog/events:__pkg__}
|
||||
* @visibility {//closure/goog/labs/events:__pkg__}
|
||||
*/
|
||||
@ -170,7 +171,7 @@ goog.events.ListenerMap.prototype.removeByKey = function(listener) {
|
||||
|
||||
var removed = goog.array.remove(this.listeners[type], listener);
|
||||
if (removed) {
|
||||
listener.markAsRemoved();
|
||||
/** @type {!goog.events.Listener} */ (listener).markAsRemoved();
|
||||
if (this.listeners[type].length == 0) {
|
||||
delete this.listeners[type];
|
||||
this.typeCount_--;
|
||||
|
@ -73,10 +73,6 @@ goog.fs.url.getUrlObject_ = function() {
|
||||
*
|
||||
* @return {?goog.fs.url.UrlObject_} The object for this browser or null if the
|
||||
* browser does not support Object Urls.
|
||||
* @suppress {unnecessaryCasts} Depending on how the code is compiled, casting
|
||||
* goog.global to UrlObject_ may result in unnecessary cast warning.
|
||||
* However, the cast cannot be removed because with different set of
|
||||
* compiler flags, the cast is indeed necessary. As such, silencing it.
|
||||
* @private
|
||||
*/
|
||||
goog.fs.url.findUrlObject_ = function() {
|
||||
|
483
assets/viz/2/goog/functions/functions.js
Normal file
483
assets/viz/2/goog/functions/functions.js
Normal file
@ -0,0 +1,483 @@
|
||||
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Utilities for creating functions. Loosely inspired by the
|
||||
* java classes: http://goo.gl/GM0Hmu and http://goo.gl/6k7nI8.
|
||||
*
|
||||
* @author nicksantos@google.com (Nick Santos)
|
||||
*/
|
||||
|
||||
|
||||
goog.provide('goog.functions');
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that always returns the same value.
|
||||
* @param {T} retValue The value to return.
|
||||
* @return {function():T} The new function.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.constant = function(retValue) {
|
||||
return function() { return retValue; };
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Always returns false.
|
||||
* @type {function(...): boolean}
|
||||
*/
|
||||
goog.functions.FALSE = goog.functions.constant(false);
|
||||
|
||||
|
||||
/**
|
||||
* Always returns true.
|
||||
* @type {function(...): boolean}
|
||||
*/
|
||||
goog.functions.TRUE = goog.functions.constant(true);
|
||||
|
||||
|
||||
/**
|
||||
* Always returns NULL.
|
||||
* @type {function(...): null}
|
||||
*/
|
||||
goog.functions.NULL = goog.functions.constant(null);
|
||||
|
||||
|
||||
/**
|
||||
* A simple function that returns the first argument of whatever is passed
|
||||
* into it.
|
||||
* @param {T=} opt_returnValue The single value that will be returned.
|
||||
* @param {...*} var_args Optional trailing arguments. These are ignored.
|
||||
* @return {T} The first argument passed in, or undefined if nothing was passed.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.identity = function(opt_returnValue, var_args) {
|
||||
return opt_returnValue;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that always throws an error with the given message.
|
||||
* @param {string} message The error message.
|
||||
* @return {!Function} The error-throwing function.
|
||||
*/
|
||||
goog.functions.error = function(message) {
|
||||
return function() { throw Error(message); };
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that throws the given object.
|
||||
* @param {*} err An object to be thrown.
|
||||
* @return {!Function} The error-throwing function.
|
||||
*/
|
||||
goog.functions.fail = function(err) {
|
||||
return function() { throw err; };
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Given a function, create a function that keeps opt_numArgs arguments and
|
||||
* silently discards all additional arguments.
|
||||
* @param {Function} f The original function.
|
||||
* @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.
|
||||
* @return {!Function} A version of f that only keeps the first opt_numArgs
|
||||
* arguments.
|
||||
*/
|
||||
goog.functions.lock = function(f, opt_numArgs) {
|
||||
opt_numArgs = opt_numArgs || 0;
|
||||
return function() {
|
||||
return f.apply(this, Array.prototype.slice.call(arguments, 0, opt_numArgs));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that returns its nth argument.
|
||||
* @param {number} n The position of the return argument.
|
||||
* @return {!Function} A new function.
|
||||
*/
|
||||
goog.functions.nth = function(n) {
|
||||
return function() { return arguments[n]; };
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Like goog.partial(), except that arguments are added after arguments to the
|
||||
* returned function.
|
||||
*
|
||||
* Usage:
|
||||
* function f(arg1, arg2, arg3, arg4) { ... }
|
||||
* var g = goog.functions.partialRight(f, arg3, arg4);
|
||||
* g(arg1, arg2);
|
||||
*
|
||||
* @param {!Function} fn A function to partially apply.
|
||||
* @param {...*} var_args Additional arguments that are partially applied to fn
|
||||
* at the end.
|
||||
* @return {!Function} A partially-applied form of the function goog.partial()
|
||||
* was invoked as a method of.
|
||||
*/
|
||||
goog.functions.partialRight = function(fn, var_args) {
|
||||
var rightArgs = Array.prototype.slice.call(arguments, 1);
|
||||
return function() {
|
||||
var newArgs = Array.prototype.slice.call(arguments);
|
||||
newArgs.push.apply(newArgs, rightArgs);
|
||||
return fn.apply(this, newArgs);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Given a function, create a new function that swallows its return value
|
||||
* and replaces it with a new one.
|
||||
* @param {Function} f A function.
|
||||
* @param {T} retValue A new return value.
|
||||
* @return {function(...?):T} A new function.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.withReturnValue = function(f, retValue) {
|
||||
return goog.functions.sequence(f, goog.functions.constant(retValue));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that returns whether its argument equals the given value.
|
||||
*
|
||||
* Example:
|
||||
* var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));
|
||||
*
|
||||
* @param {*} value The value to compare to.
|
||||
* @param {boolean=} opt_useLooseComparison Whether to use a loose (==)
|
||||
* comparison rather than a strict (===) one. Defaults to false.
|
||||
* @return {function(*):boolean} The new function.
|
||||
*/
|
||||
goog.functions.equalTo = function(value, opt_useLooseComparison) {
|
||||
return function(other) {
|
||||
return opt_useLooseComparison ? (value == other) : (value === other);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates the composition of the functions passed in.
|
||||
* For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).
|
||||
* @param {function(...?):T} fn The final function.
|
||||
* @param {...Function} var_args A list of functions.
|
||||
* @return {function(...?):T} The composition of all inputs.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.compose = function(fn, var_args) {
|
||||
var functions = arguments;
|
||||
var length = functions.length;
|
||||
return function() {
|
||||
var result;
|
||||
if (length) {
|
||||
result = functions[length - 1].apply(this, arguments);
|
||||
}
|
||||
|
||||
for (var i = length - 2; i >= 0; i--) {
|
||||
result = functions[i].call(this, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that calls the functions passed in in sequence, and
|
||||
* returns the value of the last function. For example,
|
||||
* (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).
|
||||
* @param {...Function} var_args A list of functions.
|
||||
* @return {!Function} A function that calls all inputs in sequence.
|
||||
*/
|
||||
goog.functions.sequence = function(var_args) {
|
||||
var functions = arguments;
|
||||
var length = functions.length;
|
||||
return function() {
|
||||
var result;
|
||||
for (var i = 0; i < length; i++) {
|
||||
result = functions[i].apply(this, arguments);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that returns true if each of its components evaluates
|
||||
* to true. The components are evaluated in order, and the evaluation will be
|
||||
* short-circuited as soon as a function returns false.
|
||||
* For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).
|
||||
* @param {...Function} var_args A list of functions.
|
||||
* @return {function(...?):boolean} A function that ANDs its component
|
||||
* functions.
|
||||
*/
|
||||
goog.functions.and = function(var_args) {
|
||||
var functions = arguments;
|
||||
var length = functions.length;
|
||||
return function() {
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (!functions[i].apply(this, arguments)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that returns true if any of its components evaluates
|
||||
* to true. The components are evaluated in order, and the evaluation will be
|
||||
* short-circuited as soon as a function returns true.
|
||||
* For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).
|
||||
* @param {...Function} var_args A list of functions.
|
||||
* @return {function(...?):boolean} A function that ORs its component
|
||||
* functions.
|
||||
*/
|
||||
goog.functions.or = function(var_args) {
|
||||
var functions = arguments;
|
||||
var length = functions.length;
|
||||
return function() {
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (functions[i].apply(this, arguments)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a function that returns the Boolean opposite of a provided function.
|
||||
* For example, (goog.functions.not(f))(x) is equivalent to !f(x).
|
||||
* @param {!Function} f The original function.
|
||||
* @return {function(...?):boolean} A function that delegates to f and returns
|
||||
* opposite.
|
||||
*/
|
||||
goog.functions.not = function(f) {
|
||||
return function() { return !f.apply(this, arguments); };
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generic factory function to construct an object given the constructor
|
||||
* and the arguments. Intended to be bound to create object factories.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* var factory = goog.partial(goog.functions.create, Class);
|
||||
*
|
||||
* @param {function(new:T, ...)} constructor The constructor for the Object.
|
||||
* @param {...*} var_args The arguments to be passed to the constructor.
|
||||
* @return {T} A new instance of the class given in {@code constructor}.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.create = function(constructor, var_args) {
|
||||
/**
|
||||
* @constructor
|
||||
* @final
|
||||
*/
|
||||
var temp = function() {};
|
||||
temp.prototype = constructor.prototype;
|
||||
|
||||
// obj will have constructor's prototype in its chain and
|
||||
// 'obj instanceof constructor' will be true.
|
||||
var obj = new temp();
|
||||
|
||||
// obj is initialized by constructor.
|
||||
// arguments is only array-like so lacks shift(), but can be used with
|
||||
// the Array prototype function.
|
||||
constructor.apply(obj, Array.prototype.slice.call(arguments, 1));
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @define {boolean} Whether the return value cache should be used.
|
||||
* This should only be used to disable caches when testing.
|
||||
*/
|
||||
goog.define('goog.functions.CACHE_RETURN_VALUE', true);
|
||||
|
||||
|
||||
/**
|
||||
* Gives a wrapper function that caches the return value of a parameterless
|
||||
* function when first called.
|
||||
*
|
||||
* When called for the first time, the given function is called and its
|
||||
* return value is cached (thus this is only appropriate for idempotent
|
||||
* functions). Subsequent calls will return the cached return value. This
|
||||
* allows the evaluation of expensive functions to be delayed until first used.
|
||||
*
|
||||
* To cache the return values of functions with parameters, see goog.memoize.
|
||||
*
|
||||
* @param {function():T} fn A function to lazily evaluate.
|
||||
* @return {function():T} A wrapped version the function.
|
||||
* @template T
|
||||
*/
|
||||
goog.functions.cacheReturnValue = function(fn) {
|
||||
var called = false;
|
||||
var value;
|
||||
|
||||
return function() {
|
||||
if (!goog.functions.CACHE_RETURN_VALUE) {
|
||||
return fn();
|
||||
}
|
||||
|
||||
if (!called) {
|
||||
value = fn();
|
||||
called = true;
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to allow it to be called, at most, once. All
|
||||
* additional calls are no-ops.
|
||||
*
|
||||
* This is particularly useful for initialization functions
|
||||
* that should be called, at most, once.
|
||||
*
|
||||
* @param {function():*} f Function to call.
|
||||
* @return {function():undefined} Wrapped function.
|
||||
*/
|
||||
goog.functions.once = function(f) {
|
||||
// Keep a reference to the function that we null out when we're done with
|
||||
// it -- that way, the function can be GC'd when we're done with it.
|
||||
var inner = f;
|
||||
return function() {
|
||||
if (inner) {
|
||||
var tmp = inner;
|
||||
inner = null;
|
||||
tmp();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to allow it to be called, at most, once per interval
|
||||
* (specified in milliseconds). If the wrapper function is called N times within
|
||||
* that interval, only the Nth call will go through.
|
||||
*
|
||||
* This is particularly useful for batching up repeated actions where the
|
||||
* last action should win. This can be used, for example, for refreshing an
|
||||
* autocomplete pop-up every so often rather than updating with every keystroke,
|
||||
* since the final text typed by the user is the one that should produce the
|
||||
* final autocomplete results. For more stateful debouncing with support for
|
||||
* pausing, resuming, and canceling debounced actions, use {@code
|
||||
* goog.async.Debouncer}.
|
||||
*
|
||||
* @param {function(this:SCOPE, ...?)} f Function to call.
|
||||
* @param {number} interval Interval over which to debounce. The function will
|
||||
* only be called after the full interval has elapsed since the last call.
|
||||
* @param {SCOPE=} opt_scope Object in whose scope to call the function.
|
||||
* @return {function(...?): undefined} Wrapped function.
|
||||
* @template SCOPE
|
||||
*/
|
||||
goog.functions.debounce = function(f, interval, opt_scope) {
|
||||
var timeout = 0;
|
||||
return /** @type {function(...?)} */ (function(var_args) {
|
||||
goog.global.clearTimeout(timeout);
|
||||
var args = arguments;
|
||||
timeout = goog.global.setTimeout(function() {
|
||||
f.apply(opt_scope, args);
|
||||
}, interval);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to allow it to be called, at most, once per interval
|
||||
* (specified in milliseconds). If the wrapper function is called N times in
|
||||
* that interval, both the 1st and the Nth calls will go through.
|
||||
*
|
||||
* This is particularly useful for limiting repeated user requests where the
|
||||
* the last action should win, but you also don't want to wait until the end of
|
||||
* the interval before sending a request out, as it leads to a perception of
|
||||
* slowness for the user.
|
||||
*
|
||||
* @param {function(this:SCOPE, ...?)} f Function to call.
|
||||
* @param {number} interval Interval over which to throttle. The function can
|
||||
* only be called once per interval.
|
||||
* @param {SCOPE=} opt_scope Object in whose scope to call the function.
|
||||
* @return {function(...?): undefined} Wrapped function.
|
||||
* @template SCOPE
|
||||
*/
|
||||
goog.functions.throttle = function(f, interval, opt_scope) {
|
||||
var timeout = 0;
|
||||
var shouldFire = false;
|
||||
var args = [];
|
||||
|
||||
var handleTimeout = function() {
|
||||
timeout = 0;
|
||||
if (shouldFire) {
|
||||
shouldFire = false;
|
||||
fire();
|
||||
}
|
||||
};
|
||||
|
||||
var fire = function() {
|
||||
timeout = goog.global.setTimeout(handleTimeout, interval);
|
||||
f.apply(opt_scope, args);
|
||||
};
|
||||
|
||||
return /** @type {function(...?)} */ (function(var_args) {
|
||||
args = arguments;
|
||||
if (!timeout) {
|
||||
fire();
|
||||
} else {
|
||||
shouldFire = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to allow it to be called, at most, once per interval
|
||||
* (specified in milliseconds). If the wrapper function is called N times within
|
||||
* that interval, only the 1st call will go through.
|
||||
*
|
||||
* This is particularly useful for limiting repeated user requests where the
|
||||
* first request is guaranteed to have all the data required to perform the
|
||||
* final action, so there's no need to wait until the end of the interval before
|
||||
* sending the request out.
|
||||
*
|
||||
* @param {function(this:SCOPE, ...?)} f Function to call.
|
||||
* @param {number} interval Interval over which to rate-limit. The function will
|
||||
* only be called once per interval, and ignored for the remainer of the
|
||||
* interval.
|
||||
* @param {SCOPE=} opt_scope Object in whose scope to call the function.
|
||||
* @return {function(...?): undefined} Wrapped function.
|
||||
* @template SCOPE
|
||||
*/
|
||||
goog.functions.rateLimit = function(f, interval, opt_scope) {
|
||||
var timeout = 0;
|
||||
|
||||
var handleTimeout = function() {
|
||||
timeout = 0;
|
||||
};
|
||||
|
||||
return /** @type {function(...?)} */ (function(var_args) {
|
||||
if (!timeout) {
|
||||
timeout = goog.global.setTimeout(handleTimeout, interval);
|
||||
f.apply(opt_scope, arguments);
|
||||
}
|
||||
});
|
||||
};
|
@ -25,6 +25,7 @@ goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.dom.tags');
|
||||
goog.require('goog.html.SafeScript');
|
||||
goog.require('goog.html.SafeStyle');
|
||||
goog.require('goog.html.SafeStyleSheet');
|
||||
goog.require('goog.html.SafeUrl');
|
||||
@ -77,7 +78,7 @@ goog.html.SafeHtml = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.SafeHtml#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
@ -319,7 +320,7 @@ goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = goog.object.createSet(
|
||||
|
||||
/**
|
||||
* @typedef {string|number|goog.string.TypedString|
|
||||
* goog.html.SafeStyle.PropertyMap}
|
||||
* goog.html.SafeStyle.PropertyMap|undefined}
|
||||
*/
|
||||
goog.html.SafeHtml.AttributeValue;
|
||||
|
||||
@ -360,8 +361,9 @@ goog.html.SafeHtml.AttributeValue;
|
||||
* which are not supported by this function are applet, base, embed, iframe,
|
||||
* link, math, object, script, style, svg, and template.
|
||||
*
|
||||
* @param {string} tagName The name of the tag. Only tag names consisting of
|
||||
* [a-zA-Z0-9-] are allowed. Tag names documented above are disallowed.
|
||||
* @param {!goog.dom.TagName|string} tagName The name of the tag. Only tag names
|
||||
* consisting of [a-zA-Z0-9-] are allowed. Tag names documented above are
|
||||
* disallowed.
|
||||
* @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
|
||||
* Mapping from attribute names to their values. Only attribute names
|
||||
* consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
|
||||
@ -376,9 +378,9 @@ goog.html.SafeHtml.AttributeValue;
|
||||
* @throws {goog.asserts.AssertionError} If content for void tag is provided.
|
||||
*/
|
||||
goog.html.SafeHtml.create = function(tagName, opt_attributes, opt_content) {
|
||||
goog.html.SafeHtml.verifyTagName(tagName);
|
||||
goog.html.SafeHtml.verifyTagName(String(tagName));
|
||||
return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
|
||||
tagName, opt_attributes, opt_content);
|
||||
String(tagName), opt_attributes, opt_content);
|
||||
};
|
||||
|
||||
|
||||
@ -525,6 +527,12 @@ goog.html.SafeHtml.canUseSandboxIframe = function() {
|
||||
* opt_attributes contains the src attribute.
|
||||
*/
|
||||
goog.html.SafeHtml.createScriptSrc = function(src, opt_attributes) {
|
||||
// TODO(mlourenco): The charset attribute should probably be blocked. If
|
||||
// its value is attacker controlled, the script contains attacker controlled
|
||||
// sub-strings (even if properly escaped) and the server does not set charset
|
||||
// then XSS is likely possible.
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-charset
|
||||
|
||||
// Check whether this is really TrustedResourceUrl.
|
||||
goog.html.TrustedResourceUrl.unwrap(src);
|
||||
|
||||
@ -537,6 +545,44 @@ goog.html.SafeHtml.createScriptSrc = function(src, opt_attributes) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a SafeHtml representing a script tag. Does not allow the language,
|
||||
* src, text or type attributes to be set.
|
||||
* @param {!goog.html.SafeScript|!Array<!goog.html.SafeScript>}
|
||||
* script Content to put inside the tag. Array elements are
|
||||
* concatenated.
|
||||
* @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
|
||||
* Mapping from attribute names to their values. Only attribute names
|
||||
* consisting of [a-zA-Z0-9-] are allowed. Value of null or undefined causes
|
||||
* the attribute to be omitted.
|
||||
* @return {!goog.html.SafeHtml} The SafeHtml content with the tag.
|
||||
* @throws {Error} If invalid attribute name or attribute value is provided. If
|
||||
* opt_attributes contains the language, src, text or type attribute.
|
||||
*/
|
||||
goog.html.SafeHtml.createScript = function(script, opt_attributes) {
|
||||
for (var attr in opt_attributes) {
|
||||
var attrLower = attr.toLowerCase();
|
||||
if (attrLower == 'language' || attrLower == 'src' || attrLower == 'text' ||
|
||||
attrLower == 'type') {
|
||||
throw Error('Cannot set "' + attrLower + '" attribute');
|
||||
}
|
||||
}
|
||||
|
||||
var content = '';
|
||||
script = goog.array.concat(script);
|
||||
for (var i = 0; i < script.length; i++) {
|
||||
content += goog.html.SafeScript.unwrap(script[i]);
|
||||
}
|
||||
// Convert to SafeHtml so that it's not HTML-escaped. This is safe because
|
||||
// as part of its contract, SafeScript should have no dangerous '<'.
|
||||
var htmlContent =
|
||||
goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(
|
||||
content, goog.i18n.bidi.Dir.NEUTRAL);
|
||||
return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(
|
||||
'script', opt_attributes, htmlContent);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a SafeHtml representing a style tag. The type attribute is set
|
||||
* to "text/css".
|
||||
@ -636,7 +682,7 @@ goog.html.SafeHtml.getAttrNameAndValue_ = function(tagName, name, value) {
|
||||
throw Error(
|
||||
'Attribute "' + name + '" requires goog.string.Const value, "' + value +
|
||||
'" given.');
|
||||
// URL attributes handled differently accroding to tag.
|
||||
// URL attributes handled differently according to tag.
|
||||
} else if (name.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_) {
|
||||
if (value instanceof goog.html.TrustedResourceUrl) {
|
||||
value = goog.html.TrustedResourceUrl.unwrap(value);
|
||||
@ -881,7 +927,7 @@ goog.html.SafeHtml.stringifyAttributes = function(tagName, opt_attributes) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {!Object<string, string>} fixedAttributes
|
||||
* @param {!Object<string, ?goog.html.SafeHtml.AttributeValue>} fixedAttributes
|
||||
* @param {!Object<string, string>} defaultAttributes
|
||||
* @param {?Object<string, ?goog.html.SafeHtml.AttributeValue>=} opt_attributes
|
||||
* Optional attributes passed to create*().
|
||||
|
@ -78,7 +78,7 @@ goog.html.SafeScript = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.SafeScript#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
|
@ -22,6 +22,7 @@ goog.provide('goog.html.SafeStyle');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.html.SafeUrl');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.Const');
|
||||
goog.require('goog.string.TypedString');
|
||||
@ -42,19 +43,19 @@ goog.require('goog.string.TypedString');
|
||||
* is immutable; hence only a default instance corresponding to the empty string
|
||||
* can be obtained via constructor invocation.
|
||||
*
|
||||
* A SafeStyle's string representation ({@link #getTypedStringValue()}) can
|
||||
* safely:
|
||||
* SafeStyle's string representation can safely be:
|
||||
* <ul>
|
||||
* <li>Be interpolated as the entire content of a *quoted* HTML style
|
||||
* attribute, or before already existing properties. The SafeStyle string
|
||||
* *must be HTML-attribute-escaped* (where " and ' are escaped) before
|
||||
* <li>Interpolated as the content of a *quoted* HTML style attribute.
|
||||
* However, the SafeStyle string *must be HTML-attribute-escaped* before
|
||||
* interpolation.
|
||||
* <li>Be interpolated as the entire content of a {}-wrapped block within a
|
||||
* stylesheet, or before already existing properties. The SafeStyle string
|
||||
* should not be escaped before interpolation. SafeStyle's contract also
|
||||
* guarantees that the string will not be able to introduce new properties
|
||||
* or elide existing ones.
|
||||
* <li>Be assigned to the style property of a DOM node. The SafeStyle string
|
||||
* <li>Interpolated as the content of a {}-wrapped block within a stylesheet.
|
||||
* '<' characters in the SafeStyle string *must be CSS-escaped* before
|
||||
* interpolation. The SafeStyle string is also guaranteed not to be able
|
||||
* to introduce new properties or elide existing ones.
|
||||
* <li>Interpolated as the content of a {}-wrapped block within an HTML
|
||||
* <style> element. '<' characters in the SafeStyle string
|
||||
* *must be CSS-escaped* before interpolation.
|
||||
* <li>Assigned to the style property of a DOM node. The SafeStyle string
|
||||
* should not be escaped before being assigned to the property.
|
||||
* </ul>
|
||||
*
|
||||
@ -84,7 +85,7 @@ goog.require('goog.string.TypedString');
|
||||
* appended to {@code background:url("}, the resulting string may result in
|
||||
* the execution of a malicious script.
|
||||
*
|
||||
* TODO(user): Consider whether we should implement UTF-8 interchange
|
||||
* TODO(mlourenco): Consider whether we should implement UTF-8 interchange
|
||||
* validity checks and blacklisting of newlines (including Unicode ones) and
|
||||
* other whitespace characters (\t, \f). Document here if so and also update
|
||||
* SafeStyle.fromConstant().
|
||||
@ -126,7 +127,7 @@ goog.html.SafeStyle = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.SafeStyle#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
@ -312,16 +313,28 @@ goog.html.SafeStyle.EMPTY =
|
||||
|
||||
|
||||
/**
|
||||
* The innocuous string generated by goog.html.SafeUrl.create when passed
|
||||
* The innocuous string generated by goog.html.SafeStyle.create when passed
|
||||
* an unsafe value.
|
||||
* @const {string}
|
||||
*/
|
||||
goog.html.SafeStyle.INNOCUOUS_STRING = 'zClosurez';
|
||||
|
||||
|
||||
/**
|
||||
* A single property value.
|
||||
* @typedef {string|!goog.string.Const|!goog.html.SafeUrl}
|
||||
*/
|
||||
goog.html.SafeStyle.PropertyValue;
|
||||
|
||||
|
||||
/**
|
||||
* Mapping of property names to their values.
|
||||
* @typedef {!Object<string, goog.string.Const|string>}
|
||||
* We don't support numbers even though some values might be numbers (e.g.
|
||||
* line-height or 0 for any length). The reason is that most numeric values need
|
||||
* units (e.g. '1px') and allowing numbers could cause users forgetting about
|
||||
* them.
|
||||
* @typedef {!Object<string, ?goog.html.SafeStyle.PropertyValue|
|
||||
* ?Array<!goog.html.SafeStyle.PropertyValue>>}
|
||||
*/
|
||||
goog.html.SafeStyle.PropertyMap;
|
||||
|
||||
@ -331,9 +344,12 @@ goog.html.SafeStyle.PropertyMap;
|
||||
* @param {goog.html.SafeStyle.PropertyMap} map Mapping of property names to
|
||||
* their values, for example {'margin': '1px'}. Names must consist of
|
||||
* [-_a-zA-Z0-9]. Values might be strings consisting of
|
||||
* [-,.'"%_!# a-zA-Z0-9], where " and ' must be properly balanced.
|
||||
* Other values must be wrapped in goog.string.Const. Null value causes
|
||||
* skipping the property.
|
||||
* [-,.'"%_!# a-zA-Z0-9], where " and ' must be properly balanced. We also
|
||||
* allow simple functions like rgb() and url() which sanitizes its contents.
|
||||
* Other values must be wrapped in goog.string.Const. URLs might be passed
|
||||
* as goog.html.SafeUrl which will be wrapped into url(""). We also support
|
||||
* array whose elements are joined with ' '. Null value causes skipping the
|
||||
* property.
|
||||
* @return {!goog.html.SafeStyle}
|
||||
* @throws {Error} If invalid name is provided.
|
||||
* @throws {goog.asserts.AssertionError} If invalid value is provided. With
|
||||
@ -350,19 +366,11 @@ goog.html.SafeStyle.create = function(map) {
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
if (value instanceof goog.string.Const) {
|
||||
value = goog.string.Const.unwrap(value);
|
||||
// These characters can be used to change context and we don't want that
|
||||
// even with const values.
|
||||
goog.asserts.assert(!/[{;}]/.test(value), 'Value does not allow [{;}].');
|
||||
} else if (!goog.html.SafeStyle.VALUE_RE_.test(value)) {
|
||||
goog.asserts.fail(
|
||||
'String value allows only [-,."\'%_!# a-zA-Z0-9], rgb() and ' +
|
||||
'rgba(), got: ' + value);
|
||||
value = goog.html.SafeStyle.INNOCUOUS_STRING;
|
||||
} else if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {
|
||||
goog.asserts.fail('String value requires balanced quotes, got: ' + value);
|
||||
value = goog.html.SafeStyle.INNOCUOUS_STRING;
|
||||
if (goog.isArray(value)) {
|
||||
value = goog.array.map(value, goog.html.SafeStyle.sanitizePropertyValue_)
|
||||
.join(' ');
|
||||
} else {
|
||||
value = goog.html.SafeStyle.sanitizePropertyValue_(value);
|
||||
}
|
||||
style += name + ':' + value + ';';
|
||||
}
|
||||
@ -375,6 +383,50 @@ goog.html.SafeStyle.create = function(map) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks and converts value to string.
|
||||
* @param {!goog.html.SafeStyle.PropertyValue} value
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
goog.html.SafeStyle.sanitizePropertyValue_ = function(value) {
|
||||
if (value instanceof goog.html.SafeUrl) {
|
||||
var url = goog.html.SafeUrl.unwrap(value);
|
||||
return 'url("' + url.replace(/</g, '%3c').replace(/[\\"]/g, '\\$&') + '")';
|
||||
}
|
||||
var result = value instanceof goog.string.Const ?
|
||||
goog.string.Const.unwrap(value) :
|
||||
goog.html.SafeStyle.sanitizePropertyValueString_(String(value));
|
||||
// These characters can be used to change context and we don't want that even
|
||||
// with const values.
|
||||
goog.asserts.assert(!/[{;}]/.test(result), 'Value does not allow [{;}].');
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks string value.
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
goog.html.SafeStyle.sanitizePropertyValueString_ = function(value) {
|
||||
var valueWithoutFunctions =
|
||||
value.replace(goog.html.SafeUrl.FUNCTIONS_RE_, '$1')
|
||||
.replace(goog.html.SafeUrl.URL_RE_, 'url');
|
||||
if (!goog.html.SafeStyle.VALUE_RE_.test(valueWithoutFunctions)) {
|
||||
goog.asserts.fail(
|
||||
'String value allows only ' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ +
|
||||
' and simple functions, got: ' + value);
|
||||
return goog.html.SafeStyle.INNOCUOUS_STRING;
|
||||
} else if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {
|
||||
goog.asserts.fail('String value requires balanced quotes, got: ' + value);
|
||||
return goog.html.SafeStyle.INNOCUOUS_STRING;
|
||||
}
|
||||
return goog.html.SafeStyle.sanitizeUrl_(value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks that quotes (" and ') are properly balanced inside a string. Assumes
|
||||
* that neither escape (\) nor any other character that could result in
|
||||
@ -400,7 +452,13 @@ goog.html.SafeStyle.hasBalancedQuotes_ = function(value) {
|
||||
};
|
||||
|
||||
|
||||
// Keep in sync with the error string in create().
|
||||
/**
|
||||
* Characters allowed in goog.html.SafeStyle.VALUE_RE_.
|
||||
* @private {string}
|
||||
*/
|
||||
goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = '[-,."\'%_!# a-zA-Z0-9]';
|
||||
|
||||
|
||||
/**
|
||||
* Regular expression for safe values.
|
||||
*
|
||||
@ -411,13 +469,66 @@ goog.html.SafeStyle.hasBalancedQuotes_ = function(value) {
|
||||
* (e.g. background-attachment or font-family) and hence could allow
|
||||
* multiple values to get injected, but that should pose no risk of XSS.
|
||||
*
|
||||
* The rgb() and rgba() expression checks only for XSS safety, not for CSS
|
||||
* validity.
|
||||
* The expression checks only for XSS safety, not for CSS validity.
|
||||
* @const {!RegExp}
|
||||
* @private
|
||||
*/
|
||||
goog.html.SafeStyle.VALUE_RE_ =
|
||||
/^([-,."'%_!# a-zA-Z0-9]+|(?:rgb|hsl)a?\([0-9.%, ]+\))$/;
|
||||
new RegExp('^' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + '+$');
|
||||
|
||||
|
||||
/**
|
||||
* Regular expression for url(). We support URLs allowed by
|
||||
* https://www.w3.org/TR/css-syntax-3/#url-token-diagram without using escape
|
||||
* sequences. Use percent-encoding if you need to use special characters like
|
||||
* backslash.
|
||||
* @private @const {!RegExp}
|
||||
*/
|
||||
goog.html.SafeUrl.URL_RE_ = new RegExp(
|
||||
'\\b(url\\([ \t\n]*)(' +
|
||||
'\'[ -&(-\\[\\]-~]*\'' + // Printable characters except ' and \.
|
||||
'|"[ !#-\\[\\]-~]*"' + // Printable characters except " and \.
|
||||
'|[!#-&*-\\[\\]-~]*' + // Printable characters except [ "'()\\].
|
||||
')([ \t\n]*\\))',
|
||||
'g');
|
||||
|
||||
|
||||
/**
|
||||
* Regular expression for simple functions.
|
||||
* @private @const {!RegExp}
|
||||
*/
|
||||
goog.html.SafeUrl.FUNCTIONS_RE_ = new RegExp(
|
||||
'\\b(hsl|hsla|rgb|rgba|(rotate|scale|translate)(X|Y|Z|3d)?)' +
|
||||
'\\([-0-9a-z.%, ]+\\)',
|
||||
'g');
|
||||
|
||||
|
||||
/**
|
||||
* Sanitize URLs inside url().
|
||||
*
|
||||
* NOTE: We could also consider using CSS.escape once that's available in the
|
||||
* browsers. However, loosely matching URL e.g. with url\(.*\) and then escaping
|
||||
* the contents would result in a slightly different language than CSS leading
|
||||
* to confusion of users. E.g. url(")") is valid in CSS but it would be invalid
|
||||
* as seen by our parser. On the other hand, url(\) is invalid in CSS but our
|
||||
* parser would be fine with it.
|
||||
*
|
||||
* @param {string} value Untrusted CSS property value.
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
goog.html.SafeStyle.sanitizeUrl_ = function(value) {
|
||||
return value.replace(
|
||||
goog.html.SafeUrl.URL_RE_, function(match, before, url, after) {
|
||||
var quote = '';
|
||||
url = url.replace(/^(['"])(.*)\1$/, function(match, start, inside) {
|
||||
quote = start;
|
||||
return inside;
|
||||
});
|
||||
var sanitized = goog.html.SafeUrl.sanitize(url).getTypedStringValue();
|
||||
return before + quote + sanitized + quote + after;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,8 @@ goog.provide('goog.html.SafeStyleSheet');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.html.SafeStyle');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.Const');
|
||||
goog.require('goog.string.TypedString');
|
||||
@ -84,7 +86,7 @@ goog.html.SafeStyleSheet = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.SafeStyleSheet#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
@ -108,6 +110,70 @@ goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = true;
|
||||
goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a style sheet consisting of one selector and one style definition.
|
||||
* Use {@link goog.html.SafeStyleSheet.concat} to create longer style sheets.
|
||||
* This function doesn't support @import, @media and similar constructs.
|
||||
* @param {string} selector CSS selector, e.g. '#id' or 'tag .class, #id'. We
|
||||
* support CSS3 selectors: https://w3.org/TR/css3-selectors/#selectors.
|
||||
* @param {!goog.html.SafeStyle.PropertyMap|!goog.html.SafeStyle} style Style
|
||||
* definition associated with the selector.
|
||||
* @return {!goog.html.SafeStyleSheet}
|
||||
* @throws {Error} If invalid selector is provided.
|
||||
*/
|
||||
goog.html.SafeStyleSheet.createRule = function(selector, style) {
|
||||
if (goog.string.contains(selector, '<')) {
|
||||
throw Error('Selector does not allow \'<\', got: ' + selector);
|
||||
}
|
||||
|
||||
// Remove strings.
|
||||
var selectorToCheck =
|
||||
selector.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g, '');
|
||||
|
||||
// Check characters allowed in CSS3 selectors.
|
||||
if (!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(selectorToCheck)) {
|
||||
throw Error(
|
||||
'Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and ' +
|
||||
'strings, got: ' + selector);
|
||||
}
|
||||
|
||||
// Check balanced () and [].
|
||||
if (!goog.html.SafeStyleSheet.hasBalancedBrackets_(selectorToCheck)) {
|
||||
throw Error('() and [] in selector must be balanced, got: ' + selector);
|
||||
}
|
||||
|
||||
if (!(style instanceof goog.html.SafeStyle)) {
|
||||
style = goog.html.SafeStyle.create(style);
|
||||
}
|
||||
var styleSheet = selector + '{' + goog.html.SafeStyle.unwrap(style) + '}';
|
||||
return goog.html.SafeStyleSheet
|
||||
.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a string has balanced () and [] brackets.
|
||||
* @param {string} s String to check.
|
||||
* @return {boolean}
|
||||
* @private
|
||||
*/
|
||||
goog.html.SafeStyleSheet.hasBalancedBrackets_ = function(s) {
|
||||
var brackets = {'(': ')', '[': ']'};
|
||||
var expectedBrackets = [];
|
||||
for (var i = 0; i < s.length; i++) {
|
||||
var ch = s[i];
|
||||
if (brackets[ch]) {
|
||||
expectedBrackets.push(brackets[ch]);
|
||||
} else if (goog.object.contains(brackets, ch)) {
|
||||
if (expectedBrackets.pop() != ch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return expectedBrackets.length == 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new SafeStyleSheet object by concatenating values.
|
||||
* @param {...(!goog.html.SafeStyleSheet|!Array<!goog.html.SafeStyleSheet>)}
|
||||
|
@ -22,6 +22,7 @@ goog.provide('goog.html.SafeUrl');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.fs.url');
|
||||
goog.require('goog.html.TrustedResourceUrl');
|
||||
goog.require('goog.i18n.bidi.Dir');
|
||||
goog.require('goog.i18n.bidi.DirectionalString');
|
||||
goog.require('goog.string');
|
||||
@ -38,10 +39,11 @@ goog.require('goog.string.TypedString');
|
||||
* when evaluated as a hyperlink URL in a browser.
|
||||
*
|
||||
* Values of this type are guaranteed to be safe to use in URL/hyperlink
|
||||
* contexts, such as, assignment to URL-valued DOM properties, or
|
||||
* interpolation into a HTML template in URL context (e.g., inside a href
|
||||
* attribute), in the sense that the use will not result in a
|
||||
* Cross-Site-Scripting vulnerability.
|
||||
* contexts, such as assignment to URL-valued DOM properties, in the sense that
|
||||
* the use will not result in a Cross-Site-Scripting vulnerability. Similarly,
|
||||
* SafeUrls can be interpolated into the URL context of an HTML template (e.g.,
|
||||
* inside a href attribute). However, appropriate HTML-escaping must still be
|
||||
* applied.
|
||||
*
|
||||
* Note that, as documented in {@code goog.html.SafeUrl.unwrap}, this type's
|
||||
* contract does not guarantee that instances are safe to interpolate into HTML
|
||||
@ -79,7 +81,7 @@ goog.html.SafeUrl = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.SafeUrl#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
@ -241,21 +243,24 @@ goog.html.SafeUrl.fromConstant = function(url) {
|
||||
|
||||
/**
|
||||
* A pattern that matches Blob or data types that can have SafeUrls created
|
||||
* from URL.createObjectURL(blob) or via a data: URI. Only matches image and
|
||||
* video types, currently.
|
||||
* from URL.createObjectURL(blob) or via a data: URI.
|
||||
* @const
|
||||
* @private
|
||||
*/
|
||||
goog.html.SAFE_MIME_TYPE_PATTERN_ =
|
||||
/^(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm))$/i;
|
||||
goog.html.SAFE_MIME_TYPE_PATTERN_ = new RegExp(
|
||||
'^(?:audio/(?:3gpp|3gpp2|aac|midi|mp4|mpeg|ogg|x-m4a|x-wav|webm)|' +
|
||||
'image/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|' +
|
||||
'text/csv|' +
|
||||
'video/(?:mpeg|mp4|ogg|webm))$',
|
||||
'i');
|
||||
|
||||
|
||||
/**
|
||||
* Creates a SafeUrl wrapping a blob URL for the given {@code blob}.
|
||||
*
|
||||
* The blob URL is created with {@code URL.createObjectURL}. If the MIME type
|
||||
* for {@code blob} is not of a known safe image or video MIME type, then the
|
||||
* SafeUrl will wrap {@link #INNOCUOUS_STRING}.
|
||||
* for {@code blob} is not of a known safe audio, image or video MIME type,
|
||||
* then the SafeUrl will wrap {@link #INNOCUOUS_STRING}.
|
||||
*
|
||||
* @see http://www.w3.org/TR/FileAPI/#url
|
||||
* @param {!Blob} blob
|
||||
@ -280,10 +285,10 @@ goog.html.DATA_URL_PATTERN_ = /^data:([^;,]*);base64,[a-z0-9+\/]+=*$/i;
|
||||
|
||||
/**
|
||||
* Creates a SafeUrl wrapping a data: URL, after validating it matches a
|
||||
* known-safe image or video MIME type.
|
||||
* known-safe audio, image or video MIME type.
|
||||
*
|
||||
* @param {string} dataUrl A valid base64 data URL with one of the whitelisted
|
||||
* image or video MIME types.
|
||||
* audio, image or video MIME types.
|
||||
* @return {!goog.html.SafeUrl} A matching safe URL, or {@link INNOCUOUS_STRING}
|
||||
* wrapped as a SafeUrl if it does not pass.
|
||||
*/
|
||||
@ -319,6 +324,19 @@ goog.html.SafeUrl.fromTelUrl = function(telUrl) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a SafeUrl from TrustedResourceUrl. This is safe because
|
||||
* TrustedResourceUrl is more tightly restricted than SafeUrl.
|
||||
*
|
||||
* @param {!goog.html.TrustedResourceUrl} trustedResourceUrl
|
||||
* @return {!goog.html.SafeUrl}
|
||||
*/
|
||||
goog.html.SafeUrl.fromTrustedResourceUrl = function(trustedResourceUrl) {
|
||||
return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(
|
||||
goog.html.TrustedResourceUrl.unwrap(trustedResourceUrl));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A pattern that recognizes a commonly useful subset of URLs that satisfy
|
||||
* the SafeUrl contract.
|
||||
@ -336,19 +354,11 @@ goog.html.SafeUrl.fromTelUrl = function(telUrl) {
|
||||
* Otherwise, a colon after a double solidus (//) must be in the authority
|
||||
* (before port).
|
||||
*
|
||||
* The pattern disallows &, used in HTML entity declarations before
|
||||
* one of the characters in [/?#]. This disallows HTML entities used in the
|
||||
* protocol name, which should never happen, e.g. "http" for "http".
|
||||
* It also disallows HTML entities in the first path part of a relative path,
|
||||
* e.g. "foo<bar/baz". Our existing escaping functions should not produce
|
||||
* that. More importantly, it disallows masking of a colon,
|
||||
* e.g. "javascript:...".
|
||||
*
|
||||
* @private
|
||||
* @const {!RegExp}
|
||||
*/
|
||||
goog.html.SAFE_URL_PATTERN_ =
|
||||
/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i;
|
||||
/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;
|
||||
|
||||
|
||||
/**
|
||||
@ -378,6 +388,38 @@ goog.html.SafeUrl.sanitize = function(url) {
|
||||
return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a SafeUrl object from {@code url}. If {@code url} is a
|
||||
* goog.html.SafeUrl then it is simply returned. Otherwise the input string is
|
||||
* validated to match a pattern of commonly used safe URLs.
|
||||
*
|
||||
* {@code url} may be a URL with the http, https, mailto or ftp scheme,
|
||||
* or a relative URL (i.e., a URL without a scheme; specifically, a
|
||||
* scheme-relative, absolute-path-relative, or path-relative URL).
|
||||
*
|
||||
* This function asserts (using goog.asserts) that the URL matches this pattern.
|
||||
* If it does not, in addition to failing the assert, an innocous URL will be
|
||||
* returned.
|
||||
*
|
||||
* @see http://url.spec.whatwg.org/#concept-relative-url
|
||||
* @param {string|!goog.string.TypedString} url The URL to validate.
|
||||
* @return {!goog.html.SafeUrl} The validated URL, wrapped as a SafeUrl.
|
||||
*/
|
||||
goog.html.SafeUrl.sanitizeAssertUnchanged = function(url) {
|
||||
if (url instanceof goog.html.SafeUrl) {
|
||||
return url;
|
||||
} else if (url.implementsGoogStringTypedString) {
|
||||
url = url.getTypedStringValue();
|
||||
} else {
|
||||
url = String(url);
|
||||
}
|
||||
if (!goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(url))) {
|
||||
url = goog.html.SafeUrl.INNOCUOUS_STRING;
|
||||
}
|
||||
return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Type marker for the SafeUrl type, used to implement additional run-time
|
||||
|
@ -40,10 +40,11 @@ goog.require('goog.string.TypedString');
|
||||
* this type.
|
||||
*
|
||||
* Instances of this type must be created via the factory method,
|
||||
* ({@code goog.html.TrustedResourceUrl.fromConstant}), and not by invoking its
|
||||
* constructor. The constructor intentionally takes no parameters and the type
|
||||
* is immutable; hence only a default instance corresponding to the empty
|
||||
* string can be obtained via constructor invocation.
|
||||
* ({@code fromConstant}, {@code fromConstants}, {@code format} or {@code
|
||||
* formatWithParams}), and not by invoking its constructor. The constructor
|
||||
* intentionally takes no parameters and the type is immutable; hence only a
|
||||
* default instance corresponding to the empty string can be obtained via
|
||||
* constructor invocation.
|
||||
*
|
||||
* @see goog.html.TrustedResourceUrl#fromConstant
|
||||
* @constructor
|
||||
@ -64,7 +65,7 @@ goog.html.TrustedResourceUrl = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.html.TrustedResourceUrl#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =
|
||||
@ -178,6 +179,169 @@ goog.html.TrustedResourceUrl.unwrap = function(trustedResourceUrl) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a TrustedResourceUrl from a format string and arguments.
|
||||
*
|
||||
* The arguments for interpolation into the format string map labels to values.
|
||||
* Values of type `goog.string.Const` are interpolated without modifcation.
|
||||
* Values of other types are cast to string and encoded with
|
||||
* encodeURIComponent.
|
||||
*
|
||||
* `%{<label>}` markers are used in the format string to indicate locations
|
||||
* to be interpolated with the valued mapped to the given label. `<label>`
|
||||
* must contain only alphanumeric and `_` characters.
|
||||
*
|
||||
* The format string must start with one of the following:
|
||||
* - `https://<origin>/`
|
||||
* - `//<origin>/`
|
||||
* - `/<pathStart>`
|
||||
* - `about:blank`
|
||||
*
|
||||
* `<origin>` must contain only alphanumeric or any of the following: `-.:[]`.
|
||||
* `<pathStart>` is any character except `/` and `\`.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* var url = goog.html.TrustedResourceUrl.format(goog.string.Const.from(
|
||||
* 'https://www.google.com/search?q=%{query}), {'query': searchTerm});
|
||||
*
|
||||
* var url = goog.html.TrustedResourceUrl.format(goog.string.Const.from(
|
||||
* '//www.youtube.com/v/%{videoId}?hl=en&fs=1%{autoplay}'), {
|
||||
* 'videoId': videoId,
|
||||
* 'autoplay': opt_autoplay ?
|
||||
* goog.string.Const.EMPTY : goog.string.Const.from('&autoplay=1')
|
||||
* });
|
||||
*
|
||||
* While this function can be used to create a TrustedResourceUrl from only
|
||||
* constants, fromConstant() and fromConstants() are generally preferable for
|
||||
* that purpose.
|
||||
*
|
||||
* @param {!goog.string.Const} format The format string.
|
||||
* @param {!Object<string, (string|number|!goog.string.Const)>} args Mapping
|
||||
* of labels to values to be interpolated into the format string.
|
||||
* goog.string.Const values are interpolated without encoding.
|
||||
* @return {!goog.html.TrustedResourceUrl}
|
||||
* @throws {!Error} On an invalid format string or if a label used in the
|
||||
* the format string is not present in args.
|
||||
*/
|
||||
goog.html.TrustedResourceUrl.format = function(format, args) {
|
||||
var result = goog.html.TrustedResourceUrl.format_(format, args);
|
||||
return goog.html.TrustedResourceUrl
|
||||
.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(result);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* String version of TrustedResourceUrl.format.
|
||||
* @param {!goog.string.Const} format
|
||||
* @param {!Object<string, (string|number|!goog.string.Const)>} args
|
||||
* @return {string}
|
||||
* @throws {!Error}
|
||||
* @private
|
||||
*/
|
||||
goog.html.TrustedResourceUrl.format_ = function(format, args) {
|
||||
var formatStr = goog.string.Const.unwrap(format);
|
||||
if (!goog.html.TrustedResourceUrl.BASE_URL_.test(formatStr)) {
|
||||
throw new Error('Invalid TrustedResourceUrl format: ' + formatStr);
|
||||
}
|
||||
return formatStr.replace(
|
||||
goog.html.TrustedResourceUrl.FORMAT_MARKER_, function(match, id) {
|
||||
if (!Object.prototype.hasOwnProperty.call(args, id)) {
|
||||
throw new Error(
|
||||
'Found marker, "' + id + '", in format string, "' + formatStr +
|
||||
'", but no valid label mapping found ' +
|
||||
'in args: ' + JSON.stringify(args));
|
||||
}
|
||||
var arg = args[id];
|
||||
if (arg instanceof goog.string.Const) {
|
||||
return goog.string.Const.unwrap(arg);
|
||||
} else {
|
||||
return encodeURIComponent(String(arg));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private @const {!RegExp}
|
||||
*/
|
||||
goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g;
|
||||
|
||||
|
||||
/**
|
||||
* The URL must be absolute, scheme-relative or path-absolute. So it must
|
||||
* start with:
|
||||
* - https:// followed by allowed origin characters.
|
||||
* - // followed by allowed origin characters.
|
||||
* - / not followed by / or \. There will only be an absolute path.
|
||||
*
|
||||
* Based on
|
||||
* https://url.spec.whatwg.org/commit-snapshots/56b74ce7cca8883eab62e9a12666e2fac665d03d/#url-parsing
|
||||
* an initial / which is not followed by another / or \ will end up in the "path
|
||||
* state" and from there it can only go to "fragment state" and "query state".
|
||||
*
|
||||
* We don't enforce a well-formed domain name. So '.' or '1.2' are valid.
|
||||
* That's ok because the origin comes from a compile-time constant.
|
||||
*
|
||||
* A regular expression is used instead of goog.uri for several reasons:
|
||||
* - Strictness. E.g. we don't want any userinfo component and we don't
|
||||
* want '/./, nor \' in the first path component.
|
||||
* - Small trusted base. goog.uri is generic and might need to change,
|
||||
* reasoning about all the ways it can parse a URL now and in the future
|
||||
* is error-prone.
|
||||
* - Code size. We expect many calls to .format(), many of which might
|
||||
* not be using goog.uri.
|
||||
* - Simplicity. Using goog.uri would likely not result in simpler nor shorter
|
||||
* code.
|
||||
* @private @const {!RegExp}
|
||||
*/
|
||||
goog.html.TrustedResourceUrl.BASE_URL_ =
|
||||
/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank(#|$)/i;
|
||||
|
||||
|
||||
/**
|
||||
* Formats the URL same as TrustedResourceUrl.format and then adds extra URL
|
||||
* parameters.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* // Creates '//www.youtube.com/v/abc?autoplay=1' for videoId='abc' and
|
||||
* // opt_autoplay=1. Creates '//www.youtube.com/v/abc' for videoId='abc'
|
||||
* // and opt_autoplay=undefined.
|
||||
* var url = goog.html.TrustedResourceUrl.formatWithParams(
|
||||
* goog.string.Const.from('//www.youtube.com/v/%{videoId}'),
|
||||
* {'videoId': videoId},
|
||||
* {'autoplay': opt_autoplay});
|
||||
*
|
||||
* @param {!goog.string.Const} format The format string.
|
||||
* @param {!Object<string, (string|number|!goog.string.Const)>} args Mapping
|
||||
* of labels to values to be interpolated into the format string.
|
||||
* goog.string.Const values are interpolated without encoding.
|
||||
* @param {!Object<string, *>} params Parameters to add to URL. Parameters with
|
||||
* value {@code null} or {@code undefined} are skipped. Both keys and values
|
||||
* are encoded. Note that JavaScript doesn't guarantee the order of values
|
||||
* in an object which might result in non-deterministic order of the
|
||||
* parameters. However, browsers currently preserve the order.
|
||||
* @return {!goog.html.TrustedResourceUrl}
|
||||
* @throws {!Error} On an invalid format string or if a label used in the
|
||||
* the format string is not present in args.
|
||||
*/
|
||||
goog.html.TrustedResourceUrl.formatWithParams = function(format, args, params) {
|
||||
var url = goog.html.TrustedResourceUrl.format_(format, args);
|
||||
var separator = /\?/.test(url) ? '&' : '?';
|
||||
for (var key in params) {
|
||||
if (params[key] == null) {
|
||||
continue;
|
||||
}
|
||||
url += separator + encodeURIComponent(key) + '=' +
|
||||
encodeURIComponent(String(params[key]));
|
||||
separator = '&';
|
||||
}
|
||||
return goog.html.TrustedResourceUrl
|
||||
.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a TrustedResourceUrl object from a compile-time constant string.
|
||||
*
|
||||
|
@ -62,10 +62,6 @@ goog.require('goog.string.Const');
|
||||
* unknown directionality.
|
||||
* @return {!goog.html.SafeHtml} The value of html, wrapped in a SafeHtml
|
||||
* object.
|
||||
* @suppress {visibility} For access to SafeHtml.create... Note that this
|
||||
* use is appropriate since this method is intended to be "package private"
|
||||
* within goog.html. DO NOT call SafeHtml.create... from outside this
|
||||
* package; use appropriate wrappers instead.
|
||||
*/
|
||||
goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract =
|
||||
function(justification, html, opt_dir) {
|
||||
@ -104,7 +100,7 @@ goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract =
|
||||
goog.asserts.assertString(
|
||||
goog.string.Const.unwrap(justification), 'must provide justification');
|
||||
goog.asserts.assert(
|
||||
!goog.string.isEmpty(goog.string.Const.unwrap(justification)),
|
||||
!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)),
|
||||
'must provide non-empty justification');
|
||||
return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(
|
||||
script);
|
||||
@ -116,7 +112,7 @@ goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract =
|
||||
* known to satisfy the SafeStyle type contract.
|
||||
*
|
||||
* IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
|
||||
* that the value of {@code style} satisfies the SafeUrl type contract in all
|
||||
* that the value of {@code style} satisfies the SafeStyle type contract in all
|
||||
* possible program states.
|
||||
*
|
||||
*
|
||||
@ -146,8 +142,8 @@ goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract =
|
||||
* that is known to satisfy the SafeStyleSheet type contract.
|
||||
*
|
||||
* IMPORTANT: Uses of this method must be carefully security-reviewed to ensure
|
||||
* that the value of {@code styleSheet} satisfies the SafeUrl type contract in
|
||||
* all possible program states.
|
||||
* that the value of {@code styleSheet} satisfies the SafeStyleSheet type
|
||||
* contract in all possible program states.
|
||||
*
|
||||
*
|
||||
* @param {!goog.string.Const} justification A constant string explaining why
|
||||
|
1284
assets/viz/2/goog/iter/iter.js
Normal file
1284
assets/viz/2/goog/iter/iter.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -86,8 +86,7 @@ goog.labs.userAgent.util.getUserAgent = function() {
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {boolean} Whether the user agent contains the given string, ignoring
|
||||
* case.
|
||||
* @return {boolean} Whether the user agent contains the given string.
|
||||
*/
|
||||
goog.labs.userAgent.util.matchUserAgent = function(str) {
|
||||
var userAgent = goog.labs.userAgent.util.getUserAgent();
|
||||
@ -97,7 +96,8 @@ goog.labs.userAgent.util.matchUserAgent = function(str) {
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {boolean} Whether the user agent contains the given string.
|
||||
* @return {boolean} Whether the user agent contains the given string, ignoring
|
||||
* case.
|
||||
*/
|
||||
goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) {
|
||||
var userAgent = goog.labs.userAgent.util.getUserAgent();
|
||||
|
@ -66,6 +66,17 @@ if (goog.DEBUG) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the specified value is equal to this coordinate.
|
||||
* @param {*} other Some other value.
|
||||
* @return {boolean} Whether the specified value is equal to this coordinate.
|
||||
*/
|
||||
goog.math.Coordinate.prototype.equals = function(other) {
|
||||
return other instanceof goog.math.Coordinate &&
|
||||
goog.math.Coordinate.equals(this, other);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Compares coordinates for equality.
|
||||
* @param {goog.math.Coordinate} a A Coordinate.
|
||||
|
@ -566,6 +566,7 @@ goog.math.Integer.carry16_ = function(bits, index) {
|
||||
while ((bits[index] & 0xFFFF) != bits[index]) {
|
||||
bits[index + 1] += bits[index] >>> 16;
|
||||
bits[index] &= 0xFFFF;
|
||||
index++;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
goog.provide('goog.math.Long');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.reflect');
|
||||
|
||||
|
||||
@ -84,6 +85,109 @@ goog.math.Long.IntCache_ = {};
|
||||
*/
|
||||
goog.math.Long.valueCache_ = {};
|
||||
|
||||
/**
|
||||
* Returns a cached long number representing the given (32-bit) integer value.
|
||||
* @param {number} value The 32-bit integer in question.
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
* @private
|
||||
*/
|
||||
goog.math.Long.getCachedIntValue_ = function(value) {
|
||||
return goog.reflect.cache(goog.math.Long.IntCache_, value, function(val) {
|
||||
return new goog.math.Long(val, val < 0 ? -1 : 0);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* The array of maximum values of a Long in string representation for a given
|
||||
* radix between 2 and 36, inclusive.
|
||||
* @private @const {!Array<string>}
|
||||
*/
|
||||
goog.math.Long.MAX_VALUE_FOR_RADIX_ = [
|
||||
'', '', // unused
|
||||
'111111111111111111111111111111111111111111111111111111111111111',
|
||||
// base 2
|
||||
'2021110011022210012102010021220101220221', // base 3
|
||||
'13333333333333333333333333333333', // base 4
|
||||
'1104332401304422434310311212', // base 5
|
||||
'1540241003031030222122211', // base 6
|
||||
'22341010611245052052300', // base 7
|
||||
'777777777777777777777', // base 8
|
||||
'67404283172107811827', // base 9
|
||||
'9223372036854775807', // base 10
|
||||
'1728002635214590697', // base 11
|
||||
'41a792678515120367', // base 12
|
||||
'10b269549075433c37', // base 13
|
||||
'4340724c6c71dc7a7', // base 14
|
||||
'160e2ad3246366807', // base 15
|
||||
'7fffffffffffffff', // base 16
|
||||
'33d3d8307b214008', // base 17
|
||||
'16agh595df825fa7', // base 18
|
||||
'ba643dci0ffeehh', // base 19
|
||||
'5cbfjia3fh26ja7', // base 20
|
||||
'2heiciiie82dh97', // base 21
|
||||
'1adaibb21dckfa7', // base 22
|
||||
'i6k448cf4192c2', // base 23
|
||||
'acd772jnc9l0l7', // base 24
|
||||
'64ie1focnn5g77', // base 25
|
||||
'3igoecjbmca687', // base 26
|
||||
'27c48l5b37oaop', // base 27
|
||||
'1bk39f3ah3dmq7', // base 28
|
||||
'q1se8f0m04isb', // base 29
|
||||
'hajppbc1fc207', // base 30
|
||||
'bm03i95hia437', // base 31
|
||||
'7vvvvvvvvvvvv', // base 32
|
||||
'5hg4ck9jd4u37', // base 33
|
||||
'3tdtk1v8j6tpp', // base 34
|
||||
'2pijmikexrxp7', // base 35
|
||||
'1y2p0ij32e8e7' // base 36
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* The array of minimum values of a Long in string representation for a given
|
||||
* radix between 2 and 36, inclusive.
|
||||
* @private @const {!Array<string>}
|
||||
*/
|
||||
goog.math.Long.MIN_VALUE_FOR_RADIX_ = [
|
||||
'', '', // unused
|
||||
'-1000000000000000000000000000000000000000000000000000000000000000',
|
||||
// base 2
|
||||
'-2021110011022210012102010021220101220222', // base 3
|
||||
'-20000000000000000000000000000000', // base 4
|
||||
'-1104332401304422434310311213', // base 5
|
||||
'-1540241003031030222122212', // base 6
|
||||
'-22341010611245052052301', // base 7
|
||||
'-1000000000000000000000', // base 8
|
||||
'-67404283172107811828', // base 9
|
||||
'-9223372036854775808', // base 10
|
||||
'-1728002635214590698', // base 11
|
||||
'-41a792678515120368', // base 12
|
||||
'-10b269549075433c38', // base 13
|
||||
'-4340724c6c71dc7a8', // base 14
|
||||
'-160e2ad3246366808', // base 15
|
||||
'-8000000000000000', // base 16
|
||||
'-33d3d8307b214009', // base 17
|
||||
'-16agh595df825fa8', // base 18
|
||||
'-ba643dci0ffeehi', // base 19
|
||||
'-5cbfjia3fh26ja8', // base 20
|
||||
'-2heiciiie82dh98', // base 21
|
||||
'-1adaibb21dckfa8', // base 22
|
||||
'-i6k448cf4192c3', // base 23
|
||||
'-acd772jnc9l0l8', // base 24
|
||||
'-64ie1focnn5g78', // base 25
|
||||
'-3igoecjbmca688', // base 26
|
||||
'-27c48l5b37oaoq', // base 27
|
||||
'-1bk39f3ah3dmq8', // base 28
|
||||
'-q1se8f0m04isc', // base 29
|
||||
'-hajppbc1fc208', // base 30
|
||||
'-bm03i95hia438', // base 31
|
||||
'-8000000000000', // base 32
|
||||
'-5hg4ck9jd4u38', // base 33
|
||||
'-3tdtk1v8j6tpq', // base 34
|
||||
'-2pijmikexrxp8', // base 35
|
||||
'-1y2p0ij32e8e8' // base 36
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given (32-bit) integer value.
|
||||
@ -91,12 +195,13 @@ goog.math.Long.valueCache_ = {};
|
||||
* @return {!goog.math.Long} The corresponding Long value.
|
||||
*/
|
||||
goog.math.Long.fromInt = function(value) {
|
||||
if (-128 <= value && value < 128) {
|
||||
return goog.reflect.cache(goog.math.Long.IntCache_, value, function(val) {
|
||||
return new goog.math.Long(val | 0, val < 0 ? -1 : 0);
|
||||
});
|
||||
var intValue = value | 0;
|
||||
goog.asserts.assert(value === intValue, 'value should be a 32-bit integer');
|
||||
|
||||
if (-128 <= intValue && intValue < 128) {
|
||||
return goog.math.Long.getCachedIntValue_(intValue);
|
||||
} else {
|
||||
return new goog.math.Long(value | 0, value < 0 ? -1 : 0);
|
||||
return new goog.math.Long(intValue, intValue < 0 ? -1 : 0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -179,6 +284,32 @@ goog.math.Long.fromString = function(str, opt_radix) {
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the boolean value of whether the input string is within a Long's
|
||||
* range. Assumes an input string containing only numeric characters with an
|
||||
* optional preceding '-'.
|
||||
* @param {string} str The textual representation of the Long.
|
||||
* @param {number=} opt_radix The radix in which the text is written.
|
||||
* @return {boolean} Whether the string is within the range of a Long.
|
||||
*/
|
||||
goog.math.Long.isStringInRange = function(str, opt_radix) {
|
||||
var radix = opt_radix || 10;
|
||||
if (radix < 2 || 36 < radix) {
|
||||
throw Error('radix out of range: ' + radix);
|
||||
}
|
||||
|
||||
var extremeValue = (str.charAt(0) == '-') ?
|
||||
goog.math.Long.MIN_VALUE_FOR_RADIX_[radix] :
|
||||
goog.math.Long.MAX_VALUE_FOR_RADIX_[radix];
|
||||
|
||||
if (str.length < extremeValue.length) {
|
||||
return true;
|
||||
} else if (str.length == extremeValue.length && str <= extremeValue) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: the compiler should inline these constant values below and then remove
|
||||
// these variables, so there should be no runtime penalty for these.
|
||||
@ -221,9 +352,7 @@ goog.math.Long.TWO_PWR_63_DBL_ = goog.math.Long.TWO_PWR_64_DBL_ / 2;
|
||||
* @public
|
||||
*/
|
||||
goog.math.Long.getZero = function() {
|
||||
return goog.reflect.cache(
|
||||
goog.math.Long.valueCache_, goog.math.Long.ValueCacheId_.ZERO,
|
||||
function() { return goog.math.Long.fromInt(0); });
|
||||
return goog.math.Long.getCachedIntValue_(0);
|
||||
};
|
||||
|
||||
|
||||
@ -232,9 +361,7 @@ goog.math.Long.getZero = function() {
|
||||
* @public
|
||||
*/
|
||||
goog.math.Long.getOne = function() {
|
||||
return goog.reflect.cache(
|
||||
goog.math.Long.valueCache_, goog.math.Long.ValueCacheId_.ONE,
|
||||
function() { return goog.math.Long.fromInt(1); });
|
||||
return goog.math.Long.getCachedIntValue_(1);
|
||||
};
|
||||
|
||||
|
||||
@ -243,9 +370,7 @@ goog.math.Long.getOne = function() {
|
||||
* @public
|
||||
*/
|
||||
goog.math.Long.getNegOne = function() {
|
||||
return goog.reflect.cache(
|
||||
goog.math.Long.valueCache_, goog.math.Long.ValueCacheId_.NEG_ONE,
|
||||
function() { return goog.math.Long.fromInt(-1); });
|
||||
return goog.math.Long.getCachedIntValue_(-1);
|
||||
};
|
||||
|
||||
|
||||
@ -836,8 +961,5 @@ goog.math.Long.prototype.shiftRightUnsigned = function(numBits) {
|
||||
goog.math.Long.ValueCacheId_ = {
|
||||
MAX_VALUE: 1,
|
||||
MIN_VALUE: 2,
|
||||
ZERO: 3,
|
||||
ONE: 4,
|
||||
NEG_ONE: 5,
|
||||
TWO_PWR_24: 6
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ goog.math.angleDifference = function(startAngle, endAngle) {
|
||||
* @return {number} -1 when negative, 1 when positive, 0 when 0. Preserves
|
||||
* signed zeros and NaN.
|
||||
*/
|
||||
goog.math.sign = Math.sign || function(x) {
|
||||
goog.math.sign = function(x) {
|
||||
if (x > 0) {
|
||||
return 1;
|
||||
}
|
||||
@ -379,9 +379,10 @@ goog.math.isInt = function(num) {
|
||||
* Returns whether the supplied number is finite and not NaN.
|
||||
* @param {number} num The number to test.
|
||||
* @return {boolean} Whether {@code num} is a finite number.
|
||||
* @deprecated Use {@link isFinite} instead.
|
||||
*/
|
||||
goog.math.isFiniteNumber = function(num) {
|
||||
return isFinite(num) && !isNaN(num);
|
||||
return isFinite(num);
|
||||
};
|
||||
|
||||
|
||||
|
@ -537,8 +537,9 @@ goog.object.clone = function(obj) {
|
||||
* <code>goog.object.unsafeClone</code> is unaware of unique identifiers, and
|
||||
* copies UIDs created by <code>getUid</code> into cloned results.
|
||||
*
|
||||
* @param {*} obj The value to clone.
|
||||
* @return {*} A clone of the input value.
|
||||
* @param {T} obj The value to clone.
|
||||
* @return {T} A clone of the input value.
|
||||
* @template T
|
||||
*/
|
||||
goog.object.unsafeClone = function(obj) {
|
||||
var type = goog.typeOf(obj);
|
||||
@ -628,7 +629,7 @@ goog.object.extend = function(target, var_args) {
|
||||
/**
|
||||
* Creates a new object built from the key-value pairs provided as arguments.
|
||||
* @param {...*} var_args If only one argument is provided and it is an array
|
||||
* then this is used as the arguments, otherwise even arguments are used as
|
||||
* then this is used as the arguments, otherwise even arguments are used as
|
||||
* the property names and odd arguments are used as the property values.
|
||||
* @return {!Object} The new object.
|
||||
* @throws {Error} If there are uneven number of arguments or there is only one
|
||||
@ -656,7 +657,7 @@ goog.object.create = function(var_args) {
|
||||
* Creates a new object where the property names come from the arguments but
|
||||
* the value is always set to true
|
||||
* @param {...*} var_args If only one argument is provided and it is an array
|
||||
* then this is used as the arguments, otherwise the arguments are used
|
||||
* then this is used as the arguments, otherwise the arguments are used
|
||||
* as the property names.
|
||||
* @return {!Object} The new object.
|
||||
*/
|
||||
@ -703,3 +704,48 @@ goog.object.createImmutableView = function(obj) {
|
||||
goog.object.isImmutableView = function(obj) {
|
||||
return !!Object.isFrozen && Object.isFrozen(obj);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get all properties names on a given Object regardless of enumerability.
|
||||
*
|
||||
* <p> If the browser does not support {@code Object.getOwnPropertyNames} nor
|
||||
* {@code Object.getPrototypeOf} then this is equivalent to using {@code
|
||||
* goog.object.getKeys}
|
||||
*
|
||||
* @param {?Object} obj The object to get the properties of.
|
||||
* @param {boolean=} opt_includeObjectPrototype Whether properties defined on
|
||||
* {@code Object.prototype} should be included in the result.
|
||||
* @param {boolean=} opt_includeFunctionPrototype Whether properties defined on
|
||||
* {@code Function.prototype} should be included in the result.
|
||||
* @return {!Array<string>}
|
||||
* @public
|
||||
*/
|
||||
goog.object.getAllPropertyNames = function(
|
||||
obj, opt_includeObjectPrototype, opt_includeFunctionPrototype) {
|
||||
if (!obj) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Naively use a for..in loop to get the property names if the browser doesn't
|
||||
// support any other APIs for getting it.
|
||||
if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
|
||||
return goog.object.getKeys(obj);
|
||||
}
|
||||
|
||||
var visitedSet = {};
|
||||
|
||||
// Traverse the prototype chain and add all properties to the visited set.
|
||||
var proto = obj;
|
||||
while (proto &&
|
||||
(proto !== Object.prototype || !!opt_includeObjectPrototype) &&
|
||||
(proto !== Function.prototype || !!opt_includeFunctionPrototype)) {
|
||||
var names = Object.getOwnPropertyNames(proto);
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
visitedSet[names[i]] = true;
|
||||
}
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return goog.object.getKeys(visitedSet);
|
||||
};
|
||||
|
@ -89,7 +89,7 @@ goog.reflect.sinkValue[' '] = goog.nullFunction;
|
||||
* if obj is null.
|
||||
*/
|
||||
goog.reflect.canAccessProperty = function(obj, prop) {
|
||||
/** @preserveTry */
|
||||
|
||||
try {
|
||||
goog.reflect.sinkValue(obj[prop]);
|
||||
return true;
|
||||
@ -110,13 +110,13 @@ goog.reflect.canAccessProperty = function(obj, prop) {
|
||||
* the value was never used, it would still always be stored in the cache.
|
||||
*
|
||||
* Providing a side-effect free {@code valueFn} and {@code opt_keyFn}
|
||||
* allows unused calls to {@code goog.cache} to be pruned.
|
||||
* allows unused calls to {@code goog.reflect.cache} to be pruned.
|
||||
*
|
||||
* @param {!Object<K, V>} cacheObj The object that contains the cached values.
|
||||
* @param {?} key The key to lookup in the cache. If it is not string or number
|
||||
* then a {@code opt_keyFn} should be provided. The key is also used as the
|
||||
* parameter to the {@code valueFn}.
|
||||
* @param {!function(?):V} valueFn The value provider to use to calculate the
|
||||
* @param {function(?):V} valueFn The value provider to use to calculate the
|
||||
* value to store in the cache. This function should be side-effect free
|
||||
* to take advantage of the optimization.
|
||||
* @param {function(?):K=} opt_keyFn The key provider to determine the cache
|
||||
|
@ -56,7 +56,7 @@ goog.string.Const = function() {
|
||||
/**
|
||||
* A type marker used to implement additional run-time type checking.
|
||||
* @see goog.string.Const#unwrap
|
||||
* @const
|
||||
* @const {!Object}
|
||||
* @private
|
||||
*/
|
||||
this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ =
|
||||
@ -148,9 +148,6 @@ goog.string.Const.unwrap = function(stringConst) {
|
||||
* var t = goog.string.Const.from('hello' + world);
|
||||
* </pre>
|
||||
*
|
||||
* TODO(xtof): Compile-time checks that this function is only called
|
||||
* with compile-time constant expressions.
|
||||
*
|
||||
* @param {string} s A constant string from which to create a Const.
|
||||
* @return {!goog.string.Const} A Const object initialized to stringConst.
|
||||
*/
|
||||
@ -180,3 +177,10 @@ goog.string.Const.create__googStringSecurityPrivate_ = function(s) {
|
||||
s;
|
||||
return stringConst;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A Const instance wrapping the empty string.
|
||||
* @const {!goog.string.Const}
|
||||
*/
|
||||
goog.string.Const.EMPTY = goog.string.Const.from('');
|
||||
|
@ -91,9 +91,9 @@ goog.string.caseInsensitiveStartsWith = function(str, prefix) {
|
||||
* case).
|
||||
*/
|
||||
goog.string.caseInsensitiveEndsWith = function(str, suffix) {
|
||||
return goog.string.caseInsensitiveCompare(
|
||||
suffix, str.substr(str.length - suffix.length, suffix.length)) ==
|
||||
0;
|
||||
return (
|
||||
goog.string.caseInsensitiveCompare(
|
||||
suffix, str.substr(str.length - suffix.length, suffix.length)) == 0);
|
||||
};
|
||||
|
||||
|
||||
@ -175,11 +175,9 @@ goog.string.isEmptyString = function(str) {
|
||||
/**
|
||||
* Checks if a string is empty or contains only whitespaces.
|
||||
*
|
||||
* TODO(user): Deprecate this when clients have been switched over to
|
||||
* goog.string.isEmptyOrWhitespace.
|
||||
*
|
||||
* @param {string} str The string to check.
|
||||
* @return {boolean} Whether {@code str} is empty or whitespace only.
|
||||
* @deprecated Use goog.string.isEmptyOrWhitespace instead.
|
||||
*/
|
||||
goog.string.isEmpty = goog.string.isEmptyOrWhitespace;
|
||||
|
||||
@ -200,12 +198,10 @@ goog.string.isEmptyOrWhitespaceSafe = function(str) {
|
||||
/**
|
||||
* Checks if a string is null, undefined, empty or contains only whitespaces.
|
||||
*
|
||||
* TODO(user): Deprecate this when clients have been switched over to
|
||||
* goog.string.isEmptyOrWhitespaceSafe.
|
||||
*
|
||||
* @param {*} str The string to check.
|
||||
* @return {boolean} Whether {@code str} is null, undefined, empty, or
|
||||
* whitespace only.
|
||||
* @deprecated Use goog.string.isEmptyOrWhitespace instead.
|
||||
*/
|
||||
goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;
|
||||
|
||||
@ -998,7 +994,7 @@ goog.string.quote = function(s) {
|
||||
|
||||
|
||||
/**
|
||||
* Takes a string and returns the escaped string for that character.
|
||||
* Takes a string and returns the escaped string for that input string.
|
||||
* @param {string} str The string to escape.
|
||||
* @return {string} An escaped string representing {@code str}.
|
||||
*/
|
||||
@ -1105,15 +1101,14 @@ goog.string.removeAt = function(s, index, stringLength) {
|
||||
|
||||
|
||||
/**
|
||||
* Removes the first occurrence of a substring from a string.
|
||||
* @param {string} s The base string from which to remove.
|
||||
* @param {string} ss The string to remove.
|
||||
* @return {string} A copy of {@code s} with {@code ss} removed or the full
|
||||
* string if nothing is removed.
|
||||
* Removes the first occurrence of a substring from a string.
|
||||
* @param {string} str The base string from which to remove.
|
||||
* @param {string} substr The string to remove.
|
||||
* @return {string} A copy of {@code str} with {@code substr} removed or the
|
||||
* full string if nothing is removed.
|
||||
*/
|
||||
goog.string.remove = function(s, ss) {
|
||||
var re = new RegExp(goog.string.regExpEscape(ss), '');
|
||||
return s.replace(re, '');
|
||||
goog.string.remove = function(str, substr) {
|
||||
return str.replace(substr, '');
|
||||
};
|
||||
|
||||
|
||||
@ -1130,6 +1125,20 @@ goog.string.removeAll = function(s, ss) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Replaces all occurrences of a substring of a string with a new substring.
|
||||
* @param {string} s The base string from which to remove.
|
||||
* @param {string} ss The string to replace.
|
||||
* @param {string} replacement The replacement string.
|
||||
* @return {string} A copy of {@code s} with {@code ss} replaced by
|
||||
* {@code replacement} or the original string if nothing is replaced.
|
||||
*/
|
||||
goog.string.replaceAll = function(s, ss, replacement) {
|
||||
var re = new RegExp(goog.string.regExpEscape(ss), 'g');
|
||||
return s.replace(re, replacement.replace(/\$/g, '$$$$'));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Escapes characters in the string that are not safe to use in a RegExp.
|
||||
* @param {*} s The string to escape. If not a string, it will be casted
|
||||
@ -1251,14 +1260,12 @@ goog.string.compareVersions = function(version1, version2) {
|
||||
var v1Sub = v1Subs[subIdx] || '';
|
||||
var v2Sub = v2Subs[subIdx] || '';
|
||||
|
||||
// Split the subversions into pairs of numbers and qualifiers (like 'b').
|
||||
// Two different RegExp objects are needed because they are both using
|
||||
// the 'g' flag.
|
||||
var v1CompParser = new RegExp('(\\d*)(\\D*)', 'g');
|
||||
var v2CompParser = new RegExp('(\\d*)(\\D*)', 'g');
|
||||
do {
|
||||
var v1Comp = v1CompParser.exec(v1Sub) || ['', '', ''];
|
||||
var v2Comp = v2CompParser.exec(v2Sub) || ['', '', ''];
|
||||
// Split the subversions into pairs of numbers and qualifiers (like 'b').
|
||||
// Two different RegExp objects are use to make it clear the code
|
||||
// is side-effect free
|
||||
var v1Comp = /(\d*)(\D*)(.*)/.exec(v1Sub) || ['', '', '', ''];
|
||||
var v2Comp = /(\d*)(\D*)(.*)/.exec(v2Sub) || ['', '', '', ''];
|
||||
// Break if there are no more matches.
|
||||
if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {
|
||||
break;
|
||||
@ -1278,6 +1285,9 @@ goog.string.compareVersions = function(version1, version2) {
|
||||
v1Comp[2].length == 0, v2Comp[2].length == 0) ||
|
||||
goog.string.compareElements_(v1Comp[2], v2Comp[2]);
|
||||
// Stop as soon as an inequality is discovered.
|
||||
|
||||
v1Sub = v1Comp[3];
|
||||
v2Sub = v2Comp[3];
|
||||
} while (order == 0);
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,6 @@ goog.string.TypedString.prototype.implementsGoogStringTypedString;
|
||||
|
||||
/**
|
||||
* Retrieves this wrapped string's value.
|
||||
* @return {!string} The wrapped string's value.
|
||||
* @return {string} The wrapped string's value.
|
||||
*/
|
||||
goog.string.TypedString.prototype.getTypedStringValue;
|
||||
|
458
assets/viz/2/goog/structs/map.js
Normal file
458
assets/viz/2/goog/structs/map.js
Normal file
@ -0,0 +1,458 @@
|
||||
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Datastructure: Hash Map.
|
||||
*
|
||||
* @author arv@google.com (Erik Arvidsson)
|
||||
*
|
||||
* This file contains an implementation of a Map structure. It implements a lot
|
||||
* of the methods used in goog.structs so those functions work on hashes. This
|
||||
* is best suited for complex key types. For simple keys such as numbers and
|
||||
* strings consider using the lighter-weight utilities in goog.object.
|
||||
*/
|
||||
|
||||
|
||||
goog.provide('goog.structs.Map');
|
||||
|
||||
goog.require('goog.iter.Iterator');
|
||||
goog.require('goog.iter.StopIteration');
|
||||
goog.require('goog.object');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class for Hash Map datastructure.
|
||||
* @param {*=} opt_map Map or Object to initialize the map with.
|
||||
* @param {...*} var_args If 2 or more arguments are present then they
|
||||
* will be used as key-value pairs.
|
||||
* @constructor
|
||||
* @template K, V
|
||||
* @deprecated This type is misleading: use ES6 Map instead.
|
||||
*/
|
||||
goog.structs.Map = function(opt_map, var_args) {
|
||||
|
||||
/**
|
||||
* Underlying JS object used to implement the map.
|
||||
* @private {!Object}
|
||||
*/
|
||||
this.map_ = {};
|
||||
|
||||
/**
|
||||
* An array of keys. This is necessary for two reasons:
|
||||
* 1. Iterating the keys using for (var key in this.map_) allocates an
|
||||
* object for every key in IE which is really bad for IE6 GC perf.
|
||||
* 2. Without a side data structure, we would need to escape all the keys
|
||||
* as that would be the only way we could tell during iteration if the
|
||||
* key was an internal key or a property of the object.
|
||||
*
|
||||
* This array can contain deleted keys so it's necessary to check the map
|
||||
* as well to see if the key is still in the map (this doesn't require a
|
||||
* memory allocation in IE).
|
||||
* @private {!Array<string>}
|
||||
*/
|
||||
this.keys_ = [];
|
||||
|
||||
/**
|
||||
* The number of key value pairs in the map.
|
||||
* @private {number}
|
||||
*/
|
||||
this.count_ = 0;
|
||||
|
||||
/**
|
||||
* Version used to detect changes while iterating.
|
||||
* @private {number}
|
||||
*/
|
||||
this.version_ = 0;
|
||||
|
||||
var argLength = arguments.length;
|
||||
|
||||
if (argLength > 1) {
|
||||
if (argLength % 2) {
|
||||
throw Error('Uneven number of arguments');
|
||||
}
|
||||
for (var i = 0; i < argLength; i += 2) {
|
||||
this.set(arguments[i], arguments[i + 1]);
|
||||
}
|
||||
} else if (opt_map) {
|
||||
this.addAll(/** @type {Object} */ (opt_map));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} The number of key-value pairs in the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.getCount = function() {
|
||||
return this.count_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the values of the map.
|
||||
* @return {!Array<V>} The values in the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.getValues = function() {
|
||||
this.cleanupKeysArray_();
|
||||
|
||||
var rv = [];
|
||||
for (var i = 0; i < this.keys_.length; i++) {
|
||||
var key = this.keys_[i];
|
||||
rv.push(this.map_[key]);
|
||||
}
|
||||
return rv;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the keys of the map.
|
||||
* @return {!Array<string>} Array of string values.
|
||||
*/
|
||||
goog.structs.Map.prototype.getKeys = function() {
|
||||
this.cleanupKeysArray_();
|
||||
return /** @type {!Array<string>} */ (this.keys_.concat());
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether the map contains the given key.
|
||||
* @param {*} key The key to check for.
|
||||
* @return {boolean} Whether the map contains the key.
|
||||
*/
|
||||
goog.structs.Map.prototype.containsKey = function(key) {
|
||||
return goog.structs.Map.hasKey_(this.map_, key);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether the map contains the given value. This is O(n).
|
||||
* @param {V} val The value to check for.
|
||||
* @return {boolean} Whether the map contains the value.
|
||||
*/
|
||||
goog.structs.Map.prototype.containsValue = function(val) {
|
||||
for (var i = 0; i < this.keys_.length; i++) {
|
||||
var key = this.keys_[i];
|
||||
if (goog.structs.Map.hasKey_(this.map_, key) && this.map_[key] == val) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether this map is equal to the argument map.
|
||||
* @param {goog.structs.Map} otherMap The map against which to test equality.
|
||||
* @param {function(V, V): boolean=} opt_equalityFn Optional equality function
|
||||
* to test equality of values. If not specified, this will test whether
|
||||
* the values contained in each map are identical objects.
|
||||
* @return {boolean} Whether the maps are equal.
|
||||
*/
|
||||
goog.structs.Map.prototype.equals = function(otherMap, opt_equalityFn) {
|
||||
if (this === otherMap) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.count_ != otherMap.getCount()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var equalityFn = opt_equalityFn || goog.structs.Map.defaultEquals;
|
||||
|
||||
this.cleanupKeysArray_();
|
||||
for (var key, i = 0; key = this.keys_[i]; i++) {
|
||||
if (!equalityFn(this.get(key), otherMap.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Default equality test for values.
|
||||
* @param {*} a The first value.
|
||||
* @param {*} b The second value.
|
||||
* @return {boolean} Whether a and b reference the same object.
|
||||
*/
|
||||
goog.structs.Map.defaultEquals = function(a, b) {
|
||||
return a === b;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the map is empty.
|
||||
*/
|
||||
goog.structs.Map.prototype.isEmpty = function() {
|
||||
return this.count_ == 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes all key-value pairs from the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.clear = function() {
|
||||
this.map_ = {};
|
||||
this.keys_.length = 0;
|
||||
this.count_ = 0;
|
||||
this.version_ = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes a key-value pair based on the key. This is O(logN) amortized due to
|
||||
* updating the keys array whenever the count becomes half the size of the keys
|
||||
* in the keys array.
|
||||
* @param {*} key The key to remove.
|
||||
* @return {boolean} Whether object was removed.
|
||||
*/
|
||||
goog.structs.Map.prototype.remove = function(key) {
|
||||
if (goog.structs.Map.hasKey_(this.map_, key)) {
|
||||
delete this.map_[key];
|
||||
this.count_--;
|
||||
this.version_++;
|
||||
|
||||
// clean up the keys array if the threshold is hit
|
||||
if (this.keys_.length > 2 * this.count_) {
|
||||
this.cleanupKeysArray_();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Cleans up the temp keys array by removing entries that are no longer in the
|
||||
* map.
|
||||
* @private
|
||||
*/
|
||||
goog.structs.Map.prototype.cleanupKeysArray_ = function() {
|
||||
if (this.count_ != this.keys_.length) {
|
||||
// First remove keys that are no longer in the map.
|
||||
var srcIndex = 0;
|
||||
var destIndex = 0;
|
||||
while (srcIndex < this.keys_.length) {
|
||||
var key = this.keys_[srcIndex];
|
||||
if (goog.structs.Map.hasKey_(this.map_, key)) {
|
||||
this.keys_[destIndex++] = key;
|
||||
}
|
||||
srcIndex++;
|
||||
}
|
||||
this.keys_.length = destIndex;
|
||||
}
|
||||
|
||||
if (this.count_ != this.keys_.length) {
|
||||
// If the count still isn't correct, that means we have duplicates. This can
|
||||
// happen when the same key is added and removed multiple times. Now we have
|
||||
// to allocate one extra Object to remove the duplicates. This could have
|
||||
// been done in the first pass, but in the common case, we can avoid
|
||||
// allocating an extra object by only doing this when necessary.
|
||||
var seen = {};
|
||||
var srcIndex = 0;
|
||||
var destIndex = 0;
|
||||
while (srcIndex < this.keys_.length) {
|
||||
var key = this.keys_[srcIndex];
|
||||
if (!(goog.structs.Map.hasKey_(seen, key))) {
|
||||
this.keys_[destIndex++] = key;
|
||||
seen[key] = 1;
|
||||
}
|
||||
srcIndex++;
|
||||
}
|
||||
this.keys_.length = destIndex;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value for the given key. If the key is not found and the default
|
||||
* value is not given this will return {@code undefined}.
|
||||
* @param {*} key The key to get the value for.
|
||||
* @param {DEFAULT=} opt_val The value to return if no item is found for the
|
||||
* given key, defaults to undefined.
|
||||
* @return {V|DEFAULT} The value for the given key.
|
||||
* @template DEFAULT
|
||||
*/
|
||||
goog.structs.Map.prototype.get = function(key, opt_val) {
|
||||
if (goog.structs.Map.hasKey_(this.map_, key)) {
|
||||
return this.map_[key];
|
||||
}
|
||||
return opt_val;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Adds a key-value pair to the map.
|
||||
* @param {*} key The key.
|
||||
* @param {V} value The value to add.
|
||||
* @return {*} Some subclasses return a value.
|
||||
*/
|
||||
goog.structs.Map.prototype.set = function(key, value) {
|
||||
if (!(goog.structs.Map.hasKey_(this.map_, key))) {
|
||||
this.count_++;
|
||||
// TODO(johnlenz): This class lies, it claims to return an array of string
|
||||
// keys, but instead returns the original object used.
|
||||
this.keys_.push(/** @type {?} */ (key));
|
||||
// Only change the version if we add a new key.
|
||||
this.version_++;
|
||||
}
|
||||
this.map_[key] = value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Adds multiple key-value pairs from another goog.structs.Map or Object.
|
||||
* @param {Object} map Object containing the data to add.
|
||||
*/
|
||||
goog.structs.Map.prototype.addAll = function(map) {
|
||||
var keys, values;
|
||||
if (map instanceof goog.structs.Map) {
|
||||
keys = map.getKeys();
|
||||
values = map.getValues();
|
||||
} else {
|
||||
keys = goog.object.getKeys(map);
|
||||
values = goog.object.getValues(map);
|
||||
}
|
||||
// we could use goog.array.forEach here but I don't want to introduce that
|
||||
// dependency just for this.
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
this.set(keys[i], values[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls the given function on each entry in the map.
|
||||
* @param {function(this:T, V, K, goog.structs.Map<K,V>)} f
|
||||
* @param {T=} opt_obj The value of "this" inside f.
|
||||
* @template T
|
||||
*/
|
||||
goog.structs.Map.prototype.forEach = function(f, opt_obj) {
|
||||
var keys = this.getKeys();
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var value = this.get(key);
|
||||
f.call(opt_obj, value, key, this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clones a map and returns a new map.
|
||||
* @return {!goog.structs.Map} A new map with the same key-value pairs.
|
||||
*/
|
||||
goog.structs.Map.prototype.clone = function() {
|
||||
return new goog.structs.Map(this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new map in which all the keys and values are interchanged
|
||||
* (keys become values and values become keys). If multiple keys map to the
|
||||
* same value, the chosen transposed value is implementation-dependent.
|
||||
*
|
||||
* It acts very similarly to {goog.object.transpose(Object)}.
|
||||
*
|
||||
* @return {!goog.structs.Map} The transposed map.
|
||||
*/
|
||||
goog.structs.Map.prototype.transpose = function() {
|
||||
var transposed = new goog.structs.Map();
|
||||
for (var i = 0; i < this.keys_.length; i++) {
|
||||
var key = this.keys_[i];
|
||||
var value = this.map_[key];
|
||||
transposed.set(value, key);
|
||||
}
|
||||
|
||||
return transposed;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {!Object} Object representation of the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.toObject = function() {
|
||||
this.cleanupKeysArray_();
|
||||
var obj = {};
|
||||
for (var i = 0; i < this.keys_.length; i++) {
|
||||
var key = this.keys_[i];
|
||||
obj[key] = this.map_[key];
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over the keys in the map. Removal of keys
|
||||
* while iterating might have undesired side effects.
|
||||
* @return {!goog.iter.Iterator} An iterator over the keys in the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.getKeyIterator = function() {
|
||||
return this.__iterator__(true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over the values in the map. Removal of
|
||||
* keys while iterating might have undesired side effects.
|
||||
* @return {!goog.iter.Iterator} An iterator over the values in the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.getValueIterator = function() {
|
||||
return this.__iterator__(false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over the values or the keys in the map.
|
||||
* This throws an exception if the map was mutated since the iterator was
|
||||
* created.
|
||||
* @param {boolean=} opt_keys True to iterate over the keys. False to iterate
|
||||
* over the values. The default value is false.
|
||||
* @return {!goog.iter.Iterator} An iterator over the values or keys in the map.
|
||||
*/
|
||||
goog.structs.Map.prototype.__iterator__ = function(opt_keys) {
|
||||
// Clean up keys to minimize the risk of iterating over dead keys.
|
||||
this.cleanupKeysArray_();
|
||||
|
||||
var i = 0;
|
||||
var version = this.version_;
|
||||
var selfObj = this;
|
||||
|
||||
var newIter = new goog.iter.Iterator;
|
||||
newIter.next = function() {
|
||||
if (version != selfObj.version_) {
|
||||
throw Error('The map has changed since the iterator was created');
|
||||
}
|
||||
if (i >= selfObj.keys_.length) {
|
||||
throw goog.iter.StopIteration;
|
||||
}
|
||||
var key = selfObj.keys_[i++];
|
||||
return opt_keys ? key : selfObj.map_[key];
|
||||
};
|
||||
return newIter;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Safe way to test for hasOwnProperty. It even allows testing for
|
||||
* 'hasOwnProperty'.
|
||||
* @param {Object} obj The object to test for presence of the given key.
|
||||
* @param {*} key The key to check for.
|
||||
* @return {boolean} Whether the object has the key.
|
||||
* @private
|
||||
*/
|
||||
goog.structs.Map.hasKey_ = function(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
};
|
354
assets/viz/2/goog/structs/structs.js
Normal file
354
assets/viz/2/goog/structs/structs.js
Normal file
@ -0,0 +1,354 @@
|
||||
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Generics method for collection-like classes and objects.
|
||||
*
|
||||
* @author arv@google.com (Erik Arvidsson)
|
||||
*
|
||||
* This file contains functions to work with collections. It supports using
|
||||
* Map, Set, Array and Object and other classes that implement collection-like
|
||||
* methods.
|
||||
*/
|
||||
|
||||
|
||||
goog.provide('goog.structs');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.object');
|
||||
|
||||
|
||||
// We treat an object as a dictionary if it has getKeys or it is an object that
|
||||
// isn't arrayLike.
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of values in the collection-like object.
|
||||
* @param {Object} col The collection-like object.
|
||||
* @return {number} The number of values in the collection-like object.
|
||||
*/
|
||||
goog.structs.getCount = function(col) {
|
||||
if (col.getCount && typeof col.getCount == 'function') {
|
||||
return col.getCount();
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return col.length;
|
||||
}
|
||||
return goog.object.getCount(col);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the values of the collection-like object.
|
||||
* @param {Object} col The collection-like object.
|
||||
* @return {!Array<?>} The values in the collection-like object.
|
||||
*/
|
||||
goog.structs.getValues = function(col) {
|
||||
if (col.getValues && typeof col.getValues == 'function') {
|
||||
return col.getValues();
|
||||
}
|
||||
if (goog.isString(col)) {
|
||||
return col.split('');
|
||||
}
|
||||
if (goog.isArrayLike(col)) {
|
||||
var rv = [];
|
||||
var l = col.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
rv.push(col[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
return goog.object.getValues(col);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the keys of the collection. Some collections have no notion of
|
||||
* keys/indexes and this function will return undefined in those cases.
|
||||
* @param {Object} col The collection-like object.
|
||||
* @return {!Array|undefined} The keys in the collection.
|
||||
*/
|
||||
goog.structs.getKeys = function(col) {
|
||||
if (col.getKeys && typeof col.getKeys == 'function') {
|
||||
return col.getKeys();
|
||||
}
|
||||
// if we have getValues but no getKeys we know this is a key-less collection
|
||||
if (col.getValues && typeof col.getValues == 'function') {
|
||||
return undefined;
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
var rv = [];
|
||||
var l = col.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
rv.push(i);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
return goog.object.getKeys(col);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether the collection contains the given value. This is O(n) and uses
|
||||
* equals (==) to test the existence.
|
||||
* @param {Object} col The collection-like object.
|
||||
* @param {*} val The value to check for.
|
||||
* @return {boolean} True if the map contains the value.
|
||||
*/
|
||||
goog.structs.contains = function(col, val) {
|
||||
if (col.contains && typeof col.contains == 'function') {
|
||||
return col.contains(val);
|
||||
}
|
||||
if (col.containsValue && typeof col.containsValue == 'function') {
|
||||
return col.containsValue(val);
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.contains(/** @type {!Array<?>} */ (col), val);
|
||||
}
|
||||
return goog.object.containsValue(col, val);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether the collection is empty.
|
||||
* @param {Object} col The collection-like object.
|
||||
* @return {boolean} True if empty.
|
||||
*/
|
||||
goog.structs.isEmpty = function(col) {
|
||||
if (col.isEmpty && typeof col.isEmpty == 'function') {
|
||||
return col.isEmpty();
|
||||
}
|
||||
|
||||
// We do not use goog.string.isEmptyOrWhitespace because here we treat the
|
||||
// string as
|
||||
// collection and as such even whitespace matters
|
||||
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.isEmpty(/** @type {!Array<?>} */ (col));
|
||||
}
|
||||
return goog.object.isEmpty(col);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes all the elements from the collection.
|
||||
* @param {Object} col The collection-like object.
|
||||
*/
|
||||
goog.structs.clear = function(col) {
|
||||
// NOTE(arv): This should not contain strings because strings are immutable
|
||||
if (col.clear && typeof col.clear == 'function') {
|
||||
col.clear();
|
||||
} else if (goog.isArrayLike(col)) {
|
||||
goog.array.clear(/** @type {IArrayLike<?>} */ (col));
|
||||
} else {
|
||||
goog.object.clear(col);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls a function for each value in a collection. The function takes
|
||||
* three arguments; the value, the key and the collection.
|
||||
*
|
||||
* @param {S} col The collection-like object.
|
||||
* @param {function(this:T,?,?,S):?} f The function to call for every value.
|
||||
* This function takes
|
||||
* 3 arguments (the value, the key or undefined if the collection has no
|
||||
* notion of keys, and the collection) and the return value is irrelevant.
|
||||
* @param {T=} opt_obj The object to be used as the value of 'this'
|
||||
* within {@code f}.
|
||||
* @template T,S
|
||||
* @deprecated Use a more specific method, e.g. goog.array.forEach,
|
||||
* goog.object.forEach, or for-of.
|
||||
*/
|
||||
goog.structs.forEach = function(col, f, opt_obj) {
|
||||
if (col.forEach && typeof col.forEach == 'function') {
|
||||
col.forEach(f, opt_obj);
|
||||
} else if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
goog.array.forEach(/** @type {!Array<?>} */ (col), f, opt_obj);
|
||||
} else {
|
||||
var keys = goog.structs.getKeys(col);
|
||||
var values = goog.structs.getValues(col);
|
||||
var l = values.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
f.call(/** @type {?} */ (opt_obj), values[i], keys && keys[i], col);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls a function for every value in the collection. When a call returns true,
|
||||
* adds the value to a new collection (Array is returned by default).
|
||||
*
|
||||
* @param {S} col The collection-like object.
|
||||
* @param {function(this:T,?,?,S):boolean} f The function to call for every
|
||||
* value. This function takes
|
||||
* 3 arguments (the value, the key or undefined if the collection has no
|
||||
* notion of keys, and the collection) and should return a Boolean. If the
|
||||
* return value is true the value is added to the result collection. If it
|
||||
* is false the value is not included.
|
||||
* @param {T=} opt_obj The object to be used as the value of 'this'
|
||||
* within {@code f}.
|
||||
* @return {!Object|!Array<?>} A new collection where the passed values are
|
||||
* present. If col is a key-less collection an array is returned. If col
|
||||
* has keys and values a plain old JS object is returned.
|
||||
* @template T,S
|
||||
*/
|
||||
goog.structs.filter = function(col, f, opt_obj) {
|
||||
if (typeof col.filter == 'function') {
|
||||
return col.filter(f, opt_obj);
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.filter(/** @type {!Array<?>} */ (col), f, opt_obj);
|
||||
}
|
||||
|
||||
var rv;
|
||||
var keys = goog.structs.getKeys(col);
|
||||
var values = goog.structs.getValues(col);
|
||||
var l = values.length;
|
||||
if (keys) {
|
||||
rv = {};
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (f.call(/** @type {?} */ (opt_obj), values[i], keys[i], col)) {
|
||||
rv[keys[i]] = values[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We should not use goog.array.filter here since we want to make sure that
|
||||
// the index is undefined as well as make sure that col is passed to the
|
||||
// function.
|
||||
rv = [];
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (f.call(opt_obj, values[i], undefined, col)) {
|
||||
rv.push(values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls a function for every value in the collection and adds the result into a
|
||||
* new collection (defaults to creating a new Array).
|
||||
*
|
||||
* @param {S} col The collection-like object.
|
||||
* @param {function(this:T,?,?,S):V} f The function to call for every value.
|
||||
* This function takes 3 arguments (the value, the key or undefined if the
|
||||
* collection has no notion of keys, and the collection) and should return
|
||||
* something. The result will be used as the value in the new collection.
|
||||
* @param {T=} opt_obj The object to be used as the value of 'this'
|
||||
* within {@code f}.
|
||||
* @return {!Object<V>|!Array<V>} A new collection with the new values. If
|
||||
* col is a key-less collection an array is returned. If col has keys and
|
||||
* values a plain old JS object is returned.
|
||||
* @template T,S,V
|
||||
*/
|
||||
goog.structs.map = function(col, f, opt_obj) {
|
||||
if (typeof col.map == 'function') {
|
||||
return col.map(f, opt_obj);
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.map(/** @type {!Array<?>} */ (col), f, opt_obj);
|
||||
}
|
||||
|
||||
var rv;
|
||||
var keys = goog.structs.getKeys(col);
|
||||
var values = goog.structs.getValues(col);
|
||||
var l = values.length;
|
||||
if (keys) {
|
||||
rv = {};
|
||||
for (var i = 0; i < l; i++) {
|
||||
rv[keys[i]] = f.call(/** @type {?} */ (opt_obj), values[i], keys[i], col);
|
||||
}
|
||||
} else {
|
||||
// We should not use goog.array.map here since we want to make sure that
|
||||
// the index is undefined as well as make sure that col is passed to the
|
||||
// function.
|
||||
rv = [];
|
||||
for (var i = 0; i < l; i++) {
|
||||
rv[i] = f.call(/** @type {?} */ (opt_obj), values[i], undefined, col);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls f for each value in a collection. If any call returns true this returns
|
||||
* true (without checking the rest). If all returns false this returns false.
|
||||
*
|
||||
* @param {S} col The collection-like object.
|
||||
* @param {function(this:T,?,?,S):boolean} f The function to call for every
|
||||
* value. This function takes 3 arguments (the value, the key or undefined
|
||||
* if the collection has no notion of keys, and the collection) and should
|
||||
* return a boolean.
|
||||
* @param {T=} opt_obj The object to be used as the value of 'this'
|
||||
* within {@code f}.
|
||||
* @return {boolean} True if any value passes the test.
|
||||
* @template T,S
|
||||
*/
|
||||
goog.structs.some = function(col, f, opt_obj) {
|
||||
if (typeof col.some == 'function') {
|
||||
return col.some(f, opt_obj);
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.some(/** @type {!Array<?>} */ (col), f, opt_obj);
|
||||
}
|
||||
var keys = goog.structs.getKeys(col);
|
||||
var values = goog.structs.getValues(col);
|
||||
var l = values.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (f.call(/** @type {?} */ (opt_obj), values[i], keys && keys[i], col)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Calls f for each value in a collection. If all calls return true this return
|
||||
* true this returns true. If any returns false this returns false at this point
|
||||
* and does not continue to check the remaining values.
|
||||
*
|
||||
* @param {S} col The collection-like object.
|
||||
* @param {function(this:T,?,?,S):boolean} f The function to call for every
|
||||
* value. This function takes 3 arguments (the value, the key or
|
||||
* undefined if the collection has no notion of keys, and the collection)
|
||||
* and should return a boolean.
|
||||
* @param {T=} opt_obj The object to be used as the value of 'this'
|
||||
* within {@code f}.
|
||||
* @return {boolean} True if all key-value pairs pass the test.
|
||||
* @template T,S
|
||||
*/
|
||||
goog.structs.every = function(col, f, opt_obj) {
|
||||
if (typeof col.every == 'function') {
|
||||
return col.every(f, opt_obj);
|
||||
}
|
||||
if (goog.isArrayLike(col) || goog.isString(col)) {
|
||||
return goog.array.every(/** @type {!Array<?>} */ (col), f, opt_obj);
|
||||
}
|
||||
var keys = goog.structs.getKeys(col);
|
||||
var values = goog.structs.getValues(col);
|
||||
var l = values.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (!f.call(/** @type {?} */ (opt_obj), values[i], keys && keys[i], col)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
1547
assets/viz/2/goog/uri/uri.js
Normal file
1547
assets/viz/2/goog/uri/uri.js
Normal file
File diff suppressed because it is too large
Load Diff
1103
assets/viz/2/goog/uri/utils.js
Normal file
1103
assets/viz/2/goog/uri/utils.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@ goog.require('goog.labs.userAgent.browser');
|
||||
goog.require('goog.labs.userAgent.engine');
|
||||
goog.require('goog.labs.userAgent.platform');
|
||||
goog.require('goog.labs.userAgent.util');
|
||||
goog.require('goog.reflect');
|
||||
goog.require('goog.string');
|
||||
|
||||
|
||||
@ -98,7 +99,7 @@ goog.userAgent.getUserAgentString = function() {
|
||||
|
||||
/**
|
||||
* TODO(nnaze): Change type to "Navigator" and update compilation targets.
|
||||
* @return {Object} The native navigator object.
|
||||
* @return {?Object} The native navigator object.
|
||||
*/
|
||||
goog.userAgent.getNavigator = function() {
|
||||
// Need a local navigator reference instead of using the global one,
|
||||
@ -384,6 +385,15 @@ goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ?
|
||||
goog.labs.userAgent.platform.isIpod();
|
||||
|
||||
|
||||
/**
|
||||
* Whether the user agent is running on iOS.
|
||||
* @type {boolean}
|
||||
*/
|
||||
goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ?
|
||||
(goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD ||
|
||||
goog.userAgent.ASSUME_IPOD) :
|
||||
goog.labs.userAgent.platform.isIos();
|
||||
|
||||
/**
|
||||
* @return {string} The string that describes the version number of the user
|
||||
* agent.
|
||||
@ -508,9 +518,11 @@ goog.userAgent.isVersionOrHigherCache_ = {};
|
||||
*/
|
||||
goog.userAgent.isVersionOrHigher = function(version) {
|
||||
return goog.userAgent.ASSUME_ANY_VERSION ||
|
||||
goog.userAgent.isVersionOrHigherCache_[version] ||
|
||||
(goog.userAgent.isVersionOrHigherCache_[version] =
|
||||
goog.string.compareVersions(goog.userAgent.VERSION, version) >= 0);
|
||||
goog.reflect.cache(
|
||||
goog.userAgent.isVersionOrHigherCache_, version, function() {
|
||||
return goog.string.compareVersions(
|
||||
goog.userAgent.VERSION, version) >= 0;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
12
assets/viz/2/process/env.cljs
Normal file
12
assets/viz/2/process/env.cljs
Normal file
@ -0,0 +1,12 @@
|
||||
;; Copyright (c) Rich Hickey. All rights reserved.
|
||||
;; The use and distribution terms for this software are covered by the
|
||||
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
|
||||
;; which can be found in the file epl-v10.html at the root of this distribution.
|
||||
;; By using this software in any fashion, you are agreeing to be bound by
|
||||
;; the terms of this license.
|
||||
;; You must not remove this notice, or any other, from this software.
|
||||
|
||||
(ns process.env
|
||||
"A shim namespace for the Node.js process library")
|
||||
|
||||
(goog-define NODE_ENV "development")
|
1
assets/viz/2/process/env.cljs.cache.json
Normal file
1
assets/viz/2/process/env.cljs.cache.json
Normal file
@ -0,0 +1 @@
|
||||
["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$process.env","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$NODE_ENV",["^ ","^5","~$process.env/NODE_ENV","~:file","out/process/env.cljs","~:line",12,"~:column",1,"~:end-line",12,"~:end-column",22,"~:tag","~$string","~:declared",true,"~:meta",["^ ","^>","/home/mediocregopher/src/viz/out/process/env.cljs","^?",12,"^@",14,"^A",12,"^B",22,"^C","^D","^E",true]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:doc","A shim namespace for the Node.js process library"]
|
8
assets/viz/2/process/env.js
Normal file
8
assets/viz/2/process/env.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('process.env');
|
||||
goog.require('cljs.core');
|
||||
|
||||
/** @define {string} */
|
||||
goog.define("process.env.NODE_ENV","development");
|
||||
|
||||
//# sourceMappingURL=env.js.map
|
1
assets/viz/2/process/env.js.map
Normal file
1
assets/viz/2/process/env.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/process\/env.js","sources":["env.cljs"],"lineCount":8,"mappings":";AAQA;;AAGA,AAAA,AAAA;AAAA;AAAA,AAAAA,YAAA,uBAAA","names":["goog\/define"]}
|
File diff suppressed because one or more lines are too long
1
assets/viz/2/quil/core.cljc.cache.json
Normal file
1
assets/viz/2/quil/core.cljc.cache.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
assets/viz/2/quil/middleware.cljc.cache.json
Normal file
1
assets/viz/2/quil/middleware.cljc.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.middleware');
|
||||
goog.require('cljs.core');
|
||||
goog.require('quil.middlewares.fun_mode');
|
||||
@ -115,4 +115,4 @@ quil.middleware.navigation_2d = (function quil$middleware$navigation_2d(options)
|
||||
return quil.middlewares.navigation_2d.navigation_2d.call(null,options);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=middleware.js.map
|
||||
//# sourceMappingURL=middleware.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middleware.js","sources":["middleware.cljc"],"lineCount":118,"mappings":";AAAA;;;;;AAQA;;;;;2BAAA,3BAKEA,8DAICC;AATH,AAUE,OAACC,6CAAkBD;;AAgBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAA,hCAKEE,wEAiECF;AAtEH,AAuEE,OAACG,uDAA4BH;;AAE\/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAA,hCAKEI,wEA8BCJ;AAnCH,AAoCE,OAACK,uDAA4BL","names":["quil.middleware\/fun-mode","options","quil.middlewares.fun-mode\/fun-mode","quil.middleware\/navigation-3d","quil.middlewares.navigation-3d\/navigation-3d","quil.middleware\/navigation-2d","quil.middlewares.navigation-2d\/navigation-2d"]}
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middleware.js","sources":["middleware.cljc"],"lineCount":118,"mappings":";AAAA;;;;;AAQA;;;;;2BAAA,3BAKEA,8DAIC;AATH,AAUE,OAACC,6CAAkBC;;AAgBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAA,hCAKEC,wEAiEC;AAtEH,AAuEE,OAACC,uDAA4BF;;AAE\/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAA,hCAKEG,wEA8BC;AAnCH,AAoCE,OAACC,uDAA4BJ","names":["quil.middleware\/fun-mode","quil.middlewares.fun-mode\/fun-mode","options","quil.middleware\/navigation-3d","quil.middlewares.navigation-3d\/navigation-3d","quil.middleware\/navigation-2d","quil.middlewares.navigation-2d\/navigation-2d"]}
|
@ -1 +0,0 @@
|
||||
{:rename-macros {}, :renames {}, :use-macros {}, :excludes #{}, :name quil.middlewares.deprecated-options, :imports nil, :requires nil, :uses nil, :defs {deprecated {:name quil.middlewares.deprecated-options/deprecated, :file "out/quil/middlewares/deprecated_options.cljc", :line 3, :column 1, :end-line 3, :end-column 26, :private true, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 3, :column 16, :end-line 3, :end-column 26, :private true}, :tag cljs.core/IMap}, check-features-vector {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 8, :column 8, :end-line 8, :end-column 29, :private true, :arglists (quote ([features]))}, :private true, :name quil.middlewares.deprecated-options/check-features-vector, :variadic false, :file "out/quil/middlewares/deprecated_options.cljc", :end-column 29, :method-params ([features]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 8, :end-line 8, :max-fixed-arity 1, :fn-var true, :arglists (quote ([features]))}, deprecated-options {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 15, :column 7, :end-line 15, :end-column 25, :arglists (quote ([options])), :doc "Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."}, :name quil.middlewares.deprecated-options/deprecated-options, :variadic false, :file "out/quil/middlewares/deprecated_options.cljc", :end-column 25, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options])), :doc "Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:features :decor :safe-draw-fn :no-safe-draw :target}, :order [:decor :target :safe-draw-fn :no-safe-draw :features]}, :doc nil}
|
@ -0,0 +1 @@
|
||||
["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$quil.middlewares.deprecated-options","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$deprecated",["^ ","^5","~$quil.middlewares.deprecated-options/deprecated","~:file","out/quil/middlewares/deprecated_options.cljc","~:line",3,"~:column",1,"~:end-line",3,"~:end-column",26,"~:private",true,"~:meta",["^ ","^>","/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc","^?",3,"^@",16,"^A",3,"^B",26,"^C",true],"~:tag","~$cljs.core/IMap"],"~$check-features-vector",["^ ","~:protocol-inline",null,"^D",["^ ","^>","/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc","^?",8,"^@",8,"^A",8,"^B",29,"^C",true,"~:arglists",["~#list",["~$quote",["^J",[["~$features"]]]]]],"^C",true,"^5","~$quil.middlewares.deprecated-options/check-features-vector","^>","out/quil/middlewares/deprecated_options.cljc","^B",29,"~:method-params",["^J",[["^L"]]],"~:protocol-impl",null,"~:arglists-meta",["^J",[null,null]],"^@",1,"~:variadic?",false,"^?",8,"~:ret-tag","~$any","^A",8,"~:max-fixed-arity",1,"~:fn-var",true,"^I",["^J",["^K",["^J",[["^L"]]]]]],"~$deprecated-options",["^ ","^H",null,"^D",["^ ","^>","/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc","^?",15,"^@",7,"^A",15,"^B",25,"^I",["^J",["^K",["^J",[["~$options"]]]]],"~:doc","Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."],"^5","~$quil.middlewares.deprecated-options/deprecated-options","^>","out/quil/middlewares/deprecated_options.cljc","^B",25,"^N",["^J",[["^W"]]],"^O",null,"^P",["^J",[null,null]],"^@",1,"^Q",false,"^?",15,"^R","^S","^A",15,"^T",1,"^U",true,"^I",["^J",["^K",["^J",[["^W"]]]]],"^X","Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:features","~:decor","~:safe-draw-fn","~:no-safe-draw","~:target"]],"~:order",["^13","^16","^14","^15","^12"]],"^X",null]
|
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.middlewares.deprecated_options');
|
||||
goog.require('cljs.core');
|
||||
quil.middlewares.deprecated_options.deprecated = new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"decor","decor",-1730969431),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Try :features [:present] for similar effect"], null),new cljs.core.Keyword(null,"target","target",253001721),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Use :features [:keep-on-top] instead."], null),new cljs.core.Keyword(null,"safe-draw-fn","safe-draw-fn",1454900202),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Use :features [:no-safe-fns] instead."], null)], null);
|
||||
@ -17,30 +17,30 @@ return cljs.core.disj.call(null,features__$1,new cljs.core.Keyword(null,"no-safe
|
||||
*/
|
||||
quil.middlewares.deprecated_options.deprecated_options = (function quil$middlewares$deprecated_options$deprecated_options(options){
|
||||
var options__$1 = cljs.core.update_in.call(null,options,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"features","features",-1146962336)], null),quil.middlewares.deprecated_options.check_features_vector);
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.remove.call(null,cljs.core.nil_QMARK_,(function (){var iter__7602__auto__ = ((function (options__$1){
|
||||
return (function quil$middlewares$deprecated_options$deprecated_options_$_iter__8043(s__8044){
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.remove.call(null,cljs.core.nil_QMARK_,(function (){var iter__4434__auto__ = ((function (options__$1){
|
||||
return (function quil$middlewares$deprecated_options$deprecated_options_$_iter__1106(s__1107){
|
||||
return (new cljs.core.LazySeq(null,((function (options__$1){
|
||||
return (function (){
|
||||
var s__8044__$1 = s__8044;
|
||||
var s__1107__$1 = s__1107;
|
||||
while(true){
|
||||
var temp__4657__auto__ = cljs.core.seq.call(null,s__8044__$1);
|
||||
var temp__4657__auto__ = cljs.core.seq.call(null,s__1107__$1);
|
||||
if(temp__4657__auto__){
|
||||
var s__8044__$2 = temp__4657__auto__;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,s__8044__$2)){
|
||||
var c__7600__auto__ = cljs.core.chunk_first.call(null,s__8044__$2);
|
||||
var size__7601__auto__ = cljs.core.count.call(null,c__7600__auto__);
|
||||
var b__8046 = cljs.core.chunk_buffer.call(null,size__7601__auto__);
|
||||
if((function (){var i__8045 = (0);
|
||||
var s__1107__$2 = temp__4657__auto__;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,s__1107__$2)){
|
||||
var c__4432__auto__ = cljs.core.chunk_first.call(null,s__1107__$2);
|
||||
var size__4433__auto__ = cljs.core.count.call(null,c__4432__auto__);
|
||||
var b__1109 = cljs.core.chunk_buffer.call(null,size__4433__auto__);
|
||||
if((function (){var i__1108 = (0);
|
||||
while(true){
|
||||
if((i__8045 < size__7601__auto__)){
|
||||
var vec__8059 = cljs.core._nth.call(null,c__7600__auto__,i__8045);
|
||||
var name = cljs.core.nth.call(null,vec__8059,(0),null);
|
||||
var value = cljs.core.nth.call(null,vec__8059,(1),null);
|
||||
cljs.core.chunk_append.call(null,b__8046,(function (){var temp__4655__auto__ = quil.middlewares.deprecated_options.deprecated.call(null,name);
|
||||
if((i__1108 < size__4433__auto__)){
|
||||
var vec__1110 = cljs.core._nth.call(null,c__4432__auto__,i__1108);
|
||||
var name = cljs.core.nth.call(null,vec__1110,(0),null);
|
||||
var value = cljs.core.nth.call(null,vec__1110,(1),null);
|
||||
cljs.core.chunk_append.call(null,b__1109,(function (){var temp__4655__auto__ = quil.middlewares.deprecated_options.deprecated.call(null,name);
|
||||
if(cljs.core.truth_(temp__4655__auto__)){
|
||||
var vec__8062 = temp__4655__auto__;
|
||||
var version = cljs.core.nth.call(null,vec__8062,(0),null);
|
||||
var message = cljs.core.nth.call(null,vec__8062,(1),null);
|
||||
var vec__1113 = temp__4655__auto__;
|
||||
var version = cljs.core.nth.call(null,vec__1113,(0),null);
|
||||
var message = cljs.core.nth.call(null,vec__1113,(1),null);
|
||||
cljs.core.println.call(null,name,"option was removed in Quil",version,".",message);
|
||||
|
||||
return null;
|
||||
@ -49,8 +49,8 @@ return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMP
|
||||
}
|
||||
})());
|
||||
|
||||
var G__8071 = (i__8045 + (1));
|
||||
i__8045 = G__8071;
|
||||
var G__1122 = (i__1108 + (1));
|
||||
i__1108 = G__1122;
|
||||
continue;
|
||||
} else {
|
||||
return true;
|
||||
@ -58,26 +58,26 @@ return true;
|
||||
break;
|
||||
}
|
||||
})()){
|
||||
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__8046),quil$middlewares$deprecated_options$deprecated_options_$_iter__8043.call(null,cljs.core.chunk_rest.call(null,s__8044__$2)));
|
||||
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__1109),quil$middlewares$deprecated_options$deprecated_options_$_iter__1106.call(null,cljs.core.chunk_rest.call(null,s__1107__$2)));
|
||||
} else {
|
||||
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__8046),null);
|
||||
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__1109),null);
|
||||
}
|
||||
} else {
|
||||
var vec__8065 = cljs.core.first.call(null,s__8044__$2);
|
||||
var name = cljs.core.nth.call(null,vec__8065,(0),null);
|
||||
var value = cljs.core.nth.call(null,vec__8065,(1),null);
|
||||
var vec__1116 = cljs.core.first.call(null,s__1107__$2);
|
||||
var name = cljs.core.nth.call(null,vec__1116,(0),null);
|
||||
var value = cljs.core.nth.call(null,vec__1116,(1),null);
|
||||
return cljs.core.cons.call(null,(function (){var temp__4655__auto__ = quil.middlewares.deprecated_options.deprecated.call(null,name);
|
||||
if(cljs.core.truth_(temp__4655__auto__)){
|
||||
var vec__8068 = temp__4655__auto__;
|
||||
var version = cljs.core.nth.call(null,vec__8068,(0),null);
|
||||
var message = cljs.core.nth.call(null,vec__8068,(1),null);
|
||||
var vec__1119 = temp__4655__auto__;
|
||||
var version = cljs.core.nth.call(null,vec__1119,(0),null);
|
||||
var message = cljs.core.nth.call(null,vec__1119,(1),null);
|
||||
cljs.core.println.call(null,name,"option was removed in Quil",version,".",message);
|
||||
|
||||
return null;
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [name,value], null);
|
||||
}
|
||||
})(),quil$middlewares$deprecated_options$deprecated_options_$_iter__8043.call(null,cljs.core.rest.call(null,s__8044__$2)));
|
||||
})(),quil$middlewares$deprecated_options$deprecated_options_$_iter__1106.call(null,cljs.core.rest.call(null,s__1107__$2)));
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
@ -88,8 +88,8 @@ break;
|
||||
,null,null));
|
||||
});})(options__$1))
|
||||
;
|
||||
return iter__7602__auto__.call(null,options__$1);
|
||||
return iter__4434__auto__.call(null,options__$1);
|
||||
})()));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=deprecated_options.js.map
|
||||
//# sourceMappingURL=deprecated_options.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/deprecated_options.js","sources":["deprecated_options.cljc"],"lineCount":95,"mappings":";AAAA;;AAEA,iDAAA,2CAAA,wDAAA,mFAAA,MAAA,sDAAA,wDAAA,mFAAA,MAAA,gDAAA,qEAAA,mFAAA,MAAA,loBAAeA;AAKf,4DAAA,5DAAOC,gIAAuBC;AAA9B,AACE,IAAMA,eAAS,AAACC,wBAAID;AAApB,AACE,oBAAM,uBAAA,vBAACA;AAAP,AACE,4BAAA,iEAAA,7FAACE;;AADH;;AAGA,6CAAA,tCAACC,yBAAKH;;AAEV;;;;yDAAA,zDAAMI,0HAGHC;AAHH,AAIE,IAAMA,cAAQ,sCAAA,mFAAA,zHAACC,8BAAUD,iKAAoBN;AAA7C,mHACO,iBAAAQ,qBAAA,tFAKA,AAAC+B,2BAAOC,9FACR,gCAAA,zBAACC;qFANDhC;AAAA,AAAA,YAAAC,kBAAA,KAAA;;AAAA,AAAA,IAAAD,cAAAA;;AAAA,AAAA,IAAAE,qBAAA,AAAAC,wBAAAH;AAAA,AAAA,GAAAE;AAAA,AAAA,IAAAF,cAAAE;AAAA,AAAA,GAAA,AAAAE,uCAAAJ;AAAA,IAAAK,kBAqwE0C,AAAA4B,gCAAAjC;IArwE1CM,qBAAA,AAAAC,0BAAAF;IAAAG,UAAA,AAAAC,iCAAAH;AAAA,AAAA,GAAA,AAAA,iBAAAI,UAAA;;AAAA,AAAA,GAAA,CAAAA,UAAAJ;AAAA,IAAAK,YAAA,AAAAC,yBAAAP,gBAAAK;WAAA,AAAAG,wBAAAF,UAAA,IAAA,7CAAOY;YAAP,AAAAV,wBAAAF,UAAA,IAAA,9CAAYa;AAAZ,AAAA,AAAA,AAAAV,iCAAAN,QACE,iBAAAiB,qBAA2B,AAACnC,yDAAWiC;AAAvC,AAAA,oBAAAE;AAAA,IAAAC,YAAAD;cAAA,AAAAZ,wBAAAa,UAAA,IAAA,hDAAUE;cAAV,AAAAf,wBAAAa,UAAA,IAAA,hDAAkBG;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAACnC,4BAAQ6B,kCAAkCK,YAAYC;;AAA3D;;AADF,0FAGGN,KAAKC;;;;AAJV,cAAA,CAAAd,UAAA;;;;AAAA;;;;;AAAA,OAAAK,+BAAA,AAAAC,0BAAAR,SAAA,AAAAS,8EAAA,AAAAC,+BAAAlB;;AAAA,OAAAe,+BAAA,AAAAC,0BAAAR,SAAA;;;AAAA,IAAAW,YAAA,AAAAC,0BAAApB;WAAA,AAAAa,wBAAAM,UAAA,IAAA,7CAAOI;YAAP,AAAAV,wBAAAM,UAAA,IAAA,9CAAYK;AAAZ,AAAA,OAAAH,yBACE,iBAAAI,qBAA2B,AAACnC,yDAAWiC;AAAvC,AAAA,oBAAAE;AAAA,IAAAE,YAAAF;cAAA,AAAAZ,wBAAAc,UAAA,IAAA,hDAAUC;cAAV,AAAAf,wBAAAc,UAAA,IAAA,hDAAkBE;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAACnC,4BAAQ6B,kCAAkCK,YAAYC;;AAA3D;;AADF,0FAGGN,KAAKC;;KAJV,AAAAP,8EAAA,AAAAK,yBAAAtB;;;AAAA;;;;;CAAA,KAAA;;;AAAA,AAAA,OAAAD,6BAAmBF","names":["quil.middlewares.deprecated-options\/deprecated","quil.middlewares.deprecated-options\/check-features-vector","features","cljs.core\/set","cljs.core\/println","cljs.core\/disj","quil.middlewares.deprecated-options\/deprecated-options","options","cljs.core\/update-in","iter__7602__auto__","s__8044","cljs.core\/LazySeq","temp__4657__auto__","cljs.core\/seq","cljs.core\/chunked-seq?","c__7600__auto__","size__7601__auto__","cljs.core\/count","b__8046","cljs.core\/chunk-buffer","i__8045","vec__8059","cljs.core\/-nth","cljs.core\/nth","cljs.core\/chunk-append","cljs.core\/chunk-cons","cljs.core\/chunk","iter__8043","cljs.core\/chunk-rest","vec__8065","cljs.core\/first","cljs.core\/cons","cljs.core\/rest","name","value","temp__4655__auto__","vec__8062","vec__8068","version","message","cljs.core\/remove","cljs.core\/nil?","cljs.core\/into","cljs.core\/chunk-first"]}
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/deprecated_options.js","sources":["deprecated_options.cljc"],"lineCount":95,"mappings":";AAAA;;AAEA,iDAAA,2CAAA,wDAAA,mFAAA,MAAA,sDAAA,wDAAA,mFAAA,MAAA,gDAAA,qEAAA,mFAAA,MAAA,loBAAeA;AAKf,4DAAA,5DAAOC,gIAAuB;AAA9B,AACE,IAAM,eAAS,AAACC,wBAAIC;AAApB,AACE,oBAAM,uBAAA,vBAACA;AAAP,AACE,4BAAA,iEAAA,7FAACC;;AADH;;AAGA,6CAAA,tCAACC,yBAAKF;;AAEV;;;;yDAAA,zDAAMG,0HAGH;AAHH,AAIE,IAAM,cAAQ,sCAAA,mFAAA,zHAACC,8BAAUC,iKAAoBP;AAA7C,mHACO,iBAAA,qBAAA,tFAKA,AAACuC,2BAAOC,9FACR,gCAAA,zBAACC;qFAND;AAAA,AAAA,YAAAjC,kBAAA,KAAA;;AAAA,AAAA,IAAA,cAAAC;;AAAA,AAAA,IAAA,qBAAA,AAAAC,wBAAAD;AAAA,AAAA,GAAAE;AAAA,AAAA,IAAA,cAAAA;AAAA,AAAA,GAAA,AAAAC,uCAAAH;AAAA,IAAA,kBA61E0C,AAAAiC,gCAAAjC;IA71E1C,qBAAA,AAAAI,0BAAAC;IAAA,UAAA,AAAAC,iCAAAC;AAAA,AAAA,GAAA,AAAA,iBAAA,UAAA;;AAAA,AAAA,GAAA,CAAAC,UAAAD;AAAA,IAAA,YAAA,AAAAE,yBAAAJ,gBAAAG;WAAA,AAAAE,wBAAAC,UAAA,IAAA,7CAAO;YAAP,AAAAD,wBAAAC,UAAA,IAAA,9CAAY;AAAZ,AAAA,AAAA,AAAAC,iCAAAC,QACE,iBAAA,qBAA2B,AAACvB,yDAAWoC;AAAvC,AAAA,oBAAAH;AAAA,IAAA,YAAAA;cAAA,AAAAb,wBAAAc,UAAA,IAAA,hDAAU;cAAV,AAAAd,wBAAAc,UAAA,IAAA,hDAAkB;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAAC9B,4BAAQgC,kCAAkCC,YAAYC;;AAA3D;;AADF,0FAGGF,KAAKG;;;;AAJV,cAAA,CAAArB,UAAA;;;;AAAA;;;;;AAAA,OAAAM,+BAAA,AAAAC,0BAAAF,SAAA,AAAAG,8EAAA,AAAAC,+BAAAjB;;AAAA,OAAAc,+BAAA,AAAAC,0BAAAF,SAAA;;;AAAA,IAAA,YAAA,AAAAK,0BAAAlB;WAAA,AAAAU,wBAAAS,UAAA,IAAA,7CAAO;YAAP,AAAAT,wBAAAS,UAAA,IAAA,9CAAY;AAAZ,AAAA,OAAAC,yBACE,iBAAA,qBAA2B,AAAC9B,yDAAWoC;AAAvC,AAAA,oBAAAH;AAAA,IAAA,YAAAA;cAAA,AAAAb,wBAAAe,UAAA,IAAA,hDAAU;cAAV,AAAAf,wBAAAe,UAAA,IAAA,hDAAkB;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAAC\/B,4BAAQgC,kCAAkCC,YAAYC;;AAA3D;;AADF,0FAGGF,KAAKG;;KAJV,AAAAb,8EAAA,AAAAK,yBAAArB;;;AAAA;;;;;CAAA,KAAA;;;AAAA,AAAA,OAAAsB,6BAAmBxB","names":["quil.middlewares.deprecated-options\/deprecated","quil.middlewares.deprecated-options\/check-features-vector","cljs.core\/set","features","cljs.core\/println","cljs.core\/disj","quil.middlewares.deprecated-options\/deprecated-options","cljs.core\/update-in","options","cljs.core\/LazySeq","s__1107","cljs.core\/seq","temp__4657__auto__","cljs.core\/chunked-seq?","cljs.core\/count","c__4432__auto__","cljs.core\/chunk-buffer","size__4433__auto__","i__1108","cljs.core\/-nth","cljs.core\/nth","vec__1110","cljs.core\/chunk-append","b__1109","cljs.core\/chunk-cons","cljs.core\/chunk","iter__1106","cljs.core\/chunk-rest","cljs.core\/first","vec__1116","cljs.core\/cons","cljs.core\/rest","iter__4434__auto__","temp__4655__auto__","vec__1113","vec__1119","name","version","message","value","cljs.core\/remove","cljs.core\/nil?","cljs.core\/into","cljs.core\/chunk-first"]}
|
File diff suppressed because one or more lines are too long
1
assets/viz/2/quil/middlewares/fun_mode.cljc.cache.json
Normal file
1
assets/viz/2/quil/middlewares/fun_mode.cljc.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.middlewares.fun_mode');
|
||||
goog.require('cljs.core');
|
||||
goog.require('quil.core');
|
||||
@ -34,23 +34,8 @@ quil.middlewares.fun_mode.key_event = (function quil$middlewares$fun_mode$key_ev
|
||||
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"key","key",-1516042587),quil.core.key_as_keyword.call(null),new cljs.core.Keyword(null,"key-code","key-code",-1732114304),quil.core.key_code.call(null),new cljs.core.Keyword(null,"raw-key","raw-key",-162482279),quil.core.raw_key.call(null)], null);
|
||||
});
|
||||
quil.middlewares.fun_mode.wrap_handler = (function quil$middlewares$fun_mode$wrap_handler(var_args){
|
||||
var args9436 = [];
|
||||
var len__7927__auto___9439 = arguments.length;
|
||||
var i__7928__auto___9440 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9440 < len__7927__auto___9439)){
|
||||
args9436.push((arguments[i__7928__auto___9440]));
|
||||
|
||||
var G__9441 = (i__7928__auto___9440 + (1));
|
||||
i__7928__auto___9440 = G__9441;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__9438 = args9436.length;
|
||||
switch (G__9438) {
|
||||
var G__2134 = arguments.length;
|
||||
switch (G__2134) {
|
||||
case 2:
|
||||
return quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -60,7 +45,7 @@ return quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$3((arg
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args9436.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -90,23 +75,23 @@ return options;
|
||||
quil.middlewares.fun_mode.wrap_handler.cljs$lang$maxFixedArity = 3;
|
||||
|
||||
quil.middlewares.fun_mode.wrap_handlers = (function quil$middlewares$fun_mode$wrap_handlers(var_args){
|
||||
var args__7934__auto__ = [];
|
||||
var len__7927__auto___9445 = arguments.length;
|
||||
var i__7928__auto___9446 = (0);
|
||||
var args__4647__auto__ = [];
|
||||
var len__4641__auto___2138 = arguments.length;
|
||||
var i__4642__auto___2139 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___9446 < len__7927__auto___9445)){
|
||||
args__7934__auto__.push((arguments[i__7928__auto___9446]));
|
||||
if((i__4642__auto___2139 < len__4641__auto___2138)){
|
||||
args__4647__auto__.push((arguments[i__4642__auto___2139]));
|
||||
|
||||
var G__9447 = (i__7928__auto___9446 + (1));
|
||||
i__7928__auto___9446 = G__9447;
|
||||
var G__2140 = (i__4642__auto___2139 + (1));
|
||||
i__4642__auto___2139 = G__2140;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__7935__auto__ = ((((1) < args__7934__auto__.length))?(new cljs.core.IndexedSeq(args__7934__auto__.slice((1)),(0),null)):null);
|
||||
return quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__7935__auto__);
|
||||
var argseq__4648__auto__ = ((((1) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((1)),(0),null)):null);
|
||||
return quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__4648__auto__);
|
||||
});
|
||||
|
||||
quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic = (function (options,handlers){
|
||||
@ -121,10 +106,12 @@ return cljs.core.apply.call(null,quil.middlewares.fun_mode.wrap_handler,options_
|
||||
|
||||
quil.middlewares.fun_mode.wrap_handlers.cljs$lang$maxFixedArity = (1);
|
||||
|
||||
quil.middlewares.fun_mode.wrap_handlers.cljs$lang$applyTo = (function (seq9443){
|
||||
var G__9444 = cljs.core.first.call(null,seq9443);
|
||||
var seq9443__$1 = cljs.core.next.call(null,seq9443);
|
||||
return quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic(G__9444,seq9443__$1);
|
||||
/** @this {Function} */
|
||||
quil.middlewares.fun_mode.wrap_handlers.cljs$lang$applyTo = (function (seq2136){
|
||||
var G__2137 = cljs.core.first.call(null,seq2136);
|
||||
var seq2136__$1 = cljs.core.next.call(null,seq2136);
|
||||
var self__4628__auto__ = this;
|
||||
return self__4628__auto__.cljs$core$IFn$_invoke$arity$variadic(G__2137,seq2136__$1);
|
||||
});
|
||||
|
||||
quil.middlewares.fun_mode.wrap_mouse_wheel = (function quil$middlewares$fun_mode$wrap_mouse_wheel(options){
|
||||
@ -152,4 +139,4 @@ return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"x"
|
||||
})], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364),quil.middlewares.fun_mode.key_event], null),new cljs.core.Keyword(null,"key-released","key-released",215919828),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"key-typed","key-typed",-876037597),quil.middlewares.fun_mode.key_event], null),new cljs.core.Keyword(null,"on-close","on-close",-761178394)));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=fun_mode.js.map
|
||||
//# sourceMappingURL=fun_mode.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/fun_mode.js","sources":["fun_mode.cljc"],"lineCount":155,"mappings":";AAAA;;;AAGA,uCAAA,vCAAOA,sFAAYC;AAAnB,AACE,IAAMC,QAAM,AAAA,qFAAQD,QAAQ;AAAA,AAAA;;AAA5B,AACE,yCAAA,uDAAA,zFAACE,0BAAMF;;AAAP,AACU,OAACG,gCAAO,AAACC,gCAAc,AAACH;;;;AAEtC,6CAAA,7CAAOI,kGAAkBL;AAAzB,AACE,IAAMM,OAAK,AAAA,mFAAON,QAAQ,WAAKO;AAAL,AAAA;;IACpBC,SAAO,AAAA,uFAASR,QAAQS;gBAD9B,ZAEMC;;AAFN,qDAEqB,AAACN,\/BACD,AAACO,+DAAM,EAAI,0DAAA,1DAACC,yBAAE,AAACC,uCACNJ,mBACAD,1KACT,OAACF;;;AANtB,4DAOMN,3BACA,mCAAA,nCAACc,jCACD,8HAAA,vHAACZ,4KAAYQ;;AAErB,wCAAA,xCAAOK;AAAP,AAAA,kDAAA,4EAAA,7BACM,AAACC,6EACD,AAACC;;AAEP,6CAAA,7CAAOC;AAAP,AAAA,kDAAA,4EAAA,6EAAA,1GACM,AAACF,6EACD,AAACC,sFACI,AAACE;;AAEZ,sCAAA,tCAAOC;AAAP,AAAA,kDAAA,wFAAA,4FAAA,hIACQ,AAACC,kGACI,AAACC,yFACF,AAACC;;AAGb,AAAA,yCAAA,iDAAAC,1FAAOK;AAAP,AAAA,IAAAJ,WAAA;AAAA,AAAA,IAAAC,yBAAA,AAAA;AAAA,AAAA,IAAAC,uBAAA;;AAAA,AAAA,GAAA,CAAAA,uBAAAD;AAAA,AAAA,AAAAD,cAAA,CAAA,UAAAE;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAAC,UAAA,AAAAH;AAAA,AAAA,QAAAG;KAAA;AAAA,OAAAC,qEAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,qEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAC,MAAA,6CAAA,+DAAA,AAAAL;;;;;AAAA,AAAA,uEAAA,vEAAOI,kFACH7B,QAAQ+B;AADZ,AAEK,4EAAA,rEAACF,iDAAa7B,QAAQ+B;;;AAF3B,AAAA,uEAAA,vEAAOF,kFAGH7B,QAAQ+B,YAAYC;AAHxB,AAIK,IAAAC,qBAAiB,AAACjC,kBAAQ+B;AAA1B,AAAA,oBAAAE;AAAA,cAAAA,VAASC;AAAT,AACE,OAAChC,0BAAMF,QAAQ+B,YACR,4BAAA,VAAIC;;AAAJ,AACG,OAACrB,+BAAM,AAACP,gCAAc8B,QAAQ,AAACF;;CADlC;;AAAA,AAEG,OAACrB,+BAAM,AAACP,gCAAc8B;;;;AAChClC;;;;AATP,AAAA,iEAAA,jEAAO6B;;AAAP,AAWA,AAAA,0CAAA,kDAAAL,5FAAOc;AAAP,AAAA,IAAAH,qBAAA;AAAA,AAAA,IAAAT,yBAAA,AAAA;AAAA,AAAA,IAAAC,uBAAA;;AAAA,AAAA,GAAA,CAAAA,uBAAAD;AAAA,AAAA,AAAAS,wBAAA,CAAA,UAAAR;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAAS,uBAAA,EAAA,CAAA,MAAA,AAAAD,4BAAA,AAAA,KAAAE,qBAAA,AAAAF,yBAAA,KAAA,IAAA,OAAA;AAAA,AAAA,OAAAG,6EAAA,CAAA,UAAA,MAAAF;;;AAAA,AAAA,AAAA,AAAAE,+EAAA,WAAsBtC,QAAU2C;AAAhC,AACE,OAACC,2BAAO,WAAK5C,YAAQkC;AAAb,AACE,GAAI,oBAAAW,nBAAUX;AACZ,OAACL,iDAAa7B,YAAQkC;;AACtB,OAACY,0BAAMjB,uCAAa7B,YAAQkC;;GAChClC,QAAQ2C;;;AALlB,AAAA,AAAAL,kEAAA;;AAAA,AAAA,AAAAA,4DAAA,WAAAC;AAAA,AAAA,IAAAC,UAAA,AAAAC,0BAAAF;IAAAA,cAAA,AAAAG,yBAAAH;AAAA,AAAA,OAAAD,6EAAAE,QAAAD;;;AAAA,AAOA,6CAAA,7CAAOQ,kGAAkB\/C;AAAzB,AACE,IAAAiC,qBAAiB,AAAA,iGAAcjC;AAA\/B,AAAA,oBAAAiC;AAAA,cAAAA,VAASC;AAAT,AACE,yCAAA,lCAAChC,0BAAMF,2EACA;kBAAKgD;AAAL,AACE,OAACrC,+BAAM,AAACP,gCAAc8B,QAAQc;;;;AACvChD;;;AAEJ;;;;qCAAA,rCAAMiD,kFAGHjD;AAHH,AAIE,kNAAIA,\/CACAD,rDACAM,lDACA,kDAAA,qDAAA,yDAAA,qEAAA,iEAAA,mFAAA,oHAAA,mFAAA,mHAAA,mFAAA,yHAAA,mFAAA,uHAAA,mFAAA,0HAAA,mFAAA,z2CAACiC,+bAAwDvB,sMAC3BA,uMAA6BG,+MAC3BH,wMAA6BG,0MAChC,l+CAO7B6B;AAP6B,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,5LAAW,AAAC\/B,6EAAc,AAACC,iFACd,AAACiC,iFAAiB,AAACC;WAJ7D,mFAAA,wEAK+B;AAAA,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,iFAAA,7QAAW,AAACnC,6EAAc,AAACC,iFACd,AAACiC,iFAAiB,AAACC,uFAChB,AAAChC;WAPhD,mFAAA,+GAAA,oEAAA,mFAAA,2GAAA,9SAQ6BC,kQAAqCA","names":["quil.middlewares.fun-mode\/wrap-setup","options","setup","cljs.core\/assoc","cljs.core\/reset!","quil.core\/state-atom","quil.middlewares.fun-mode\/wrap-draw-update","draw","_","update","cljs.core\/identity","quil-draw","cljs.core\/swap!","cljs.core\/=","quil.core\/frame-count","cljs.core\/dissoc","quil.middlewares.fun-mode\/mouse-event","quil.core\/mouse-x","quil.core\/mouse-y","quil.middlewares.fun-mode\/mouse-event-full","quil.core\/mouse-button","quil.middlewares.fun-mode\/key-event","quil.core\/key-as-keyword","quil.core\/key-code","quil.core\/raw-key","var_args","args9436","len__7927__auto__","i__7928__auto__","G__9438","quil.middlewares.fun-mode\/wrap-handler","js\/Error","handler-key","event-fn","temp__4655__auto__","handler","args__7934__auto__","argseq__7935__auto__","cljs.core\/IndexedSeq","quil.middlewares.fun-mode\/wrap-handlers","seq9443","G__9444","cljs.core\/first","cljs.core\/next","handlers","cljs.core\/reduce","cljs.core\/Keyword","cljs.core\/apply","quil.middlewares.fun-mode\/wrap-mouse-wheel","rotation","quil.middlewares.fun-mode\/fun-mode","quil.core\/pmouse-x","quil.core\/pmouse-y"]}
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/fun_mode.js","sources":["fun_mode.cljc"],"lineCount":142,"mappings":";AAAA;;;AAGA,uCAAA,vCAAOA,sFAAY;AAAnB,AACE,IAAM,QAAM,AAAA,qFAAQC,QAAQ;AAAA,AAAA;;AAA5B,AACE,yCAAA,uDAAA,zFAACC,0BAAMD;;AAAP,AACU,OAACE,gCAAO,AAACC,gCAAc,AAACC;;;;AAEtC,6CAAA,7CAAOC,kGAAkB;AAAzB,AACE,IAAM,OAAK,AAAA,mFAAOL,QAAQ,WAAK;AAAL,AAAA;;IACpB,SAAO,AAAA,uFAASA,QAAQM;gBAD9B,ZAEM;;AAFN,qDAEqB,AAACH,\/BACD,AAACI,+DAAM,EAAI,0DAAA,1DAACC,yBAAE,AAACC,uCACNH,mBACAI,1KACT,OAACC;;;AANtB,4DAOMX,3BACA,mCAAA,nCAACY,jCACD,8HAAA,vHAACX,4KAAYY;;AAErB,wCAAA,xCAAOC;AAAP,AAAA,kDAAA,4EAAA,7BACM,AAACC,6EACD,AAACC;;AAEP,6CAAA,7CAAOC;AAAP,AAAA,kDAAA,4EAAA,6EAAA,1GACM,AAACF,6EACD,AAACC,sFACI,AAACE;;AAEZ,sCAAA,tCAAOC;AAAP,AAAA,kDAAA,wFAAA,4FAAA,hIACQ,AAACC,kGACI,AAACC,yFACF,AAACC;;AAGb,AAAA,yCAAA,iDAAA,1FAAOE;AAAP,AAAA,IAAA,UAAA,AAAA;AAAA,AAAA,QAAAD;KAAA;AAAA,OAAAC,qEAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,qEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAC,MAAA,CAAA,8DAAA,AAAA;;;;;AAAA,AAAA,uEAAA,vEAAOD,kFACH,QAAQ;AADZ,AAEK,4EAAA,rEAACA,iDAAaxB,QAAQ0B;;;AAF3B,AAAA,uEAAA,vEAAOF,kFAGH,QAAQ,YAAY;AAHxB,AAIK,IAAA,qBAAiB,AAACxB,kBAAQ0B;AAA1B,AAAA,oBAAAC;AAAA,cAAAA,VAAS;AAAT,AACE,OAAC1B,0BAAMD,QAAQ0B,YACR,4BAAA,VAAIE;;AAAJ,AACG,OAACrB,+BAAM,AAACJ,gCAAc0B,QAAQ,AAACD;;CADlC;;AAAA,AAEG,OAACrB,+BAAM,AAACJ,gCAAc0B;;;;AAChC7B;;;;AATP,AAAA,iEAAA,jEAAOwB;;AAAP,AAWA,AAAA,0CAAA,kDAAA,5FAAOU;AAAP,AAAA,IAAA,qBAAA;AAAA,AAAA,IAAA,yBAAA,AAAA;AAAA,AAAA,IAAA,uBAAA;;AAAA,AAAA,GAAA,CAAAJ,uBAAAC;AAAA,AAAA,AAAAC,wBAAA,CAAA,UAAAF;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAA,uBAAA,EAAA,CAAA,MAAA,AAAAE,4BAAA,AAAA,KAAAC,qBAAA,AAAAD,yBAAA,KAAA,IAAA,OAAA;AAAA,AAAA,OAAAE,6EAAA,CAAA,UAAA,MAAAC;;;AAAA,AAAA,AAAA,AAAAD,+EAAA,WAAsB,QAAU;AAAhC,AACE,OAACO,2BAAO,WAAK,YAAQ;AAAb,AACE,GAAI,oBAAAC,nBAAUb;AACZ,OAACL,iDAAaxB,YAAQ6B;;AACtB,OAACc,0BAAMnB,uCAAaxB,YAAQ6B;;GAChC7B,QAAQ4C;;;AALlB,AAAA,AAAAV,kEAAA;;AAAA;AAAA,AAAA,AAAAA,4DAAA,WAAA;AAAA,AAAA,IAAA,UAAA,AAAAE,0BAAAC;IAAA,cAAA,AAAAC,yBAAAD;AAAA,AAAA,IAAA,qBAAA;AAAA,AAAA,OAAAE,wDAAAC,QAAAH;;;AAAA,AAOA,6CAAA,7CAAOQ,kGAAkB;AAAzB,AACE,IAAA,qBAAiB,AAAA,iGAAc7C;AAA\/B,AAAA,oBAAA2B;AAAA,cAAAA,VAAS;AAAT,AACE,yCAAA,lCAAC1B,0BAAMD,2EACA;kBAAK;AAAL,AACE,OAACO,+BAAM,AAACJ,gCAAc0B,QAAQiB;;;;AACvC9C;;;AAEJ;;;;qCAAA,rCAAM+C,kFAGH;AAHH,AAIE,kNAAI\/C,\/CACAD,rDACAM,lDACA,kDAAA,qDAAA,yDAAA,qEAAA,iEAAA,mFAAA,oHAAA,mFAAA,mHAAA,mFAAA,yHAAA,mFAAA,uHAAA,mFAAA,0HAAA,mFAAA,z2CAAC6B,+bAAwDpB,sMAC3BA,uMAA6BG,+MAC3BH,wMAA6BG,0MAChC,l+CAO7B4B;AAP6B,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,5LAAW,AAAC9B,6EAAc,AAACC,iFACd,AAACgC,iFAAiB,AAACC;WAJ7D,mFAAA,wEAK+B;AAAA,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,iFAAA,7QAAW,AAAClC,6EAAc,AAACC,iFACd,AAACgC,iFAAiB,AAACC,uFAChB,AAAC\/B;WAPhD,mFAAA,+GAAA,oEAAA,mFAAA,2GAAA,9SAQ6BC,kQAAqCA","names":["quil.middlewares.fun-mode\/wrap-setup","options","cljs.core\/assoc","cljs.core\/reset!","quil.core\/state-atom","setup","quil.middlewares.fun-mode\/wrap-draw-update","cljs.core\/identity","cljs.core\/swap!","cljs.core\/=","quil.core\/frame-count","update","draw","cljs.core\/dissoc","quil-draw","quil.middlewares.fun-mode\/mouse-event","quil.core\/mouse-x","quil.core\/mouse-y","quil.middlewares.fun-mode\/mouse-event-full","quil.core\/mouse-button","quil.middlewares.fun-mode\/key-event","quil.core\/key-as-keyword","quil.core\/key-code","quil.core\/raw-key","G__2134","quil.middlewares.fun-mode\/wrap-handler","js\/Error","handler-key","temp__4655__auto__","event-fn","handler","i__4642__auto__","len__4641__auto__","args__4647__auto__","cljs.core\/IndexedSeq","quil.middlewares.fun-mode\/wrap-handlers","argseq__4648__auto__","cljs.core\/first","seq2136","cljs.core\/next","self__4628__auto__","G__2137","cljs.core\/reduce","cljs.core\/Keyword","cljs.core\/apply","handlers","quil.middlewares.fun-mode\/wrap-mouse-wheel","rotation","quil.middlewares.fun-mode\/fun-mode","quil.core\/pmouse-x","quil.core\/pmouse-y"]}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.middlewares.navigation_2d');
|
||||
goog.require('cljs.core');
|
||||
goog.require('quil.core');
|
||||
quil.middlewares.navigation_2d.missing_navigation_key_error = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("state map is missing :navigation-2d key. "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("Did you accidentally removed it from the state in "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(":update or any other handler?")].join('');
|
||||
quil.middlewares.navigation_2d.missing_navigation_key_error = ["state map is missing :navigation-2d key. ","Did you accidentally removed it from the state in ",":update or any other handler?"].join('');
|
||||
/**
|
||||
* Asserts that state map contains :navigation-2d object.
|
||||
*/
|
||||
@ -27,8 +27,8 @@ return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"po
|
||||
quil.middlewares.navigation_2d.setup_2d_nav = (function quil$middlewares$navigation_2d$setup_2d_nav(user_setup,user_settings){
|
||||
var initial_state = cljs.core.merge.call(null,quil.middlewares.navigation_2d.default_position.call(null),cljs.core.select_keys.call(null,user_settings,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.Keyword(null,"zoom","zoom",-1827487038)], null)));
|
||||
return cljs.core.update_in.call(null,user_setup.call(null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611)], null),((function (initial_state){
|
||||
return (function (p1__9429_SHARP_){
|
||||
return cljs.core.merge.call(null,initial_state,p1__9429_SHARP_);
|
||||
return (function (p1__2126_SHARP_){
|
||||
return cljs.core.merge.call(null,initial_state,p1__2126_SHARP_);
|
||||
});})(initial_state))
|
||||
);
|
||||
});
|
||||
@ -61,15 +61,15 @@ quil.middlewares.navigation_2d.assert_state_has_navigation.call(null,state);
|
||||
|
||||
quil.core.push_matrix.call(null);
|
||||
|
||||
var nav_2d_9430 = new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var zoom_9431 = new cljs.core.Keyword(null,"zoom","zoom",-1827487038).cljs$core$IFn$_invoke$arity$1(nav_2d_9430);
|
||||
var pos_9432 = new cljs.core.Keyword(null,"position","position",-2011731912).cljs$core$IFn$_invoke$arity$1(nav_2d_9430);
|
||||
quil.core.scale.call(null,zoom_9431);
|
||||
var nav_2d_2127 = new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var zoom_2128 = new cljs.core.Keyword(null,"zoom","zoom",-1827487038).cljs$core$IFn$_invoke$arity$1(nav_2d_2127);
|
||||
var pos_2129 = new cljs.core.Keyword(null,"position","position",-2011731912).cljs$core$IFn$_invoke$arity$1(nav_2d_2127);
|
||||
quil.core.scale.call(null,zoom_2128);
|
||||
|
||||
var tr__9352__auto___9433 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(((quil.core.width.call(null) / (2)) / zoom_9431) - cljs.core.first.call(null,pos_9432)),(((quil.core.height.call(null) / (2)) / zoom_9431) - cljs.core.second.call(null,pos_9432))], null);
|
||||
var tr__2049__auto___2130 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(((quil.core.width.call(null) / (2)) / zoom_2128) - cljs.core.first.call(null,pos_2129)),(((quil.core.height.call(null) / (2)) / zoom_2128) - cljs.core.second.call(null,pos_2129))], null);
|
||||
quil.core.push_matrix.call(null);
|
||||
|
||||
try{quil.core.translate.call(null,tr__9352__auto___9433);
|
||||
try{quil.core.translate.call(null,tr__2049__auto___2130);
|
||||
|
||||
user_draw.call(null,state);
|
||||
}finally {quil.core.pop_matrix.call(null);
|
||||
@ -113,4 +113,4 @@ return user_mouse_wheel.call(null,quil.middlewares.navigation_2d.mouse_wheel.cal
|
||||
);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=navigation_2d.js.map
|
||||
//# sourceMappingURL=navigation_2d.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/navigation_2d.js","sources":["navigation_2d.cljc"],"lineCount":116,"mappings":";AAAA;;;AAGA,AAAeA,8DACb,6CAAA,yFAAA,kGAAA;AAIF;;;6DAAA,7DAAOC,kIAEJC;AAFH,AAGE,oBAAU,AAAA,sGAAgBA;AAA1B;;AAAA,AACE,MACgB,KAAAC,MAAWH;;;AAE\/B;;;;kDAAA,lDAAOI;AAAP,AAAA,kDAAA,8DAAA,kKAAA,sDAAA,rIAIc,8BAAA,7BAAG,AAACC,kCACJ,+BAAA,9BAAG,AAACC;;AAGlB;;;;8CAAA,9CAAOC,oGAGJC,WAAWC;AAHd,AAIE,IAAMC,qIAAkBD,hCACA,8CAAA,mFAAA,8DAAA,\/LAACE,rFACI,AAACC,0BAAM,AAACR;AAFrC,AAGE,2DAAA,mFAAA,gFAAA,vNAACU,8BAAU,AAACN;kBAAZK;AAAA,AACY,+CAAAA,xCAACD,0BAAMF;;;;AAEvB;;;;+CAAA,\/CAAOK,sGAGJb,MAAMc;AAHT,AAIE,AAACf,qEAA4BC;;AAC7B,IAAMe,KAAG,CAAG,AAAA,kFAAMD,SAAO,AAAA,6EAAIA;IACvBE,KAAG,CAAG,AAAA,iFAAMF,SAAO,AAAA,8EAAIA;IACvBG,OAAK,AAAA,oFAAA,AAAA,sGAAIjB;AAFf,mEAGKA,9BACA,oCAAA,mFAAA,wEAAA,8DAAA,7PAACY,yQAAuCM,iBAAE,CAAGH,KAAGE,rUAChD,4UAAA,mFAAA,wEAAA,8DAAA,9hBAACL,0iBAAuCM,iBAAE,CAAGF,KAAGC;;AAEvD;;;6CAAA,7CAAOE,kGAEJnB,MAAMc;AAFT,AAGE,AAACf,qEAA4BC;;AAC7B,2CAAA,mFAAA,wEAAA,\/LAACY,8BAAUZ,+NAA6BoB,iBAAE,CAAA,MAAK,CAAA,OAAQN;;AAEzD;;;;sCAAA,tCAAOO,oFAGJC,UAAUtB;AAHb,AAIE,AAACD,qEAA4BC;;AAC7B,AAACuB;;AACD,IAAMC,cAAO,AAAA,sGAAgBxB;IACvBiB,YAAK,AAAA,oFAAOO;IACZC,WAAI,AAAA,4FAAWD;AAFrB,AAGE,AAACE,0BAAQT;;AACT,IAAAU,wBAAA,mFAAqB,CAAG,CAAA,8BAAA,7BAAG,AAACxB,oCAAWc,aAAM,AAACa,0BAAML,WAC\/B,CAAG,CAAA,+BAAA,9BAAG,AAACrB,qCAAYa,aAAM,AAACc,2BAAON;AADtD,AAAA,AAAAF;;AAAA,IAAA,AAAA,AAAAK,8BAAAD;;AAEE,AAACL,oBAAUtB;UAFb,AAAA,AAAA6B;;AAGF,OAACA;;AAEH;;;;+CAAA,\/CAAMG,sGAGHC;AAHH,AAIE,IACM1B,gBAAc,AAAA,sGAAgB0B;IAI9BX,YAAU,AAAA,mFAAOW,QAAQ;kBAAKjC;AAAL,AAAA;;;IACzBkC,qBAAmB,AAAA,sGAAgBD,QAAQ;kBAAKjC,MAAMmC;AAAX,AAAcnC;;;IACzDoC,mBAAiB,AAAA,iGAAcH,QAAQ;kBAAKjC,MAAMmC;AAAX,AAAcnC;;;IACrDqC,QAAM,AAAA,qFAAQJ,QAAQ;;AAAA,AAAA;;;AAR5B,AASE,yCAAA,oJAAA,gIAAA,tTAACK,0BAAML,+DAEE,AAACM,4BAAQlC,4CAAagC,MAAM9B,oEAE7B,AAACgC,4BAAQlB,oCAAKC,mFAEL;kBAAKtB,MAAMc;AAAX,AACE,OAACoB,6BAAmB,AAACrB,uDAAcb,MAAMc,OAAOA;;CAPnE,mEAQe;kBAAKd,MAAMc;AAAX,AACE,OAACsB,2BAAiB,AAACjB,qDAAYnB,MAAMc,OAAOA","names":["quil.middlewares.navigation-2d\/missing-navigation-key-error","quil.middlewares.navigation-2d\/assert-state-has-navigation","state","js\/Error","quil.middlewares.navigation-2d\/default-position","quil.core\/width","quil.core\/height","quil.middlewares.navigation-2d\/setup-2d-nav","user-setup","user-settings","initial-state","cljs.core\/select-keys","cljs.core\/merge","p1__9429#","cljs.core\/update-in","quil.middlewares.navigation-2d\/mouse-dragged","event","dx","dy","zoom","cljs.core\/+","quil.middlewares.navigation-2d\/mouse-wheel","cljs.core\/*","quil.middlewares.navigation-2d\/draw","user-draw","quil.core\/push-matrix","nav-2d","pos","quil.core\/scale","tr__9352__auto__","quil.core\/translate","quil.core\/pop-matrix","cljs.core\/first","cljs.core\/second","quil.middlewares.navigation-2d\/navigation-2d","options","user-mouse-dragged","_","user-mouse-wheel","setup","cljs.core\/assoc","cljs.core\/partial"]}
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/navigation_2d.js","sources":["navigation_2d.cljc"],"lineCount":116,"mappings":";AAAA;;;AAGA,AAAeA,8DACb,CAAA,4CAAA,qDAAA;AAIF;;;6DAAA,7DAAOC,kIAEJ;AAFH,AAGE,oBAAU,AAAA,sGAAgBC;AAA1B;;AAAA,AACE,MACgB,KAAAC,MAAWH;;;AAE\/B;;;;kDAAA,lDAAOI;AAAP,AAAA,kDAAA,8DAAA,kKAAA,sDAAA,rIAIc,8BAAA,7BAAG,AAACC,kCACJ,+BAAA,9BAAG,AAACC;;AAGlB;;;;8CAAA,9CAAOC,oGAGJ,WAAW;AAHd,AAIE,IAAM,qIAAkBC,hCACA,8CAAA,mFAAA,8DAAA,\/LAACC,rFACI,AAACC,0BAAM,AAACN;AAFrC,AAGE,2DAAA,mFAAA,gFAAA,vNAACO,8BAAU,AAACC;kBAAZ;AAAA,AACY,+CAAAC,xCAACH,0BAAMI;;;;AAEvB;;;;+CAAA,\/CAAOC,sGAGJ,MAAM;AAHT,AAIE,AAACd,qEAA4BC;;AAC7B,IAAM,KAAG,CAAG,AAAA,kFAAMc,SAAO,AAAA,6EAAIA;IACvB,KAAG,CAAG,AAAA,iFAAMA,SAAO,AAAA,8EAAIA;IACvB,OAAK,AAAA,oFAAA,AAAA,sGAAId;AAFf,mEAGKA,9BACA,oCAAA,mFAAA,wEAAA,8DAAA,7PAACS,yQAAuCM,iBAAE,CAAGC,KAAGC,rUAChD,4UAAA,mFAAA,wEAAA,8DAAA,9hBAACR,0iBAAuCM,iBAAE,CAAGG,KAAGD;;AAEvD;;;6CAAA,7CAAOE,kGAEJ,MAAM;AAFT,AAGE,AAACpB,qEAA4BC;;AAC7B,2CAAA,mFAAA,wEAAA,\/LAACS,8BAAUT,+NAA6BoB,iBAAE,CAAA,MAAK,CAAA,OAAQN;;AAEzD;;;;sCAAA,tCAAOO,oFAGJ,UAAU;AAHb,AAIE,AAACtB,qEAA4BC;;AAC7B,AAACsB;;AACD,IAAM,cAAO,AAAA,sGAAgBtB;IACvB,YAAK,AAAA,oFAAOuB;IACZ,WAAI,AAAA,4FAAWA;AAFrB,AAGE,AAACC,0BAAQP;;AACT,IAAA,wBAAA,mFAAqB,CAAG,CAAA,8BAAA,7BAAG,AAACd,oCAAWc,aAAM,AAACW,0BAAMC,WAC\/B,CAAG,CAAA,+BAAA,9BAAG,AAACzB,qCAAYa,aAAM,AAACa,2BAAOD;AADtD,AAAA,AAAAP;;AAAA,IAAA,AAAA,AAAAG,8BAAAC;;AAEE,AAACK,oBAAU\/B;UAFb,AAAA,AAAA2B;;AAGF,OAACA;;AAEH;;;;+CAAA,\/CAAMK,sGAGH;AAHH,AAIE,IACM,gBAAc,AAAA,sGAAgBC;IAI9B,YAAU,AAAA,mFAAOA,QAAQ;kBAAK;AAAL,AAAA;;;IACzB,qBAAmB,AAAA,sGAAgBA,QAAQ;kBAAK,MAAM;AAAX,AAAcjC;;;IACzD,mBAAiB,AAAA,iGAAciC,QAAQ;kBAAK,MAAM;AAAX,AAAcjC;;;IACrD,QAAM,AAAA,qFAAQiC,QAAQ;;AAAA,AAAA;;;AAR5B,AASE,yCAAA,oJAAA,gIAAA,tTAACC,0BAAMD,+DAEE,AAACE,4BAAQ9B,4CAAa+B,MAAM9B,oEAE7B,AAAC6B,4BAAQd,oCAAKU,mFAEL;kBAAK,MAAM;AAAX,AACE,OAACM,6BAAmB,AAACxB,uDAAcb,MAAMc,OAAOA;;CAPnE,mEAQe;kBAAK,MAAM;AAAX,AACE,OAACwB,2BAAiB,AAACnB,qDAAYnB,MAAMc,OAAOA","names":["quil.middlewares.navigation-2d\/missing-navigation-key-error","quil.middlewares.navigation-2d\/assert-state-has-navigation","state","js\/Error","quil.middlewares.navigation-2d\/default-position","quil.core\/width","quil.core\/height","quil.middlewares.navigation-2d\/setup-2d-nav","user-settings","cljs.core\/select-keys","cljs.core\/merge","cljs.core\/update-in","user-setup","p1__2126#","initial-state","quil.middlewares.navigation-2d\/mouse-dragged","event","cljs.core\/+","dx","zoom","dy","quil.middlewares.navigation-2d\/mouse-wheel","cljs.core\/*","quil.middlewares.navigation-2d\/draw","quil.core\/push-matrix","nav-2d","quil.core\/scale","quil.core\/translate","tr__2049__auto__","quil.core\/pop-matrix","cljs.core\/first","pos","cljs.core\/second","user-draw","quil.middlewares.navigation-2d\/navigation-2d","options","cljs.core\/assoc","cljs.core\/partial","setup","user-mouse-dragged","user-mouse-wheel"]}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.middlewares.navigation_3d');
|
||||
goog.require('cljs.core');
|
||||
goog.require('quil.core');
|
||||
quil.middlewares.navigation_3d.missing_navigation_key_error = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("state map is missing :navigation-3d key. "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("Did you accidentally removed it from the state in "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(":update or any other handler?")].join('');
|
||||
quil.middlewares.navigation_3d.missing_navigation_key_error = ["state map is missing :navigation-3d key. ","Did you accidentally removed it from the state in ",":update or any other handler?"].join('');
|
||||
/**
|
||||
* Asserts that state map contains :navigation-2d object.
|
||||
*/
|
||||
@ -26,14 +26,14 @@ return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"po
|
||||
* http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
|
||||
*/
|
||||
quil.middlewares.navigation_3d.rotate_by_axis_and_angle = (function quil$middlewares$navigation_3d$rotate_by_axis_and_angle(v,axis,angle){
|
||||
var vec__8901 = axis;
|
||||
var a_x = cljs.core.nth.call(null,vec__8901,(0),null);
|
||||
var a_y = cljs.core.nth.call(null,vec__8901,(1),null);
|
||||
var a_z = cljs.core.nth.call(null,vec__8901,(2),null);
|
||||
var vec__8904 = v;
|
||||
var x = cljs.core.nth.call(null,vec__8904,(0),null);
|
||||
var y = cljs.core.nth.call(null,vec__8904,(1),null);
|
||||
var z = cljs.core.nth.call(null,vec__8904,(2),null);
|
||||
var vec__1620 = axis;
|
||||
var a_x = cljs.core.nth.call(null,vec__1620,(0),null);
|
||||
var a_y = cljs.core.nth.call(null,vec__1620,(1),null);
|
||||
var a_z = cljs.core.nth.call(null,vec__1620,(2),null);
|
||||
var vec__1623 = v;
|
||||
var x = cljs.core.nth.call(null,vec__1623,(0),null);
|
||||
var y = cljs.core.nth.call(null,vec__1623,(1),null);
|
||||
var z = cljs.core.nth.call(null,vec__1623,(2),null);
|
||||
var cs = quil.core.cos.call(null,angle);
|
||||
var _cs = ((1) - cs);
|
||||
var sn = quil.core.sin.call(null,angle);
|
||||
@ -58,23 +58,23 @@ return cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null,
|
||||
/**
|
||||
* Vector cross-product: http://en.wikipedia.org/wiki/Cross_product
|
||||
*/
|
||||
quil.middlewares.navigation_3d.cross_product = (function quil$middlewares$navigation_3d$cross_product(p__8907,p__8908){
|
||||
var vec__8915 = p__8907;
|
||||
var u1 = cljs.core.nth.call(null,vec__8915,(0),null);
|
||||
var u2 = cljs.core.nth.call(null,vec__8915,(1),null);
|
||||
var u3 = cljs.core.nth.call(null,vec__8915,(2),null);
|
||||
var vec__8918 = p__8908;
|
||||
var v1 = cljs.core.nth.call(null,vec__8918,(0),null);
|
||||
var v2 = cljs.core.nth.call(null,vec__8918,(1),null);
|
||||
var v3 = cljs.core.nth.call(null,vec__8918,(2),null);
|
||||
quil.middlewares.navigation_3d.cross_product = (function quil$middlewares$navigation_3d$cross_product(p__1626,p__1627){
|
||||
var vec__1628 = p__1626;
|
||||
var u1 = cljs.core.nth.call(null,vec__1628,(0),null);
|
||||
var u2 = cljs.core.nth.call(null,vec__1628,(1),null);
|
||||
var u3 = cljs.core.nth.call(null,vec__1628,(2),null);
|
||||
var vec__1631 = p__1627;
|
||||
var v1 = cljs.core.nth.call(null,vec__1631,(0),null);
|
||||
var v2 = cljs.core.nth.call(null,vec__1631,(1),null);
|
||||
var v3 = cljs.core.nth.call(null,vec__1631,(2),null);
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [((u2 * v3) - (u3 * v2)),((u3 * v1) - (u1 * v3)),((u1 * v2) - (u2 * v1))], null);
|
||||
});
|
||||
/**
|
||||
* Multiply vector v by scalar mult.
|
||||
*/
|
||||
quil.middlewares.navigation_3d.v_mult = (function quil$middlewares$navigation_3d$v_mult(v,mult){
|
||||
return cljs.core.mapv.call(null,(function (p1__8921_SHARP_){
|
||||
return (p1__8921_SHARP_ * mult);
|
||||
return cljs.core.mapv.call(null,(function (p1__1634_SHARP_){
|
||||
return (p1__1634_SHARP_ * mult);
|
||||
}),v);
|
||||
});
|
||||
/**
|
||||
@ -103,8 +103,8 @@ return quil.middlewares.navigation_3d.v_mult.call(null,v,((1) / norm));
|
||||
quil.middlewares.navigation_3d.rotate_ud = (function quil$middlewares$navigation_3d$rotate_ud(nav_3d,angle){
|
||||
var axis = quil.middlewares.navigation_3d.cross_product.call(null,new cljs.core.Keyword(null,"straight","straight",-1252567854).cljs$core$IFn$_invoke$arity$1(nav_3d),new cljs.core.Keyword(null,"up","up",-269712113).cljs$core$IFn$_invoke$arity$1(nav_3d));
|
||||
var rotate = ((function (axis){
|
||||
return (function (p1__8922_SHARP_){
|
||||
return quil.middlewares.navigation_3d.rotate_by_axis_and_angle.call(null,p1__8922_SHARP_,axis,angle);
|
||||
return (function (p1__1635_SHARP_){
|
||||
return quil.middlewares.navigation_3d.rotate_by_axis_and_angle.call(null,p1__1635_SHARP_,axis,angle);
|
||||
});})(axis))
|
||||
;
|
||||
return cljs.core.update_in.call(null,cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),rotate),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),rotate);
|
||||
@ -125,8 +125,8 @@ var dy = (new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$
|
||||
var angle_lr = quil.core.map_range.call(null,dx,(0),pixels_in_360,(0),quil.core.TWO_PI);
|
||||
var angle_ud = quil.core.map_range.call(null,dy,(0),pixels_in_360,(0),quil.core.TWO_PI);
|
||||
return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (dx,dy,angle_lr,angle_ud){
|
||||
return (function (p1__8923_SHARP_){
|
||||
return quil.middlewares.navigation_3d.rotate_ud.call(null,quil.middlewares.navigation_3d.rotate_lr.call(null,p1__8923_SHARP_,angle_lr),angle_ud);
|
||||
return (function (p1__1636_SHARP_){
|
||||
return quil.middlewares.navigation_3d.rotate_ud.call(null,quil.middlewares.navigation_3d.rotate_lr.call(null,p1__1636_SHARP_,angle_lr),angle_ud);
|
||||
});})(dx,dy,angle_lr,angle_ud))
|
||||
);
|
||||
}
|
||||
@ -140,28 +140,28 @@ quil.middlewares.navigation_3d.space = cljs.core.keyword.call(null," ");
|
||||
quil.middlewares.navigation_3d.move = (function quil$middlewares$navigation_3d$move(state,event,step_size){
|
||||
quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state);
|
||||
|
||||
var map__8930 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var map__8930__$1 = ((((!((map__8930 == null)))?((((map__8930.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8930.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8930):map__8930);
|
||||
var up = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"up","up",-269712113));
|
||||
var straight = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
|
||||
var temp__4655__auto__ = (function (){var pred__8932 = cljs.core._EQ_;
|
||||
var expr__8933 = new cljs.core.Keyword(null,"key","key",-1516042587).cljs$core$IFn$_invoke$arity$1(event);
|
||||
if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__8933))){
|
||||
var map__1638 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var map__1638__$1 = (((((!((map__1638 == null))))?(((((map__1638.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__1638.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__1638):map__1638);
|
||||
var up = cljs.core.get.call(null,map__1638__$1,new cljs.core.Keyword(null,"up","up",-269712113));
|
||||
var straight = cljs.core.get.call(null,map__1638__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
|
||||
var temp__4655__auto__ = (function (){var pred__1640 = cljs.core._EQ_;
|
||||
var expr__1641 = new cljs.core.Keyword(null,"key","key",-1516042587).cljs$core$IFn$_invoke$arity$1(event);
|
||||
if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__1641))){
|
||||
return straight;
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"s","s",1705939918),expr__8933))){
|
||||
if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"s","s",1705939918),expr__1641))){
|
||||
return quil.middlewares.navigation_3d.v_opposite.call(null,straight);
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8932.call(null,quil.middlewares.navigation_3d.space,expr__8933))){
|
||||
if(cljs.core.truth_(pred__1640.call(null,quil.middlewares.navigation_3d.space,expr__1641))){
|
||||
return quil.middlewares.navigation_3d.v_opposite.call(null,up);
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"z","z",-789527183),expr__8933))){
|
||||
if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"z","z",-789527183),expr__1641))){
|
||||
return up;
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"d","d",1972142424),expr__8933))){
|
||||
if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"d","d",1972142424),expr__1641))){
|
||||
return quil.middlewares.navigation_3d.cross_product.call(null,straight,up);
|
||||
} else {
|
||||
if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"a","a",-2123407586),expr__8933))){
|
||||
if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"a","a",-2123407586),expr__1641))){
|
||||
return quil.middlewares.navigation_3d.cross_product.call(null,up,straight);
|
||||
} else {
|
||||
return null;
|
||||
@ -174,10 +174,10 @@ return null;
|
||||
})();
|
||||
if(cljs.core.truth_(temp__4655__auto__)){
|
||||
var dir = temp__4655__auto__;
|
||||
return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301),new cljs.core.Keyword(null,"position","position",-2011731912)], null),((function (dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight){
|
||||
return (function (p1__8924_SHARP_){
|
||||
return quil.middlewares.navigation_3d.v_plus.call(null,p1__8924_SHARP_,quil.middlewares.navigation_3d.v_mult.call(null,dir,step_size));
|
||||
});})(dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight))
|
||||
return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301),new cljs.core.Keyword(null,"position","position",-2011731912)], null),((function (dir,temp__4655__auto__,map__1638,map__1638__$1,up,straight){
|
||||
return (function (p1__1637_SHARP_){
|
||||
return quil.middlewares.navigation_3d.v_plus.call(null,p1__1637_SHARP_,quil.middlewares.navigation_3d.v_mult.call(null,dir,step_size));
|
||||
});})(dir,temp__4655__auto__,map__1638,map__1638__$1,up,straight))
|
||||
);
|
||||
} else {
|
||||
return state;
|
||||
@ -190,8 +190,8 @@ return state;
|
||||
quil.middlewares.navigation_3d.setup_3d_nav = (function quil$middlewares$navigation_3d$setup_3d_nav(user_setup,user_settings){
|
||||
var initial_state = cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.merge.call(null,quil.middlewares.navigation_3d.default_position.call(null),cljs.core.select_keys.call(null,user_settings,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854),new cljs.core.Keyword(null,"up","up",-269712113),new cljs.core.Keyword(null,"position","position",-2011731912)], null))),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),quil.middlewares.navigation_3d.v_normalize),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),quil.middlewares.navigation_3d.v_normalize);
|
||||
return cljs.core.update_in.call(null,user_setup.call(null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (initial_state){
|
||||
return (function (p1__8935_SHARP_){
|
||||
return cljs.core.merge.call(null,initial_state,p1__8935_SHARP_);
|
||||
return (function (p1__1643_SHARP_){
|
||||
return cljs.core.merge.call(null,initial_state,p1__1643_SHARP_);
|
||||
});})(initial_state))
|
||||
);
|
||||
});
|
||||
@ -229,21 +229,21 @@ return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"setup","set
|
||||
return (function (state){
|
||||
quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state);
|
||||
|
||||
var map__8947_8958 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var map__8947_8959__$1 = ((((!((map__8947_8958 == null)))?((((map__8947_8958.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8947_8958.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8947_8958):map__8947_8958);
|
||||
var vec__8948_8960 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
|
||||
var c_x_8961 = cljs.core.nth.call(null,vec__8948_8960,(0),null);
|
||||
var c_y_8962 = cljs.core.nth.call(null,vec__8948_8960,(1),null);
|
||||
var c_z_8963 = cljs.core.nth.call(null,vec__8948_8960,(2),null);
|
||||
var vec__8951_8964 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"up","up",-269712113));
|
||||
var u_x_8965 = cljs.core.nth.call(null,vec__8951_8964,(0),null);
|
||||
var u_y_8966 = cljs.core.nth.call(null,vec__8951_8964,(1),null);
|
||||
var u_z_8967 = cljs.core.nth.call(null,vec__8951_8964,(2),null);
|
||||
var vec__8954_8968 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"position","position",-2011731912));
|
||||
var p_x_8969 = cljs.core.nth.call(null,vec__8954_8968,(0),null);
|
||||
var p_y_8970 = cljs.core.nth.call(null,vec__8954_8968,(1),null);
|
||||
var p_z_8971 = cljs.core.nth.call(null,vec__8954_8968,(2),null);
|
||||
quil.core.camera.call(null,p_x_8969,p_y_8970,p_z_8971,(p_x_8969 + c_x_8961),(p_y_8970 + c_y_8962),(p_z_8971 + c_z_8963),u_x_8965,u_y_8966,u_z_8967);
|
||||
var map__1644_1655 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
|
||||
var map__1644_1656__$1 = (((((!((map__1644_1655 == null))))?(((((map__1644_1655.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__1644_1655.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__1644_1655):map__1644_1655);
|
||||
var vec__1645_1657 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
|
||||
var c_x_1658 = cljs.core.nth.call(null,vec__1645_1657,(0),null);
|
||||
var c_y_1659 = cljs.core.nth.call(null,vec__1645_1657,(1),null);
|
||||
var c_z_1660 = cljs.core.nth.call(null,vec__1645_1657,(2),null);
|
||||
var vec__1648_1661 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"up","up",-269712113));
|
||||
var u_x_1662 = cljs.core.nth.call(null,vec__1648_1661,(0),null);
|
||||
var u_y_1663 = cljs.core.nth.call(null,vec__1648_1661,(1),null);
|
||||
var u_z_1664 = cljs.core.nth.call(null,vec__1648_1661,(2),null);
|
||||
var vec__1651_1665 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"position","position",-2011731912));
|
||||
var p_x_1666 = cljs.core.nth.call(null,vec__1651_1665,(0),null);
|
||||
var p_y_1667 = cljs.core.nth.call(null,vec__1651_1665,(1),null);
|
||||
var p_z_1668 = cljs.core.nth.call(null,vec__1651_1665,(2),null);
|
||||
quil.core.camera.call(null,p_x_1666,p_y_1667,p_z_1668,(p_x_1666 + c_x_1658),(p_y_1667 + c_y_1659),(p_z_1668 + c_z_1660),u_x_1662,u_y_1663,u_z_1664);
|
||||
|
||||
return draw.call(null,state);
|
||||
});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup))
|
||||
@ -258,4 +258,4 @@ return rotate_on_fn.call(null,quil.middlewares.navigation_3d.rotate.call(null,st
|
||||
);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=navigation_3d.js.map
|
||||
//# sourceMappingURL=navigation_3d.js.map
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
assets/viz/2/quil/sketch.cljs.cache.json
Normal file
1
assets/viz/2/quil/sketch.cljs.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.sketch');
|
||||
goog.require('cljs.core');
|
||||
goog.require('quil.util');
|
||||
@ -15,23 +15,8 @@ quil.sketch.resolve_renderer = (function quil$sketch$resolve_renderer(mode){
|
||||
return quil.util.resolve_constant_key.call(null,mode,quil.sketch.rendering_modes);
|
||||
});
|
||||
quil.sketch.size = (function quil$sketch$size(var_args){
|
||||
var args8190 = [];
|
||||
var len__7927__auto___8193 = arguments.length;
|
||||
var i__7928__auto___8194 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8194 < len__7927__auto___8193)){
|
||||
args8190.push((arguments[i__7928__auto___8194]));
|
||||
|
||||
var G__8195 = (i__7928__auto___8194 + (1));
|
||||
i__7928__auto___8194 = G__8195;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8192 = args8190.length;
|
||||
switch (G__8192) {
|
||||
var G__1217 = arguments.length;
|
||||
switch (G__1217) {
|
||||
case 2:
|
||||
return quil.sketch.size.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
@ -41,7 +26,7 @@ return quil.sketch.size.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(argument
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8190.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -57,81 +42,85 @@ return quil.sketch.current_applet.call(null).size((width | (0)),(height | (0)),q
|
||||
quil.sketch.size.cljs$lang$maxFixedArity = 3;
|
||||
|
||||
quil.sketch.bind_handlers = (function quil$sketch$bind_handlers(prc,opts){
|
||||
var seq__8209 = cljs.core.seq.call(null,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"keyPressed","keyPressed",1791025256),new cljs.core.Keyword(null,"mouseOut","mouseOut",-386669045),new cljs.core.Keyword(null,"mouseScrolled","mouseScrolled",31878252),new cljs.core.Keyword(null,"mouseDragged","mouseDragged",129975181),new cljs.core.Keyword(null,"setup","setup",1987730512),new cljs.core.Keyword(null,"keyReleased","keyReleased",541714964),new cljs.core.Keyword(null,"mouseClicked","mouseClicked",1764302965),new cljs.core.Keyword(null,"mouseReleased","mouseReleased",1116234838),new cljs.core.Keyword(null,"mousePressed","mousePressed",1776186454),new cljs.core.Keyword(null,"mouseMoved","mouseMoved",-1936954058),new cljs.core.Keyword(null,"mouseOver","mouseOver",-1334461930),new cljs.core.Keyword(null,"keyTyped","keyTyped",1437329399),new cljs.core.Keyword(null,"draw","draw",1358331674)],[new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364),new cljs.core.Keyword(null,"mouse-exited","mouse-exited",-483205244),new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439),new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441),new cljs.core.Keyword(null,"setup","setup",1987730512),new cljs.core.Keyword(null,"key-released","key-released",215919828),new cljs.core.Keyword(null,"mouse-clicked","mouse-clicked",-199339421),new cljs.core.Keyword(null,"mouse-released","mouse-released",-664480061),new cljs.core.Keyword(null,"mouse-pressed","mouse-pressed",736955536),new cljs.core.Keyword(null,"mouse-moved","mouse-moved",-1918152310),new cljs.core.Keyword(null,"mouse-entered","mouse-entered",811350322),new cljs.core.Keyword(null,"key-typed","key-typed",-876037597),new cljs.core.Keyword(null,"draw","draw",1358331674)]));
|
||||
var chunk__8210 = null;
|
||||
var count__8211 = (0);
|
||||
var i__8212 = (0);
|
||||
var seq__1219 = cljs.core.seq.call(null,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"keyPressed","keyPressed",1791025256),new cljs.core.Keyword(null,"mouseOut","mouseOut",-386669045),new cljs.core.Keyword(null,"mouseScrolled","mouseScrolled",31878252),new cljs.core.Keyword(null,"mouseDragged","mouseDragged",129975181),new cljs.core.Keyword(null,"setup","setup",1987730512),new cljs.core.Keyword(null,"keyReleased","keyReleased",541714964),new cljs.core.Keyword(null,"mouseClicked","mouseClicked",1764302965),new cljs.core.Keyword(null,"mouseReleased","mouseReleased",1116234838),new cljs.core.Keyword(null,"mousePressed","mousePressed",1776186454),new cljs.core.Keyword(null,"mouseMoved","mouseMoved",-1936954058),new cljs.core.Keyword(null,"mouseOver","mouseOver",-1334461930),new cljs.core.Keyword(null,"keyTyped","keyTyped",1437329399),new cljs.core.Keyword(null,"draw","draw",1358331674)],[new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364),new cljs.core.Keyword(null,"mouse-exited","mouse-exited",-483205244),new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439),new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441),new cljs.core.Keyword(null,"setup","setup",1987730512),new cljs.core.Keyword(null,"key-released","key-released",215919828),new cljs.core.Keyword(null,"mouse-clicked","mouse-clicked",-199339421),new cljs.core.Keyword(null,"mouse-released","mouse-released",-664480061),new cljs.core.Keyword(null,"mouse-pressed","mouse-pressed",736955536),new cljs.core.Keyword(null,"mouse-moved","mouse-moved",-1918152310),new cljs.core.Keyword(null,"mouse-entered","mouse-entered",811350322),new cljs.core.Keyword(null,"key-typed","key-typed",-876037597),new cljs.core.Keyword(null,"draw","draw",1358331674)]));
|
||||
var chunk__1220 = null;
|
||||
var count__1221 = (0);
|
||||
var i__1222 = (0);
|
||||
while(true){
|
||||
if((i__8212 < count__8211)){
|
||||
var vec__8213 = cljs.core._nth.call(null,chunk__8210,i__8212);
|
||||
var processing_name = cljs.core.nth.call(null,vec__8213,(0),null);
|
||||
var quil_name = cljs.core.nth.call(null,vec__8213,(1),null);
|
||||
var temp__4657__auto___8221 = opts.call(null,quil_name);
|
||||
if(cljs.core.truth_(temp__4657__auto___8221)){
|
||||
var handler_8222 = temp__4657__auto___8221;
|
||||
(prc[cljs.core.name.call(null,processing_name)] = ((function (seq__8209,chunk__8210,count__8211,i__8212,handler_8222,temp__4657__auto___8221,vec__8213,processing_name,quil_name){
|
||||
if((i__1222 < count__1221)){
|
||||
var vec__1223 = cljs.core._nth.call(null,chunk__1220,i__1222);
|
||||
var processing_name = cljs.core.nth.call(null,vec__1223,(0),null);
|
||||
var quil_name = cljs.core.nth.call(null,vec__1223,(1),null);
|
||||
var temp__4657__auto___1233 = opts.call(null,quil_name);
|
||||
if(cljs.core.truth_(temp__4657__auto___1233)){
|
||||
var handler_1234 = temp__4657__auto___1233;
|
||||
(prc[cljs.core.name.call(null,processing_name)] = ((function (seq__1219,chunk__1220,count__1221,i__1222,handler_1234,temp__4657__auto___1233,vec__1223,processing_name,quil_name){
|
||||
return (function (){
|
||||
var _STAR_applet_STAR_8216 = quil.sketch._STAR_applet_STAR_;
|
||||
quil.sketch._STAR_applet_STAR_ = prc;
|
||||
var _STAR_applet_STAR__orig_val__1226 = quil.sketch._STAR_applet_STAR_;
|
||||
var _STAR_applet_STAR__temp_val__1227 = prc;
|
||||
quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR__temp_val__1227;
|
||||
|
||||
try{return handler_8222.call(null);
|
||||
}finally {quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR_8216;
|
||||
}});})(seq__8209,chunk__8210,count__8211,i__8212,handler_8222,temp__4657__auto___8221,vec__8213,processing_name,quil_name))
|
||||
try{return handler_1234.call(null);
|
||||
}finally {quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR__orig_val__1226;
|
||||
}});})(seq__1219,chunk__1220,count__1221,i__1222,handler_1234,temp__4657__auto___1233,vec__1223,processing_name,quil_name))
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
var G__8223 = seq__8209;
|
||||
var G__8224 = chunk__8210;
|
||||
var G__8225 = count__8211;
|
||||
var G__8226 = (i__8212 + (1));
|
||||
seq__8209 = G__8223;
|
||||
chunk__8210 = G__8224;
|
||||
count__8211 = G__8225;
|
||||
i__8212 = G__8226;
|
||||
|
||||
var G__1235 = seq__1219;
|
||||
var G__1236 = chunk__1220;
|
||||
var G__1237 = count__1221;
|
||||
var G__1238 = (i__1222 + (1));
|
||||
seq__1219 = G__1235;
|
||||
chunk__1220 = G__1236;
|
||||
count__1221 = G__1237;
|
||||
i__1222 = G__1238;
|
||||
continue;
|
||||
} else {
|
||||
var temp__4657__auto__ = cljs.core.seq.call(null,seq__8209);
|
||||
var temp__4657__auto__ = cljs.core.seq.call(null,seq__1219);
|
||||
if(temp__4657__auto__){
|
||||
var seq__8209__$1 = temp__4657__auto__;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,seq__8209__$1)){
|
||||
var c__7633__auto__ = cljs.core.chunk_first.call(null,seq__8209__$1);
|
||||
var G__8227 = cljs.core.chunk_rest.call(null,seq__8209__$1);
|
||||
var G__8228 = c__7633__auto__;
|
||||
var G__8229 = cljs.core.count.call(null,c__7633__auto__);
|
||||
var G__8230 = (0);
|
||||
seq__8209 = G__8227;
|
||||
chunk__8210 = G__8228;
|
||||
count__8211 = G__8229;
|
||||
i__8212 = G__8230;
|
||||
var seq__1219__$1 = temp__4657__auto__;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,seq__1219__$1)){
|
||||
var c__4461__auto__ = cljs.core.chunk_first.call(null,seq__1219__$1);
|
||||
var G__1239 = cljs.core.chunk_rest.call(null,seq__1219__$1);
|
||||
var G__1240 = c__4461__auto__;
|
||||
var G__1241 = cljs.core.count.call(null,c__4461__auto__);
|
||||
var G__1242 = (0);
|
||||
seq__1219 = G__1239;
|
||||
chunk__1220 = G__1240;
|
||||
count__1221 = G__1241;
|
||||
i__1222 = G__1242;
|
||||
continue;
|
||||
} else {
|
||||
var vec__8217 = cljs.core.first.call(null,seq__8209__$1);
|
||||
var processing_name = cljs.core.nth.call(null,vec__8217,(0),null);
|
||||
var quil_name = cljs.core.nth.call(null,vec__8217,(1),null);
|
||||
var temp__4657__auto___8231__$1 = opts.call(null,quil_name);
|
||||
if(cljs.core.truth_(temp__4657__auto___8231__$1)){
|
||||
var handler_8232 = temp__4657__auto___8231__$1;
|
||||
(prc[cljs.core.name.call(null,processing_name)] = ((function (seq__8209,chunk__8210,count__8211,i__8212,handler_8232,temp__4657__auto___8231__$1,vec__8217,processing_name,quil_name,seq__8209__$1,temp__4657__auto__){
|
||||
var vec__1228 = cljs.core.first.call(null,seq__1219__$1);
|
||||
var processing_name = cljs.core.nth.call(null,vec__1228,(0),null);
|
||||
var quil_name = cljs.core.nth.call(null,vec__1228,(1),null);
|
||||
var temp__4657__auto___1243__$1 = opts.call(null,quil_name);
|
||||
if(cljs.core.truth_(temp__4657__auto___1243__$1)){
|
||||
var handler_1244 = temp__4657__auto___1243__$1;
|
||||
(prc[cljs.core.name.call(null,processing_name)] = ((function (seq__1219,chunk__1220,count__1221,i__1222,handler_1244,temp__4657__auto___1243__$1,vec__1228,processing_name,quil_name,seq__1219__$1,temp__4657__auto__){
|
||||
return (function (){
|
||||
var _STAR_applet_STAR_8220 = quil.sketch._STAR_applet_STAR_;
|
||||
quil.sketch._STAR_applet_STAR_ = prc;
|
||||
var _STAR_applet_STAR__orig_val__1231 = quil.sketch._STAR_applet_STAR_;
|
||||
var _STAR_applet_STAR__temp_val__1232 = prc;
|
||||
quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR__temp_val__1232;
|
||||
|
||||
try{return handler_8232.call(null);
|
||||
}finally {quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR_8220;
|
||||
}});})(seq__8209,chunk__8210,count__8211,i__8212,handler_8232,temp__4657__auto___8231__$1,vec__8217,processing_name,quil_name,seq__8209__$1,temp__4657__auto__))
|
||||
try{return handler_1244.call(null);
|
||||
}finally {quil.sketch._STAR_applet_STAR_ = _STAR_applet_STAR__orig_val__1231;
|
||||
}});})(seq__1219,chunk__1220,count__1221,i__1222,handler_1244,temp__4657__auto___1243__$1,vec__1228,processing_name,quil_name,seq__1219__$1,temp__4657__auto__))
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
var G__8233 = cljs.core.next.call(null,seq__8209__$1);
|
||||
var G__8234 = null;
|
||||
var G__8235 = (0);
|
||||
var G__8236 = (0);
|
||||
seq__8209 = G__8233;
|
||||
chunk__8210 = G__8234;
|
||||
count__8211 = G__8235;
|
||||
i__8212 = G__8236;
|
||||
|
||||
var G__1245 = cljs.core.next.call(null,seq__1219__$1);
|
||||
var G__1246 = null;
|
||||
var G__1247 = (0);
|
||||
var G__1248 = (0);
|
||||
seq__1219 = G__1245;
|
||||
chunk__1220 = G__1246;
|
||||
count__1221 = G__1247;
|
||||
i__1222 = G__1248;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@ -142,12 +131,12 @@ break;
|
||||
}
|
||||
});
|
||||
quil.sketch.make_sketch = (function quil$sketch$make_sketch(options){
|
||||
var opts = cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"size","size",1098693007),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(500),(300)], null)], null),(function (p1__8237_SHARP_){
|
||||
return p1__8237_SHARP_.call(null,options);
|
||||
var opts = cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"size","size",1098693007),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(500),(300)], null)], null),(function (p1__1249_SHARP_){
|
||||
return p1__1249_SHARP_.call(null,options);
|
||||
}).call(null,cljs.core.apply.call(null,cljs.core.comp,cljs.core.cons.call(null,quil.middlewares.deprecated_options.deprecated_options,new cljs.core.Keyword(null,"middleware","middleware",1462115504).cljs$core$IFn$_invoke$arity$2(options,cljs.core.PersistentVector.EMPTY)))));
|
||||
var sketch_size = (function (){var or__6814__auto__ = new cljs.core.Keyword(null,"size","size",1098693007).cljs$core$IFn$_invoke$arity$1(opts);
|
||||
if(cljs.core.truth_(or__6814__auto__)){
|
||||
return or__6814__auto__;
|
||||
var sketch_size = (function (){var or__4047__auto__ = new cljs.core.Keyword(null,"size","size",1098693007).cljs$core$IFn$_invoke$arity$1(opts);
|
||||
if(cljs.core.truth_(or__4047__auto__)){
|
||||
return or__4047__auto__;
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(200),(200)], null);
|
||||
}
|
||||
@ -203,31 +192,31 @@ return null;
|
||||
}
|
||||
});
|
||||
quil.sketch.sketch = (function quil$sketch$sketch(var_args){
|
||||
var args__7934__auto__ = [];
|
||||
var len__7927__auto___8239 = arguments.length;
|
||||
var i__7928__auto___8240 = (0);
|
||||
var args__4647__auto__ = [];
|
||||
var len__4641__auto___1251 = arguments.length;
|
||||
var i__4642__auto___1252 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8240 < len__7927__auto___8239)){
|
||||
args__7934__auto__.push((arguments[i__7928__auto___8240]));
|
||||
if((i__4642__auto___1252 < len__4641__auto___1251)){
|
||||
args__4647__auto__.push((arguments[i__4642__auto___1252]));
|
||||
|
||||
var G__8241 = (i__7928__auto___8240 + (1));
|
||||
i__7928__auto___8240 = G__8241;
|
||||
var G__1253 = (i__4642__auto___1252 + (1));
|
||||
i__4642__auto___1252 = G__1253;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__7935__auto__ = ((((0) < args__7934__auto__.length))?(new cljs.core.IndexedSeq(args__7934__auto__.slice((0)),(0),null)):null);
|
||||
return quil.sketch.sketch.cljs$core$IFn$_invoke$arity$variadic(argseq__7935__auto__);
|
||||
var argseq__4648__auto__ = ((((0) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((0)),(0),null)):null);
|
||||
return quil.sketch.sketch.cljs$core$IFn$_invoke$arity$variadic(argseq__4648__auto__);
|
||||
});
|
||||
|
||||
quil.sketch.sketch.cljs$core$IFn$_invoke$arity$variadic = (function (opts){
|
||||
var opts_map = cljs.core.apply.call(null,cljs.core.hash_map,opts);
|
||||
var host_elem = goog.dom.getElement(new cljs.core.Keyword(null,"host","host",-1558485167).cljs$core$IFn$_invoke$arity$1(opts_map));
|
||||
var renderer = (function (){var or__6814__auto__ = new cljs.core.Keyword(null,"renderer","renderer",336841071).cljs$core$IFn$_invoke$arity$1(opts_map);
|
||||
if(cljs.core.truth_(or__6814__auto__)){
|
||||
return or__6814__auto__;
|
||||
var renderer = (function (){var or__4047__auto__ = new cljs.core.Keyword(null,"renderer","renderer",336841071).cljs$core$IFn$_invoke$arity$1(opts_map);
|
||||
if(cljs.core.truth_(or__4047__auto__)){
|
||||
return or__4047__auto__;
|
||||
} else {
|
||||
return new cljs.core.Keyword(null,"p2d","p2d",-2106175755);
|
||||
}
|
||||
@ -252,8 +241,10 @@ return console.error("ERROR: Cannot create sketch. :host is not specified.");
|
||||
|
||||
quil.sketch.sketch.cljs$lang$maxFixedArity = (0);
|
||||
|
||||
quil.sketch.sketch.cljs$lang$applyTo = (function (seq8238){
|
||||
return quil.sketch.sketch.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq8238));
|
||||
/** @this {Function} */
|
||||
quil.sketch.sketch.cljs$lang$applyTo = (function (seq1250){
|
||||
var self__4629__auto__ = this;
|
||||
return self__4629__auto__.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq1250));
|
||||
});
|
||||
|
||||
quil.sketch.sketch_init_list = cljs.core.atom.call(null,cljs.core.List.EMPTY);
|
||||
@ -268,62 +259,64 @@ canvas.setAttribute("id",canvas_id);
|
||||
return document.body.appendChild(canvas);
|
||||
});
|
||||
quil.sketch.init_sketches = (function quil$sketch$init_sketches(){
|
||||
var add_elem_QMARK__8250 = quil.sketch.empty_body_QMARK_.call(null);
|
||||
var seq__8246_8251 = cljs.core.seq.call(null,cljs.core.deref.call(null,quil.sketch.sketch_init_list));
|
||||
var chunk__8247_8252 = null;
|
||||
var count__8248_8253 = (0);
|
||||
var i__8249_8254 = (0);
|
||||
var add_elem_QMARK__1258 = quil.sketch.empty_body_QMARK_.call(null);
|
||||
var seq__1254_1259 = cljs.core.seq.call(null,cljs.core.deref.call(null,quil.sketch.sketch_init_list));
|
||||
var chunk__1255_1260 = null;
|
||||
var count__1256_1261 = (0);
|
||||
var i__1257_1262 = (0);
|
||||
while(true){
|
||||
if((i__8249_8254 < count__8248_8253)){
|
||||
var sk_8255 = cljs.core._nth.call(null,chunk__8247_8252,i__8249_8254);
|
||||
if(cljs.core.truth_(add_elem_QMARK__8250)){
|
||||
quil.sketch.add_canvas.call(null,new cljs.core.Keyword(null,"host-id","host-id",742376279).cljs$core$IFn$_invoke$arity$1(sk_8255));
|
||||
if((i__1257_1262 < count__1256_1261)){
|
||||
var sk_1263 = cljs.core._nth.call(null,chunk__1255_1260,i__1257_1262);
|
||||
if(add_elem_QMARK__1258){
|
||||
quil.sketch.add_canvas.call(null,new cljs.core.Keyword(null,"host-id","host-id",742376279).cljs$core$IFn$_invoke$arity$1(sk_1263));
|
||||
} else {
|
||||
}
|
||||
|
||||
new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(sk_8255).call(null);
|
||||
new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(sk_1263).call(null);
|
||||
|
||||
var G__8256 = seq__8246_8251;
|
||||
var G__8257 = chunk__8247_8252;
|
||||
var G__8258 = count__8248_8253;
|
||||
var G__8259 = (i__8249_8254 + (1));
|
||||
seq__8246_8251 = G__8256;
|
||||
chunk__8247_8252 = G__8257;
|
||||
count__8248_8253 = G__8258;
|
||||
i__8249_8254 = G__8259;
|
||||
|
||||
var G__1264 = seq__1254_1259;
|
||||
var G__1265 = chunk__1255_1260;
|
||||
var G__1266 = count__1256_1261;
|
||||
var G__1267 = (i__1257_1262 + (1));
|
||||
seq__1254_1259 = G__1264;
|
||||
chunk__1255_1260 = G__1265;
|
||||
count__1256_1261 = G__1266;
|
||||
i__1257_1262 = G__1267;
|
||||
continue;
|
||||
} else {
|
||||
var temp__4657__auto___8260 = cljs.core.seq.call(null,seq__8246_8251);
|
||||
if(temp__4657__auto___8260){
|
||||
var seq__8246_8261__$1 = temp__4657__auto___8260;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,seq__8246_8261__$1)){
|
||||
var c__7633__auto___8262 = cljs.core.chunk_first.call(null,seq__8246_8261__$1);
|
||||
var G__8263 = cljs.core.chunk_rest.call(null,seq__8246_8261__$1);
|
||||
var G__8264 = c__7633__auto___8262;
|
||||
var G__8265 = cljs.core.count.call(null,c__7633__auto___8262);
|
||||
var G__8266 = (0);
|
||||
seq__8246_8251 = G__8263;
|
||||
chunk__8247_8252 = G__8264;
|
||||
count__8248_8253 = G__8265;
|
||||
i__8249_8254 = G__8266;
|
||||
var temp__4657__auto___1268 = cljs.core.seq.call(null,seq__1254_1259);
|
||||
if(temp__4657__auto___1268){
|
||||
var seq__1254_1269__$1 = temp__4657__auto___1268;
|
||||
if(cljs.core.chunked_seq_QMARK_.call(null,seq__1254_1269__$1)){
|
||||
var c__4461__auto___1270 = cljs.core.chunk_first.call(null,seq__1254_1269__$1);
|
||||
var G__1271 = cljs.core.chunk_rest.call(null,seq__1254_1269__$1);
|
||||
var G__1272 = c__4461__auto___1270;
|
||||
var G__1273 = cljs.core.count.call(null,c__4461__auto___1270);
|
||||
var G__1274 = (0);
|
||||
seq__1254_1259 = G__1271;
|
||||
chunk__1255_1260 = G__1272;
|
||||
count__1256_1261 = G__1273;
|
||||
i__1257_1262 = G__1274;
|
||||
continue;
|
||||
} else {
|
||||
var sk_8267 = cljs.core.first.call(null,seq__8246_8261__$1);
|
||||
if(cljs.core.truth_(add_elem_QMARK__8250)){
|
||||
quil.sketch.add_canvas.call(null,new cljs.core.Keyword(null,"host-id","host-id",742376279).cljs$core$IFn$_invoke$arity$1(sk_8267));
|
||||
var sk_1275 = cljs.core.first.call(null,seq__1254_1269__$1);
|
||||
if(add_elem_QMARK__1258){
|
||||
quil.sketch.add_canvas.call(null,new cljs.core.Keyword(null,"host-id","host-id",742376279).cljs$core$IFn$_invoke$arity$1(sk_1275));
|
||||
} else {
|
||||
}
|
||||
|
||||
new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(sk_8267).call(null);
|
||||
new cljs.core.Keyword(null,"fn","fn",-1175266204).cljs$core$IFn$_invoke$arity$1(sk_1275).call(null);
|
||||
|
||||
var G__8268 = cljs.core.next.call(null,seq__8246_8261__$1);
|
||||
var G__8269 = null;
|
||||
var G__8270 = (0);
|
||||
var G__8271 = (0);
|
||||
seq__8246_8251 = G__8268;
|
||||
chunk__8247_8252 = G__8269;
|
||||
count__8248_8253 = G__8270;
|
||||
i__8249_8254 = G__8271;
|
||||
|
||||
var G__1276 = cljs.core.next.call(null,seq__1254_1269__$1);
|
||||
var G__1277 = null;
|
||||
var G__1278 = (0);
|
||||
var G__1279 = (0);
|
||||
seq__1254_1259 = G__1276;
|
||||
chunk__1255_1260 = G__1277;
|
||||
count__1256_1261 = G__1278;
|
||||
i__1257_1262 = G__1279;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@ -345,4 +338,4 @@ return null;
|
||||
});
|
||||
goog.events.listenOnce(window,goog.events.EventType.LOAD,quil.sketch.init_sketches);
|
||||
|
||||
//# sourceMappingURL=sketch.js.map
|
||||
//# sourceMappingURL=sketch.js.map
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
assets/viz/2/quil/util.cljc.cache.json
Normal file
1
assets/viz/2/quil/util.cljc.cache.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// Compiled by ClojureScript 1.9.473 {}
|
||||
// Compiled by ClojureScript 1.10.439 {}
|
||||
goog.provide('quil.util');
|
||||
goog.require('cljs.core');
|
||||
goog.require('clojure.string');
|
||||
@ -16,10 +16,10 @@ quil.util.resolve_constant_key = (function quil$util$resolve_constant_key(key,ma
|
||||
if(cljs.core.truth_(cljs.core.get.call(null,mappings,key))){
|
||||
return cljs.core.get.call(null,mappings,key);
|
||||
} else {
|
||||
if(cljs.core.truth_(cljs.core.some.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([key], true),cljs.core.vals.call(null,mappings)))){
|
||||
if(cljs.core.truth_(cljs.core.some.call(null,cljs.core.PersistentHashSet.createAsIfByAssoc([key]),cljs.core.vals.call(null,mappings)))){
|
||||
return key;
|
||||
} else {
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Expecting a keyword, got: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(key),cljs.core.str.cljs$core$IFn$_invoke$arity$1(". Expected one of: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.vec.call(null,cljs.core.sort.call(null,cljs.core.keys.call(null,mappings))))].join('')));
|
||||
throw (new Error(["Expecting a keyword, got: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(key),". Expected one of: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.vec.call(null,cljs.core.sort.call(null,cljs.core.keys.call(null,mappings))))].join('')));
|
||||
|
||||
}
|
||||
}
|
||||
@ -31,11 +31,11 @@ throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Expecting a keywo
|
||||
* (length-of-longest-key {}) ;=> 0
|
||||
*/
|
||||
quil.util.length_of_longest_key = (function quil$util$length_of_longest_key(m){
|
||||
var or__6814__auto__ = cljs.core.last.call(null,cljs.core.sort.call(null,cljs.core.map.call(null,(function (p1__8123_SHARP_){
|
||||
return p1__8123_SHARP_.length();
|
||||
var or__4047__auto__ = cljs.core.last.call(null,cljs.core.sort.call(null,cljs.core.map.call(null,(function (p1__1156_SHARP_){
|
||||
return p1__1156_SHARP_.length();
|
||||
}),cljs.core.keys.call(null,m))));
|
||||
if(cljs.core.truth_(or__6814__auto__)){
|
||||
return or__6814__auto__;
|
||||
if(cljs.core.truth_(or__4047__auto__)){
|
||||
return or__4047__auto__;
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
@ -47,23 +47,8 @@ return (0);
|
||||
* empty string and also without pad in which case it defaults to a single space
|
||||
*/
|
||||
quil.util.gen_padding = (function quil$util$gen_padding(var_args){
|
||||
var args8124 = [];
|
||||
var len__7927__auto___8127 = arguments.length;
|
||||
var i__7928__auto___8128 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8128 < len__7927__auto___8127)){
|
||||
args8124.push((arguments[i__7928__auto___8128]));
|
||||
|
||||
var G__8129 = (i__7928__auto___8128 + (1));
|
||||
i__7928__auto___8128 = G__8129;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__8126 = args8124.length;
|
||||
switch (G__8126) {
|
||||
var G__1158 = arguments.length;
|
||||
switch (G__1158) {
|
||||
case 1:
|
||||
return quil.util.gen_padding.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
@ -77,7 +62,7 @@ return quil.util.gen_padding.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arg
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args8124.length)].join('')));
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
@ -103,10 +88,10 @@ quil.util.gen_padding.cljs$lang$maxFixedArity = 3;
|
||||
quil.util.print_definition_list = (function quil$util$print_definition_list(definitions){
|
||||
var longest_key = quil.util.length_of_longest_key.call(null,definitions);
|
||||
return cljs.core.dorun.call(null,cljs.core.map.call(null,((function (longest_key){
|
||||
return (function (p__8135){
|
||||
var vec__8136 = p__8135;
|
||||
var k = cljs.core.nth.call(null,vec__8136,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__8136,(1),null);
|
||||
return (function (p__1160){
|
||||
var vec__1161 = p__1160;
|
||||
var k = cljs.core.nth.call(null,vec__1161,(0),null);
|
||||
var v = cljs.core.nth.call(null,vec__1161,(1),null);
|
||||
var len = k.length();
|
||||
var diff = (longest_key - len);
|
||||
var pad = quil.util.gen_padding.call(null,diff);
|
||||
@ -121,63 +106,63 @@ quil.util.prepare_quil_name = (function quil$util$prepare_quil_name(const_keywor
|
||||
return clojure.string.replace.call(null,clojure.string.upper_case.call(null,cljs.core.name.call(null,const_keyword)),/-/,"_");
|
||||
});
|
||||
quil.util.prepare_quil_clj_constants = (function quil$util$prepare_quil_clj_constants(constants){
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,(function (p1__8139_SHARP_){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[p1__8139_SHARP_,cljs.core.symbol.call(null,[cljs.core.str.cljs$core$IFn$_invoke$arity$1("PConstants/"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(quil.util.prepare_quil_name.call(null,p1__8139_SHARP_))].join(''))],null));
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,(function (p1__1164_SHARP_){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[p1__1164_SHARP_,cljs.core.symbol.call(null,["PConstants/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(quil.util.prepare_quil_name.call(null,p1__1164_SHARP_))].join(''))],null));
|
||||
}),constants));
|
||||
});
|
||||
quil.util.prepare_quil_cljs_constants = (function quil$util$prepare_quil_cljs_constants(constants){
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,(function (p1__8140_SHARP_){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[p1__8140_SHARP_,cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol("cljs.core","aget","cljs.core/aget",6345791,null)),cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol("js","Processing.prototype.PConstants","js/Processing.prototype.PConstants",2034048972,null)),(function (){var x__7656__auto__ = quil.util.prepare_quil_name.call(null,p1__8140_SHARP_);
|
||||
return cljs.core._conj.call(null,cljs.core.List.EMPTY,x__7656__auto__);
|
||||
})())))],null));
|
||||
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,(function (p1__1165_SHARP_){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[p1__1165_SHARP_,cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,(new cljs.core.List(null,new cljs.core.Symbol("cljs.core","aget","cljs.core/aget",6345791,null),null,(1),null)),(new cljs.core.List(null,new cljs.core.Symbol("js","Processing.prototype.PConstants","js/Processing.prototype.PConstants",2034048972,null),null,(1),null)),(new cljs.core.List(null,quil.util.prepare_quil_name.call(null,p1__1165_SHARP_),null,(1),null)))))],null));
|
||||
}),constants));
|
||||
});
|
||||
quil.util.make_quil_constant_map = (function quil$util$make_quil_constant_map(target,const_map_name,const_map){
|
||||
return cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol(null,"def","def",597100991,null)),(function (){var x__7656__auto__ = const_map_name;
|
||||
return cljs.core._conj.call(null,cljs.core.List.EMPTY,x__7656__auto__);
|
||||
})(),(function (){var x__7656__auto__ = ((cljs.core._EQ_.call(null,target,new cljs.core.Keyword(null,"clj","clj",-660495428)))?quil.util.prepare_quil_clj_constants.call(null,const_map):quil.util.prepare_quil_cljs_constants.call(null,const_map));
|
||||
return cljs.core._conj.call(null,cljs.core.List.EMPTY,x__7656__auto__);
|
||||
})())));
|
||||
return cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,(new cljs.core.List(null,new cljs.core.Symbol(null,"def","def",597100991,null),null,(1),null)),(new cljs.core.List(null,const_map_name,null,(1),null)),(new cljs.core.List(null,((cljs.core._EQ_.call(null,target,new cljs.core.Keyword(null,"clj","clj",-660495428)))?quil.util.prepare_quil_clj_constants.call(null,const_map):quil.util.prepare_quil_cljs_constants.call(null,const_map)),null,(1),null)))));
|
||||
});
|
||||
var ret__4684__auto___1171 = (function (){
|
||||
quil.util.generate_quil_constants = (function quil$util$generate_quil_constants(var_args){
|
||||
var args__7934__auto__ = [];
|
||||
var len__7927__auto___8146 = arguments.length;
|
||||
var i__7928__auto___8147 = (0);
|
||||
var args__4647__auto__ = [];
|
||||
var len__4641__auto___1172 = arguments.length;
|
||||
var i__4642__auto___1173 = (0);
|
||||
while(true){
|
||||
if((i__7928__auto___8147 < len__7927__auto___8146)){
|
||||
args__7934__auto__.push((arguments[i__7928__auto___8147]));
|
||||
if((i__4642__auto___1173 < len__4641__auto___1172)){
|
||||
args__4647__auto__.push((arguments[i__4642__auto___1173]));
|
||||
|
||||
var G__8148 = (i__7928__auto___8147 + (1));
|
||||
i__7928__auto___8147 = G__8148;
|
||||
var G__1174 = (i__4642__auto___1173 + (1));
|
||||
i__4642__auto___1173 = G__1174;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__7935__auto__ = ((((3) < args__7934__auto__.length))?(new cljs.core.IndexedSeq(args__7934__auto__.slice((3)),(0),null)):null);
|
||||
return quil.util.generate_quil_constants.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__7935__auto__);
|
||||
var argseq__4648__auto__ = ((((3) < args__4647__auto__.length))?(new cljs.core.IndexedSeq(args__4647__auto__.slice((3)),(0),null)):null);
|
||||
return quil.util.generate_quil_constants.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__4648__auto__);
|
||||
});
|
||||
|
||||
quil.util.generate_quil_constants.cljs$core$IFn$_invoke$arity$variadic = (function (_AMPERSAND_form,_AMPERSAND_env,target,opts){
|
||||
return cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol(null,"do","do",1686842252,null)),cljs.core.map.call(null,(function (p1__8141_SHARP_){
|
||||
return quil.util.make_quil_constant_map.call(null,target,cljs.core.first.call(null,p1__8141_SHARP_),cljs.core.second.call(null,p1__8141_SHARP_));
|
||||
return cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,(new cljs.core.List(null,new cljs.core.Symbol(null,"do","do",1686842252,null),null,(1),null)),cljs.core.map.call(null,(function (p1__1166_SHARP_){
|
||||
return quil.util.make_quil_constant_map.call(null,target,cljs.core.first.call(null,p1__1166_SHARP_),cljs.core.second.call(null,p1__1166_SHARP_));
|
||||
}),cljs.core.partition.call(null,(2),opts)))));
|
||||
});
|
||||
|
||||
quil.util.generate_quil_constants.cljs$lang$maxFixedArity = (3);
|
||||
|
||||
quil.util.generate_quil_constants.cljs$lang$applyTo = (function (seq8142){
|
||||
var G__8143 = cljs.core.first.call(null,seq8142);
|
||||
var seq8142__$1 = cljs.core.next.call(null,seq8142);
|
||||
var G__8144 = cljs.core.first.call(null,seq8142__$1);
|
||||
var seq8142__$2 = cljs.core.next.call(null,seq8142__$1);
|
||||
var G__8145 = cljs.core.first.call(null,seq8142__$2);
|
||||
var seq8142__$3 = cljs.core.next.call(null,seq8142__$2);
|
||||
return quil.util.generate_quil_constants.cljs$core$IFn$_invoke$arity$variadic(G__8143,G__8144,G__8145,seq8142__$3);
|
||||
/** @this {Function} */
|
||||
quil.util.generate_quil_constants.cljs$lang$applyTo = (function (seq1167){
|
||||
var G__1168 = cljs.core.first.call(null,seq1167);
|
||||
var seq1167__$1 = cljs.core.next.call(null,seq1167);
|
||||
var G__1169 = cljs.core.first.call(null,seq1167__$1);
|
||||
var seq1167__$2 = cljs.core.next.call(null,seq1167__$1);
|
||||
var G__1170 = cljs.core.first.call(null,seq1167__$2);
|
||||
var seq1167__$3 = cljs.core.next.call(null,seq1167__$2);
|
||||
var self__4628__auto__ = this;
|
||||
return self__4628__auto__.cljs$core$IFn$_invoke$arity$variadic(G__1168,G__1169,G__1170,seq1167__$3);
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
})()
|
||||
;
|
||||
quil.util.generate_quil_constants.cljs$lang$macro = true;
|
||||
|
||||
//# sourceMappingURL=util.js.map
|
||||
|
||||
//# sourceMappingURL=util.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/util.js","sources":["util.cljc"],"lineCount":183,"mappings":";AAAA;;;AAIA;;;kBAAA,lBAAMA;AAAN,AAAA;;AAsBA;;;;iCAAA,jCAAMC,0EAGHC,IAAIC;AAHP,AAIE,oBACE,AAACC,wBAAID,SAASD;AAAgB,OAACE,wBAAID,SAASD;;AAD9C,oBAEE,yBAAA,zBAACG,wEAAOH,YAAK,AAACI,yBAAKH;AAAWD;;AAFhC,AAIgC,MAAO,KAAAK,MAEC,6CAAA,2HAAA,jDAAkCL,oHAA0B,AAACM,wBAAI,AAACC,yBAAK,AAACC,yBAAKP;;;;;AAEvH;;;;;;kCAAA,lCAAOQ,4EAKJC;AALH,AAME,IAAAC,mBAAI,AAACC,yBAAK,AAACL,yBAAK,wBAAA,WAAAM,nCAACC;AAAD,AAAM,OAAAD;GAAY,AAACL,yBAAKE;AAAxC,AAAA,oBAAAC;AAAAA;;AAAA;;;AAGF,AAAA;;;;;;wBAAA,gCAAAI,xDAAOK;AAAP,AAAA,IAAAJ,WAAA;AAAA,AAAA,IAAAC,yBAAA,AAAA;AAAA,AAAA,IAAAC,uBAAA;;AAAA,AAAA,GAAA,CAAAA,uBAAAD;AAAA,AAAA,AAAAD,cAAA,CAAA,UAAAE;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAAC,UAAA,AAAAH;AAAA,AAAA,QAAAG;KAAA;AAAA,OAAAC,oDAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,oDAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,oDAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAf,MAAA,6CAAA,+DAAA,AAAAW;;;;;AAAA,AAAA,sDAAA,tDAAOI,iEAKHC;AALJ,AAKS,uCAAA,OAAA,vCAACD,mCAAeC;;;AALzB,AAAA,sDAAA,tDAAOD,iEAMHC,IAAIC;AANR,AAMa,uCAAA,hCAACF,mCAAeC,IAAIC;;;AANjC,AAAA,sDAAA,tDAAOF,iEAOHG,EAAEF,IAAIC;AAPV,AAQK,GAAI,OAAA,NAAGD;AACL,OAACD,gCAAY,6CAAKG,+CAAED,eAAK,OAAA,NAAKD,WAAKC;;AACnCC;;;;AAVP,AAAA,gDAAA,hDAAOH;;AAAP,AAYA,kCAAA,lCAAMI,4EACHC;AADH,AAEE,IAAMC,cAAY,AAACjB,0CAAsBgB;AAAzC,AACE,OAACE,0BACA,AAACb,wBAAI;kBAAAc;AAAA,AAAA,IAAAC,YAAAD;QAAA,AAAAE,wBAAAD,UAAA,IAAA,1CAAME;QAAN,AAAAD,wBAAAD,UAAA,IAAA,1CAAQG;AAAR,AACE,IAAMX,MAAI,AAASU;IACbE,OAAK,CAAGP,cAAYL;IACpBC,MAAI,AAACF,gCAAYa;AAFvB,AAGE,yCAAA,lCAACC,4BAAQH,EAAET,SAASU;;CACxBP;;AAEV,mCAAA,nCAAMU;AAAN,AAAA;;AAUA,8BAAA,9BAAMC,oEAAmBC;AAAzB,AACE,qHAAA,IAAA,lHAACC,iCACA,AAACC,oCAAgB,AAACC,yBAAKH;;AAG1B,uCAAA,vCAAMI,sFAA4BC;AAAlC,AACE,gCAAA,zBAACC,4DACK,wBAAA,WAAAC,nCAAC9B;AAAD,AACE,YAAA+B,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAD,uNAAA,vMAAU,AAACE,2BAAO,6CAAA,2DAAmB,sCAAAF,tCAACR;GACvCM;;AAET,wCAAA,xCAAMK,wFAA6BL;AAAnC,AACE,gCAAA,zBAACC,4DACK,wBAAA,WAAAK,nCAAClC;AAAD,AACE,YAAA+B,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAG,gBAAA,AAAAC,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,AAAAC,+CAAA,wEAAA,AAAAA,+CAAA,mHAAA,iBAAAC,kBAAqD,sCAAAL,tCAACZ,lSAiyE5D,AAAAuC,uHAAA,AAAAA;AAjyEM,AAAA,OAAAvB,+CAAAC,rBAiyEN,AAAAsB;SAjyEM;GACDjC;;AAET,mCAAA,nCAAMY,8EAAwBC,OAAOC,eAAeC;AAApD,AAAA,OAAAR,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,AAAAC,+CAAA,uDAAA,iBAAAC,kBAEMG,\/GA4xEF,AAAAmB;AA9xEJ,AAAA,OAAAvB,+CAAAC,rBA8xEI,AAAAsB;KA9xEJ,iBAAAtB,kBAGM,EAAI,gCAAA,hCAACK,yBAAEH,4DACL,AAACd,+CAA2BgB,WAC5B,AAACV,gDAA4BU;AALrC,AAAA,OAAAL,+CAAAC,rBA8xEI,AAAAsB;;;AAvxEJ,AAAA,AAAA,oCAAA,4CAAA5D,hFAAU+C;AAAV,AAAA,IAAAH,qBAAA;AAAA,AAAA,IAAA1C,yBAAA,AAAA;AAAA,AAAA,IAAAC,uBAAA;;AAAA,AAAA,GAAA,CAAAA,uBAAAD;AAAA,AAAA,AAAA0C,wBAAA,CAAA,UAAAzC;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAA0C,uBAAA,EAAA,CAAA,MAAA,AAAAD,4BAAA,AAAA,KAAAE,qBAAA,AAAAF,yBAAA,KAAA,IAAA,OAAA;AAAA,AAAA,OAAAG,uEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAAF;;;AAAA,AAAA,AAAA,AAAAE,yEAAA,WAAAC,gBAAAC,eAAmCT,OAASgB;AAA5C,AAAA,OAAAtB,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,AAAAC,+CAAA,sDAEO,wBAAA,WAAAoB,nCAAC1D,3EAqxEJ,AAAA6D;AArxEG,AACE,OAACrB,2CAAuBC,OAAO,0BAAAiB,1BAACL,2CAAS,2BAAAK,3BAACC;GAC3C,8BAAA,9BAACC,kCAAYH;;;AAJrB,AAAA,AAAAT,4DAAA;;AAAA,AAAA,AAAAA,sDAAA,WAAAG;AAAA,AAAA,IAAAC,UAAA,AAAAC,0BAAAF;IAAAA,cAAA,AAAAG,yBAAAH;IAAAI,UAAA,AAAAF,0BAAAF;IAAAA,cAAA,AAAAG,yBAAAH;IAAAK,UAAA,AAAAH,0BAAAF;IAAAA,cAAA,AAAAG,yBAAAH;AAAA,AAAA,OAAAH,uEAAAI,QAAAG,QAAAC,QAAAL;;;AAAA;AAAA,AAAA,oDAAA,pDAAUH","names":["quil.util\/no-fn","quil.util\/resolve-constant-key","key","mappings","cljs.core\/get","cljs.core\/some","cljs.core\/vals","js\/Error","cljs.core\/vec","cljs.core\/sort","cljs.core\/keys","quil.util\/length-of-longest-key","m","or__6814__auto__","cljs.core\/last","p1__8123#","cljs.core\/map","var_args","args8124","len__7927__auto__","i__7928__auto__","G__8126","quil.util\/gen-padding","len","pad","s","quil.util\/print-definition-list","definitions","longest-key","cljs.core\/dorun","p__8135","vec__8136","cljs.core\/nth","k","v","diff","cljs.core\/println","quil.util\/clj-compilation?","quil.util\/prepare-quil-name","const-keyword","clojure.string\/replace","clojure.string\/upper-case","cljs.core\/name","quil.util\/prepare-quil-clj-constants","constants","cljs.core\/into","p1__8139#","cljs.core\/PersistentVector","cljs.core\/symbol","quil.util\/prepare-quil-cljs-constants","p1__8140#","cljs.core\/sequence","cljs.core\/seq","cljs.core\/concat","cljs.core\/-conj","x__7656__auto__","quil.util\/make-quil-constant-map","target","const-map-name","const-map","cljs.core\/=","args__7934__auto__","argseq__7935__auto__","cljs.core\/IndexedSeq","quil.util\/generate-quil-constants","&form","&env","seq8142","G__8143","cljs.core\/first","cljs.core\/next","G__8144","G__8145","opts","p1__8141#","cljs.core\/second","cljs.core\/partition","cljs.core\/List"]}
|
||||
{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/util.js","sources":["util.cljc"],"lineCount":168,"mappings":";AAAA;;;AAIA;;;kBAAA,lBAAMA;AAAN,AAAA;;AAsBA;;;;iCAAA,jCAAMC,0EAGH,IAAI;AAHP,AAIE,oBACE,AAACC,wBAAIC,SAASC;AAAgB,OAACF,wBAAIC,SAASC;;AAD9C,oBAEE,yBAAA,zBAACC,wEAAOD,MAAK,AAACE,yBAAKH;AAAWC;;AAFhC,AAIgC,MAAO,KAAAG,MAEC,CAAA,8EAAA,LAAkCH,uEAA0B,AAACI,wBAAI,AAACC,yBAAK,AAACC,yBAAKP;;;;;AAEvH;;;;;;kCAAA,lCAAOQ,4EAKJ;AALH,AAME,IAAA,mBAAI,AAACE,yBAAK,AAACJ,yBAAK,wBAAA,WAAA,nCAACK;AAAD,AAAM,OAAAC;GAAY,AAACL,yBAAKM;AAAxC,AAAA,oBAAAJ;AAAAA;;AAAA;;;AAGF,AAAA;;;;;;wBAAA,gCAAA,xDAAOM;AAAP,AAAA,IAAA,UAAA,AAAA;AAAA,AAAA,QAAAD;KAAA;AAAA,OAAAC,oDAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,oDAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,oDAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAX,MAAA,CAAA,8DAAA,AAAA;;;;;AAAA,AAAA,sDAAA,tDAAOW,iEAKH;AALJ,AAKS,uCAAA,OAAA,vCAACA,mCAAeC;;;AALzB,AAAA,sDAAA,tDAAOD,iEAMH,IAAI;AANR,AAMa,uCAAA,hCAACA,mCAAeC,IAAIC;;;AANjC,AAAA,sDAAA,tDAAOF,iEAOH,EAAE,IAAI;AAPV,AAQK,GAAI,OAAA,NAAGC;AACL,OAACD,gCAAY,6CAAKG,+CAAED,eAAK,OAAA,NAAKD,WAAKC;;AACnCC;;;;AAVP,AAAA,gDAAA,hDAAOH;;AAAP,AAYA,kCAAA,lCAAMI,4EACH;AADH,AAEE,IAAM,cAAY,AAACX,0CAAsBY;AAAzC,AACE,OAACC,0BACA,AAACV,wBAAI;kBAAA;AAAA,AAAA,IAAA,YAAAW;QAAA,AAAAC,wBAAAC,UAAA,IAAA,1CAAM;QAAN,AAAAD,wBAAAC,UAAA,IAAA,1CAAQ;AAAR,AACE,IAAM,MAAI,AAASC;IACb,OAAK,CAAGC,cAAYV;IACpB,MAAI,AAACD,gCAAYY;AAFvB,AAGE,yCAAA,lCAACC,4BAAQH,EAAER,SAASY;;CACxBT;;AAEV,mCAAA,nCAAMU;AAAN,AAAA;;AAUA,8BAAA,9BAAMC,oEAAmB;AAAzB,AACE,qHAAA,IAAA,lHAACC,iCACA,AAACC,oCAAgB,AAACC,yBAAKC;;AAG1B,uCAAA,vCAAMC,sFAA4B;AAAlC,AACE,gCAAA,zBAACC,4DACK,wBAAA,WAAA,nCAAC1B;AAAD,AACE,YAAA2B,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAC,0KAAA,1JAAU,AAACC,2BAAO,CAAA,0DAAmB,sCAAAD,tCAACR;GACvCU;;AAET,wCAAA,xCAAMC,wFAA6B;AAAnC,AACE,gCAAA,zBAACL,4DACK,wBAAA,WAAA,nCAAC1B;AAAD,AACE,YAAA2B,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAK,gBAAA,AAAAC,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,KAAAC,eAAA,KAAA,AAAA,uEAAA,KAAA,IAAA,OAAA,KAAAA,eAAA,KAAA,AAAA,kHAAA,KAAA,IAAA,OAAA,KAAAA,eAAA,4DAAA,KAAA,IAAA,WAAA,3EAAqD,sCAAAJ,tCAACZ;GACvDU;;AAET,mCAAA,nCAAMO,8EAAwB,OAAO,eAAe;AAApD,AAAA,OAAAJ,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,KAAAC,eAAA,KAAA,AAAA,sDAAA,KAAA,IAAA,OAAA,KAAAA,eAAA,oBAAA,KAAA,IAAA,OAAA,KAAAA,eAAA,kNAAA,KAAA,IAAA,9QAEME,wDACA,EAAI,gCAAA,hCAACC,yBAAEC,4DACL,AAACf,+CAA2BgB,WAC5B,AAACV,gDAA4BU;;AAErC,IAAA,yBAAA;AAAA,oCAAA,4CAAA,hFAAUK;AAAV,AAAA,IAAA,qBAAA;AAAA,AAAA,IAAA,yBAAA,AAAA;AAAA,AAAA,IAAA,uBAAA;;AAAA,AAAA,GAAA,CAAAJ,uBAAAC;AAAA,AAAA,AAAAC,wBAAA,CAAA,UAAAF;;AAAA,cAAA,CAAAA,uBAAA;;;;AAAA;;;;AAAA,IAAA,uBAAA,EAAA,CAAA,MAAA,AAAAE,4BAAA,AAAA,KAAAC,qBAAA,AAAAD,yBAAA,KAAA,IAAA,OAAA;AAAA,AAAA,OAAAE,uEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAAC;;;AAAA,AAAA,AAAA,AAAAD,yEAAA,WAAA,gBAAA,eAAmC,OAAS;AAA5C,AAAA,OAAAb,6BAAA,AAAAC,wBAAA,AAAAC,2BAAA,KAAAC,eAAA,KAAA,AAAA,qDAAA,KAAA,IAAA,OAEO,wBAAA,WAAA,nCAACpC;AAAD,AACE,OAACqC,2CAAuBG,OAAO,0BAAAgB,1BAACR,2CAAS,2BAAAQ,3BAACC;GAC3C,8BAAA,9BAACC,kCAAYC;;;AAJrB,AAAA,AAAAb,4DAAA;;AAAA;AAAA,AAAA,AAAAA,sDAAA,WAAA;AAAA,AAAA,IAAA,UAAA,AAAAE,0BAAAC;IAAA,cAAA,AAAAC,yBAAAD;IAAA,UAAA,AAAAD,0BAAAC;IAAA,cAAA,AAAAC,yBAAAD;IAAA,UAAA,AAAAD,0BAAAC;IAAA,cAAA,AAAAC,yBAAAD;AAAA,AAAA,IAAA,qBAAA;AAAA,AAAA,OAAAE,wDAAAC,QAAAC,QAAAC,QAAAL;;;AAAA;;;AAAA,AAAA,AAAA,oDAAA,pDAAUH;;AAAVS","names":["quil.util\/no-fn","quil.util\/resolve-constant-key","cljs.core\/get","mappings","key","cljs.core\/some","cljs.core\/vals","js\/Error","cljs.core\/vec","cljs.core\/sort","cljs.core\/keys","quil.util\/length-of-longest-key","or__4047__auto__","cljs.core\/last","cljs.core\/map","p1__1156#","m","G__1158","quil.util\/gen-padding","len","pad","s","quil.util\/print-definition-list","definitions","cljs.core\/dorun","p__1160","cljs.core\/nth","vec__1161","k","longest-key","diff","cljs.core\/println","v","quil.util\/clj-compilation?","quil.util\/prepare-quil-name","clojure.string\/replace","clojure.string\/upper-case","cljs.core\/name","const-keyword","quil.util\/prepare-quil-clj-constants","cljs.core\/into","cljs.core\/PersistentVector","p1__1164#","cljs.core\/symbol","constants","quil.util\/prepare-quil-cljs-constants","p1__1165#","cljs.core\/sequence","cljs.core\/seq","cljs.core\/concat","cljs.core\/List","quil.util\/make-quil-constant-map","const-map-name","cljs.core\/=","target","const-map","i__4642__auto__","len__4641__auto__","args__4647__auto__","cljs.core\/IndexedSeq","quil.util\/generate-quil-constants","argseq__4648__auto__","cljs.core\/first","seq1167","cljs.core\/next","self__4628__auto__","G__1168","G__1169","G__1170","ret__4684__auto__","p1__1166#","cljs.core\/second","cljs.core\/partition","opts"]}
|
@ -7,65 +7,64 @@
|
||||
[viz.dial :as dial]
|
||||
[goog.string :as gstring]
|
||||
[goog.string.format]
|
||||
;[gil.core :as gil]
|
||||
))
|
||||
|
||||
(defn- debug [& args]
|
||||
(.log js/console (clojure.string/join " " (map str args))))
|
||||
(defn- observe [v] (debug v) v)
|
||||
|
||||
(defn- positive [n] (if (> 0 n) (- n) n))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; initialization
|
||||
|
||||
;; TODO move all code specific to drawing ghosts into the ghost package
|
||||
;; TODO make two ghosts, one opposite the color of the other
|
||||
|
||||
(defn- window-partial [k]
|
||||
(int (* (aget js/document "documentElement" k) 0.95)))
|
||||
(int (aget js/document "documentElement" k)))
|
||||
|
||||
(def window-size
|
||||
(let [w (int (min 1024 (window-partial "clientWidth")))]
|
||||
[w (int (min (* w 0.75) (window-partial "clientHeight")))]))
|
||||
|
||||
(def window-size [ (min 1025 (window-partial "clientWidth"))
|
||||
(int (* (window-partial "clientHeight") 0.75))
|
||||
])
|
||||
(def window-half-size (apply vector (map #(float (/ %1 2)) window-size)))
|
||||
|
||||
(def frame-rate 15)
|
||||
(defn- set-grid-size [state]
|
||||
(let [h (int (* (window-size 1)
|
||||
(float (/ (:grid-width state) (window-size 0)))))]
|
||||
(assoc state :grid-size [(:grid-width state) h])))
|
||||
|
||||
(defn- add-ghost [state ghost-def]
|
||||
(let [[forest id] (forest/add-node (:forest state) (:start-pos ghost-def))
|
||||
ghost (-> (ghost/new-ghost)
|
||||
(ghost/add-active-node id)
|
||||
(assoc :ghost-def ghost-def))
|
||||
]
|
||||
(assoc state
|
||||
:forest forest
|
||||
:ghosts (cons ghost (:ghosts state)))))
|
||||
|
||||
(defn- new-state []
|
||||
{:frame-rate frame-rate
|
||||
:color-cycle-period 2
|
||||
:exit-wait-frames 40
|
||||
:tail-length 7
|
||||
:frame 0
|
||||
:dial (dial/new-dial)
|
||||
; 0.86 is roughly the beat period of a human heart
|
||||
:heartbeat-plot (dial/new-plot frame-rate 0.86 [[0.5 0.5] [0.7 0] [0.8 1]])
|
||||
:gif-seconds 0
|
||||
:grid-width 35 ; from the center
|
||||
:forest (forest/new-forest grid/isometric)
|
||||
:ghost (-> (ghost/new-ghost)
|
||||
(assoc :color (q/color 0 1 1))
|
||||
)
|
||||
})
|
||||
|
||||
(defn new-active-node [state pos]
|
||||
(let [[forest id] (forest/add-node (:forest state) pos)
|
||||
ghost (ghost/add-active-node (:ghost state) id)]
|
||||
(assoc state :ghost ghost :forest forest)))
|
||||
|
||||
(defn- frames-per-color-cycle [state]
|
||||
(* (:color-cycle-period state) (:frame-rate state)))
|
||||
(-> {:frame-rate 15
|
||||
:color-cycle-period 8
|
||||
:tail-length 7
|
||||
:frame 0
|
||||
:grid-width 45 ; from the center
|
||||
:forest (forest/new-forest grid/isometric)
|
||||
}
|
||||
(set-grid-size)
|
||||
(add-ghost {:start-pos [-10 -10]
|
||||
:color-fn (fn [state]
|
||||
(let [frames-per-color-cycle
|
||||
(* (:color-cycle-period state) (:frame-rate state))]
|
||||
(q/color
|
||||
(/ (mod (:frame state) frames-per-color-cycle)
|
||||
frames-per-color-cycle)
|
||||
1 1)))
|
||||
})
|
||||
))
|
||||
|
||||
(defn setup []
|
||||
(q/color-mode :hsb 10 1 1)
|
||||
(let [state (-> (new-state)
|
||||
(new-active-node [10 10])
|
||||
)]
|
||||
(q/frame-rate (:frame-rate state))
|
||||
;; use frame-rate as the range of possibly hue values, so we can cycle all
|
||||
;; colors in a second
|
||||
(q/color-mode :hsb (frames-per-color-cycle state) 1 1)
|
||||
state))
|
||||
(q/color-mode :hsb 1 1 1)
|
||||
(new-state))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; scaling and unit conversion related
|
||||
@ -73,211 +72,134 @@
|
||||
(defn- curr-second [state]
|
||||
(float (/ (:frame state) (:frame-rate state))))
|
||||
|
||||
(defn- grid-size [state]
|
||||
(let [h (int (* (window-size 1)
|
||||
(float (/ (:grid-width state) (window-size 0)))))]
|
||||
[(:grid-width state) h]))
|
||||
|
||||
(defn- scale [state xy]
|
||||
(defn- scale [grid-size xy]
|
||||
(map-indexed #(* %2 (float (/ (window-half-size %1)
|
||||
((grid-size state) %1)))) xy))
|
||||
|
||||
(def bounds-buffer 1)
|
||||
|
||||
(defn- in-bounds? [state pos]
|
||||
(let [[w h] (apply vector (map #(- % bounds-buffer) (grid-size state)))
|
||||
min-bound [(- w) (- h)]
|
||||
max-bound [w h]
|
||||
pos-k (keep-indexed #(let [mini (min-bound %1)
|
||||
maxi (max-bound %1)]
|
||||
(when (and (>= %2 mini) (<= %2 maxi)) %2)) pos)]
|
||||
(= (count pos) (count pos-k))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; dials
|
||||
|
||||
(defn- ceil-one [x]
|
||||
(if (> x 0) 1 0))
|
||||
|
||||
(defn- set-dial [state]
|
||||
(update-in state [:dial] dial/by-plot (:heartbeat-plot state) (:frame state)))
|
||||
(grid-size %1)))) xy))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; poss-fn
|
||||
|
||||
(def bounds-buffer 1)
|
||||
|
||||
(defn- in-bounds? [grid-size pos]
|
||||
(let [[w h] (apply vector (map #(- % bounds-buffer) grid-size))]
|
||||
(every?
|
||||
#(and (>= (% 1) (- (% 0))) (<= (% 1) (% 0)))
|
||||
(map vector [w h] pos))))
|
||||
|
||||
(defn- dist-from-sqr [pos1 pos2]
|
||||
(reduce + (map #(* % %) (map - pos1 pos2))))
|
||||
|
||||
(defn- dist-from [pos1 pos2]
|
||||
(q/sqrt (dist-from-sqr pos1 pos2)))
|
||||
|
||||
(def order-adj-poss-fns
|
||||
{:random (fn [state]
|
||||
(fn [pos adj-poss] (shuffle adj-poss)))
|
||||
|
||||
:centered (fn [state]
|
||||
(fn [pos adj-poss]
|
||||
(sort-by #(dist-from-sqr % [0 0]) adj-poss)))
|
||||
})
|
||||
|
||||
(defn- mk-order-adj-poss-fn [& ks]
|
||||
(fn [state]
|
||||
(let [fns (map #(% state)
|
||||
(map order-adj-poss-fns ks))
|
||||
]
|
||||
(fn [pos adj-poss]
|
||||
(reduce
|
||||
(fn [inner-adj-poss next-fn] (next-fn pos inner-adj-poss))
|
||||
adj-poss
|
||||
fns))
|
||||
)))
|
||||
|
||||
(def take-adj-poss-fns
|
||||
{:random (fn [state]
|
||||
(fn [pos adj-poss]
|
||||
(q/map-range (rand) 0 1 0.75 1)))
|
||||
:dial (fn [state]
|
||||
(fn [pos adj-poss]
|
||||
(-> (:dial state)
|
||||
(dial/scaled -0.25 1.75)
|
||||
(:val)
|
||||
)))
|
||||
:centered (fn [state]
|
||||
(fn [pos adj-poss]
|
||||
(let [d (dist-from [0 0] pos)
|
||||
max-d (state :grid-width)
|
||||
norm-d (/ d max-d)
|
||||
]
|
||||
(- 1 norm-d)
|
||||
)))
|
||||
})
|
||||
|
||||
(defn- mk-take-adj-poss-fn [& ks]
|
||||
(fn [state]
|
||||
(let [fns (map #(% state)
|
||||
(map take-adj-poss-fns ks))
|
||||
]
|
||||
(fn [pos adj-poss]
|
||||
(let [mults (map #(% pos adj-poss) fns)
|
||||
mult (reduce * 1 mults)
|
||||
to-take (int (* mult (count adj-poss)))
|
||||
]
|
||||
(take to-take adj-poss)))
|
||||
)))
|
||||
|
||||
(def order-adj-poss-fn (mk-order-adj-poss-fn :centered))
|
||||
(def take-adj-poss-fn (mk-take-adj-poss-fn :centered :random))
|
||||
(defn take-adj-poss [grid-width pos adj-poss]
|
||||
(let [dist-from-center (dist-from [0 0] pos)
|
||||
width grid-width
|
||||
dist-ratio (/ (- width dist-from-center) width)
|
||||
]
|
||||
(take
|
||||
(int (* (q/map-range (rand) 0 1 0.75 1)
|
||||
dist-ratio
|
||||
(count adj-poss)))
|
||||
adj-poss)))
|
||||
|
||||
(defn- mk-poss-fn [state]
|
||||
(let [order-inner-fn (order-adj-poss-fn state)
|
||||
take-inner-fn (take-adj-poss-fn state)
|
||||
]
|
||||
(let [grid-size (:grid-size state)]
|
||||
(fn [pos adj-poss]
|
||||
(let [adj-poss (filter #(in-bounds? state %) adj-poss)
|
||||
adj-poss-ordered (order-inner-fn pos adj-poss)
|
||||
to-take (take-inner-fn pos adj-poss)
|
||||
]
|
||||
(take-inner-fn pos adj-poss-ordered)))
|
||||
))
|
||||
|
||||
;; ghost
|
||||
|
||||
(defn- ghost-incr [state poss-fn]
|
||||
(let [[ghost forest] (ghost/incr (:ghost state) (:forest state) poss-fn)]
|
||||
(assoc state :ghost ghost :forest forest)))
|
||||
|
||||
(defn- maybe-remove-roots [state]
|
||||
(if (>= (:tail-length state) (:frame state)) state
|
||||
(let [roots (forest/roots (:forest state))
|
||||
root-ids (map :id roots)
|
||||
]
|
||||
(-> state
|
||||
(update-in [:ghost] #(reduce ghost/rm-active-node % root-ids))
|
||||
(update-in [:forest] #(reduce forest/remove-node % root-ids))
|
||||
))))
|
||||
|
||||
(defn- update-node-meta [state id f]
|
||||
(update-in state [:forest] forest/update-node-meta id f))
|
||||
|
||||
(defn- ghost-set-active-nodes-color [state]
|
||||
(let [color (q/color (mod (:frame state) (frames-per-color-cycle state)) 1 1)]
|
||||
(reduce
|
||||
(fn [state id] (update-node-meta state id #(assoc % :color color)))
|
||||
state
|
||||
(get-in state [:ghost :active-node-ids]))))
|
||||
(->> adj-poss
|
||||
(filter #(in-bounds? grid-size %))
|
||||
(sort-by #(dist-from-sqr % [0 0]))
|
||||
(take-adj-poss (grid-size 0) pos)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; update
|
||||
|
||||
(defn- maybe-exit [state]
|
||||
(if (empty? (get-in state [:ghost :active-node-ids]))
|
||||
(if (zero? (:exit-wait-frames state)) (new-state)
|
||||
(update-in state [:exit-wait-frames] dec))
|
||||
state))
|
||||
(defn- update-ghost-forest [state update-fn]
|
||||
(let [[ghosts forest]
|
||||
(reduce (fn [[ghosts forest] ghost]
|
||||
(let [[ghost forest] (update-fn ghost forest)]
|
||||
[(cons ghost ghosts) forest]))
|
||||
[nil (:forest state)]
|
||||
(:ghosts state))]
|
||||
(assoc state :ghosts (reverse ghosts) :forest forest)))
|
||||
|
||||
(defn- ghost-incr [state poss-fn]
|
||||
(update-ghost-forest state #(ghost/incr %1 %2 poss-fn)))
|
||||
|
||||
(defn rm-nodes [state node-ids]
|
||||
(update-ghost-forest state (fn [ghost forest]
|
||||
[(reduce ghost/rm-active-node ghost node-ids)
|
||||
(reduce forest/remove-node forest node-ids)])))
|
||||
|
||||
(defn- maybe-remove-roots [state]
|
||||
(if (>= (:tail-length state) (:frame state))
|
||||
state
|
||||
(rm-nodes state (map :id (forest/roots (:forest state))))))
|
||||
|
||||
(defn- ghost-set-color [state]
|
||||
(update-ghost-forest state (fn [ghost forest]
|
||||
(let [color ((get-in ghost [:ghost-def :color-fn]) state)]
|
||||
[(assoc ghost :color color) forest]))))
|
||||
|
||||
(defn update-state [state]
|
||||
(let [poss-fn (mk-poss-fn state)]
|
||||
(-> state
|
||||
;(set-dial)
|
||||
(ghost-set-color)
|
||||
(ghost-incr poss-fn)
|
||||
(ghost-set-active-nodes-color)
|
||||
(maybe-remove-roots)
|
||||
(update-in [:frame] inc)
|
||||
(maybe-exit)
|
||||
)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; draw
|
||||
|
||||
(defn- draw-ellipse [state pos size] ; size is [w h]
|
||||
(let [scaled-pos (scale state pos)
|
||||
scaled-size (map int (scale state size))]
|
||||
(defn- draw-ellipse [pos size scale-fn] ; size is [w h]
|
||||
(let [scaled-pos (scale-fn pos)
|
||||
scaled-size (map int (scale-fn size))]
|
||||
(apply q/ellipse (concat scaled-pos scaled-size))))
|
||||
|
||||
(defn- in-line? [& nodes]
|
||||
(apply = (map #(apply map - %1)
|
||||
(partition 2 1 (map :pos nodes)))))
|
||||
|
||||
(defn- draw-node [state node active?]
|
||||
(defn- draw-node [node active? scale-fn]
|
||||
(let [pos (:pos node)
|
||||
stroke (get-in node [:meta :color])
|
||||
fill (if active? stroke 0xFFFFFFFF)
|
||||
size (:val (dial/scaled (:dial state) 0.25 0.45))
|
||||
]
|
||||
(q/stroke stroke)
|
||||
(q/fill fill)
|
||||
(draw-ellipse state pos [size size])))
|
||||
(draw-ellipse pos [0.30 0.30] scale-fn)))
|
||||
|
||||
(defn- draw-line [state node parent]
|
||||
(defn- draw-line [node parent scale-fn]
|
||||
(let [node-color (get-in node [:meta :color])
|
||||
parent-color (get-in node [:meta :color])
|
||||
color (q/lerp-color node-color parent-color 0.5)
|
||||
weight (:val (dial/scaled (:dial state) -1 3))
|
||||
]
|
||||
(q/stroke color)
|
||||
(q/stroke-weight weight)
|
||||
(apply q/line (map #(scale state %) (map :pos (list parent node))))))
|
||||
(q/stroke-weight 1)
|
||||
(apply q/line (map scale-fn (map :pos (list parent node))))))
|
||||
|
||||
(defn draw-lines [state forest parent node]
|
||||
(defn- draw-lines [forest parent node scale-fn]
|
||||
"Draws the lines of all children leading from the node, recursively"
|
||||
(let [children (map #(forest/get-node forest %) (:child-ids node))]
|
||||
|
||||
(if-not parent
|
||||
(doseq [child children] (draw-lines state forest node child))
|
||||
(doseq [child children] (draw-lines forest node child scale-fn))
|
||||
(let [in-line-child (some #(if (in-line? parent node %) %) children)
|
||||
]
|
||||
(doseq [child children]
|
||||
(if (and in-line-child (= in-line-child child))
|
||||
(draw-lines state forest parent child)
|
||||
(draw-lines state forest node child)))
|
||||
(draw-lines forest parent child scale-fn)
|
||||
(draw-lines forest node child scale-fn)))
|
||||
(when-not in-line-child
|
||||
(draw-line state node parent))
|
||||
(draw-line node parent scale-fn))
|
||||
))
|
||||
|
||||
; we also take the opportunity to draw the leaves
|
||||
(when (empty? children)
|
||||
(draw-node state node false))
|
||||
|
||||
(draw-node node false scale-fn))
|
||||
))
|
||||
|
||||
(defn draw-dial [state dial posL posR]
|
||||
@ -293,31 +215,27 @@
|
||||
(defn draw-state [state]
|
||||
; Clear the sketch by filling it with light-grey color.
|
||||
(q/background 0xFFFFFFFF)
|
||||
(q/with-translation [(/ (window-size 0) 2)
|
||||
(/ (window-size 1) 2)]
|
||||
(let [lines (forest/lines (:forest state))
|
||||
leaves (forest/leaves (:forest state))
|
||||
active (ghost/active-nodes (:ghost state) (:forest state))
|
||||
roots (forest/roots (:forest state))
|
||||
(q/with-translation window-half-size
|
||||
|
||||
(let [grid-size (:grid-size state)
|
||||
scale-fn #(scale grid-size %)
|
||||
ghost (:ghost state)
|
||||
forest (:forest state)
|
||||
roots (forest/roots forest)
|
||||
]
|
||||
|
||||
;(q/stroke 0xFF000000)
|
||||
(doseq [root roots]
|
||||
(draw-lines state (:forest state) nil root))
|
||||
(draw-lines forest nil root scale-fn))
|
||||
|
||||
(doseq [ghost (:ghosts state)]
|
||||
(doseq [active-node (map #(forest/get-node forest %)
|
||||
(:active-node-ids ghost))]
|
||||
(draw-node active-node true scale-fn)))
|
||||
|
||||
;(q/stroke 0xFF000000)
|
||||
;(q/fill 0xFF000000)
|
||||
(doseq [active-node active]
|
||||
(draw-node state active-node true))
|
||||
))
|
||||
|
||||
;(draw-dial state (:dial state) [30 30] [100 30])
|
||||
|
||||
;(when-not (zero? (:gif-seconds state))
|
||||
; (let [anim-frames (* (:gif-seconds state) (:frame-rate state))]
|
||||
; (gil/save-animation "quil.gif" anim-frames 0)
|
||||
; (when (> (:frame state) anim-frames) (q/exit))))
|
||||
|
||||
;(q/text (clojure.string/join
|
||||
; "\n"
|
||||
; (list
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user