@p4ulcristian/iris-layout 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cljs-runtime/cljs.core.js +38746 -0
- package/dist/cljs-runtime/cljs.core.js.map +1 -0
- package/dist/cljs-runtime/cljs.pprint.js +8400 -0
- package/dist/cljs-runtime/cljs.pprint.js.map +1 -0
- package/dist/cljs-runtime/cljs.stacktrace.js +561 -0
- package/dist/cljs-runtime/cljs.stacktrace.js.map +1 -0
- package/dist/cljs-runtime/cljs_env.js +1286 -0
- package/dist/cljs-runtime/clojure.data.js +295 -0
- package/dist/cljs-runtime/clojure.data.js.map +1 -0
- package/dist/cljs-runtime/clojure.set.js +382 -0
- package/dist/cljs-runtime/clojure.set.js.map +1 -0
- package/dist/cljs-runtime/clojure.string.js +480 -0
- package/dist/cljs-runtime/clojure.string.js.map +1 -0
- package/dist/cljs-runtime/clojure.walk.js +132 -0
- package/dist/cljs-runtime/clojure.walk.js.map +1 -0
- package/dist/cljs-runtime/devtools.async.js +90 -0
- package/dist/cljs-runtime/devtools.async.js.map +1 -0
- package/dist/cljs-runtime/devtools.context.js +11 -0
- package/dist/cljs-runtime/devtools.context.js.map +1 -0
- package/dist/cljs-runtime/devtools.core.js +175 -0
- package/dist/cljs-runtime/devtools.core.js.map +1 -0
- package/dist/cljs-runtime/devtools.defaults.js +20 -0
- package/dist/cljs-runtime/devtools.defaults.js.map +1 -0
- package/dist/cljs-runtime/devtools.format.js +631 -0
- package/dist/cljs-runtime/devtools.format.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.budgeting.js +182 -0
- package/dist/cljs-runtime/devtools.formatters.budgeting.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.core.js +220 -0
- package/dist/cljs-runtime/devtools.formatters.core.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.helpers.js +228 -0
- package/dist/cljs-runtime/devtools.formatters.helpers.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.js +261 -0
- package/dist/cljs-runtime/devtools.formatters.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.markup.js +1174 -0
- package/dist/cljs-runtime/devtools.formatters.markup.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.printing.js +313 -0
- package/dist/cljs-runtime/devtools.formatters.printing.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.state.js +325 -0
- package/dist/cljs-runtime/devtools.formatters.state.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.templating.js +666 -0
- package/dist/cljs-runtime/devtools.formatters.templating.js.map +1 -0
- package/dist/cljs-runtime/devtools.hints.js +193 -0
- package/dist/cljs-runtime/devtools.hints.js.map +1 -0
- package/dist/cljs-runtime/devtools.munging.js +1058 -0
- package/dist/cljs-runtime/devtools.munging.js.map +1 -0
- package/dist/cljs-runtime/devtools.prefs.js +87 -0
- package/dist/cljs-runtime/devtools.prefs.js.map +1 -0
- package/dist/cljs-runtime/devtools.preload.js +11 -0
- package/dist/cljs-runtime/devtools.preload.js.map +1 -0
- package/dist/cljs-runtime/devtools.protocols.js +98 -0
- package/dist/cljs-runtime/devtools.protocols.js.map +1 -0
- package/dist/cljs-runtime/devtools.reporter.js +81 -0
- package/dist/cljs-runtime/devtools.reporter.js.map +1 -0
- package/dist/cljs-runtime/devtools.toolbox.js +141 -0
- package/dist/cljs-runtime/devtools.toolbox.js.map +1 -0
- package/dist/cljs-runtime/devtools.util.js +517 -0
- package/dist/cljs-runtime/devtools.util.js.map +1 -0
- package/dist/cljs-runtime/devtools.version.js +9 -0
- package/dist/cljs-runtime/devtools.version.js.map +1 -0
- package/dist/cljs-runtime/goog.array.array.js +659 -0
- package/dist/cljs-runtime/goog.array.array.js.map +9 -0
- package/dist/cljs-runtime/goog.asserts.asserts.js +133 -0
- package/dist/cljs-runtime/goog.asserts.asserts.js.map +9 -0
- package/dist/cljs-runtime/goog.asserts.dom.js +90 -0
- package/dist/cljs-runtime/goog.asserts.dom.js.map +9 -0
- package/dist/cljs-runtime/goog.async.nexttick.js +93 -0
- package/dist/cljs-runtime/goog.async.nexttick.js.map +9 -0
- package/dist/cljs-runtime/goog.base.js +1261 -0
- package/dist/cljs-runtime/goog.base.js.map +9 -0
- package/dist/cljs-runtime/goog.collections.maps.js +82 -0
- package/dist/cljs-runtime/goog.collections.maps.js.map +9 -0
- package/dist/cljs-runtime/goog.debug.entrypointregistry.js +44 -0
- package/dist/cljs-runtime/goog.debug.entrypointregistry.js.map +9 -0
- package/dist/cljs-runtime/goog.debug.error.js +30 -0
- package/dist/cljs-runtime/goog.debug.error.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.asserts.js +40 -0
- package/dist/cljs-runtime/goog.dom.asserts.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.browserfeature.js +21 -0
- package/dist/cljs-runtime/goog.dom.browserfeature.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.dom.js +1087 -0
- package/dist/cljs-runtime/goog.dom.dom.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.element.js +69 -0
- package/dist/cljs-runtime/goog.dom.element.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.htmlelement.js +7 -0
- package/dist/cljs-runtime/goog.dom.htmlelement.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.nodetype.js +6 -0
- package/dist/cljs-runtime/goog.dom.nodetype.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.safe.js +277 -0
- package/dist/cljs-runtime/goog.dom.safe.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.tagname.js +147 -0
- package/dist/cljs-runtime/goog.dom.tagname.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.tags.js +10 -0
- package/dist/cljs-runtime/goog.dom.tags.js.map +9 -0
- package/dist/cljs-runtime/goog.flags.flags.js +12 -0
- package/dist/cljs-runtime/goog.flags.flags.js.map +9 -0
- package/dist/cljs-runtime/goog.fs.blob.js +38 -0
- package/dist/cljs-runtime/goog.fs.blob.js.map +9 -0
- package/dist/cljs-runtime/goog.fs.url.js +37 -0
- package/dist/cljs-runtime/goog.fs.url.js.map +9 -0
- package/dist/cljs-runtime/goog.functions.functions.js +211 -0
- package/dist/cljs-runtime/goog.functions.functions.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safehtml.js +321 -0
- package/dist/cljs-runtime/goog.html.safehtml.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safescript.js +65 -0
- package/dist/cljs-runtime/goog.html.safescript.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safestyle.js +175 -0
- package/dist/cljs-runtime/goog.html.safestyle.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safestylesheet.js +99 -0
- package/dist/cljs-runtime/goog.html.safestylesheet.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safeurl.js +231 -0
- package/dist/cljs-runtime/goog.html.safeurl.js.map +9 -0
- package/dist/cljs-runtime/goog.html.trustedresourceurl.js +123 -0
- package/dist/cljs-runtime/goog.html.trustedresourceurl.js.map +9 -0
- package/dist/cljs-runtime/goog.html.trustedtypes.js +16 -0
- package/dist/cljs-runtime/goog.html.trustedtypes.js.map +9 -0
- package/dist/cljs-runtime/goog.html.uncheckedconversions.js +52 -0
- package/dist/cljs-runtime/goog.html.uncheckedconversions.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.browser.js +352 -0
- package/dist/cljs-runtime/goog.labs.useragent.browser.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.engine.js +73 -0
- package/dist/cljs-runtime/goog.labs.useragent.engine.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js +14 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js +74 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.platform.js +147 -0
- package/dist/cljs-runtime/goog.labs.useragent.platform.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.useragent.js +21 -0
- package/dist/cljs-runtime/goog.labs.useragent.useragent.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.util.js +81 -0
- package/dist/cljs-runtime/goog.labs.useragent.util.js.map +9 -0
- package/dist/cljs-runtime/goog.math.coordinate.js +97 -0
- package/dist/cljs-runtime/goog.math.coordinate.js.map +9 -0
- package/dist/cljs-runtime/goog.math.integer.js +445 -0
- package/dist/cljs-runtime/goog.math.integer.js.map +9 -0
- package/dist/cljs-runtime/goog.math.long.js +437 -0
- package/dist/cljs-runtime/goog.math.long.js.map +9 -0
- package/dist/cljs-runtime/goog.math.math.js +158 -0
- package/dist/cljs-runtime/goog.math.math.js.map +9 -0
- package/dist/cljs-runtime/goog.math.size.js +76 -0
- package/dist/cljs-runtime/goog.math.size.js.map +9 -0
- package/dist/cljs-runtime/goog.object.object.js +284 -0
- package/dist/cljs-runtime/goog.object.object.js.map +9 -0
- package/dist/cljs-runtime/goog.reflect.reflect.js +32 -0
- package/dist/cljs-runtime/goog.reflect.reflect.js.map +9 -0
- package/dist/cljs-runtime/goog.string.const.js +35 -0
- package/dist/cljs-runtime/goog.string.const.js.map +9 -0
- package/dist/cljs-runtime/goog.string.internal.js +119 -0
- package/dist/cljs-runtime/goog.string.internal.js.map +9 -0
- package/dist/cljs-runtime/goog.string.string.js +462 -0
- package/dist/cljs-runtime/goog.string.string.js.map +9 -0
- package/dist/cljs-runtime/goog.string.stringbuffer.js +32 -0
- package/dist/cljs-runtime/goog.string.stringbuffer.js.map +9 -0
- package/dist/cljs-runtime/goog.string.typedstring.js +9 -0
- package/dist/cljs-runtime/goog.string.typedstring.js.map +9 -0
- package/dist/cljs-runtime/goog.structs.structs.js +199 -0
- package/dist/cljs-runtime/goog.structs.structs.js.map +9 -0
- package/dist/cljs-runtime/goog.uri.uri.js +628 -0
- package/dist/cljs-runtime/goog.uri.uri.js.map +9 -0
- package/dist/cljs-runtime/goog.uri.utils.js +326 -0
- package/dist/cljs-runtime/goog.uri.utils.js.map +9 -0
- package/dist/cljs-runtime/goog.useragent.useragent.js +139 -0
- package/dist/cljs-runtime/goog.useragent.useragent.js.map +9 -0
- package/dist/cljs-runtime/iris_layout.components.entity_card_group.js +202 -0
- package/dist/cljs-runtime/iris_layout.components.entity_card_group.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile.js +295 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js +33 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.resizer.js +91 -0
- package/dist/cljs-runtime/iris_layout.components.resizer.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js +399 -0
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.core.js +1372 -0
- package/dist/cljs-runtime/iris_layout.core.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.layout.js +328 -0
- package/dist/cljs-runtime/iris_layout.layout.js.map +1 -0
- package/dist/cljs-runtime/reagent.core.js +993 -0
- package/dist/cljs-runtime/reagent.core.js.map +1 -0
- package/dist/cljs-runtime/reagent.debug.js +75 -0
- package/dist/cljs-runtime/reagent.debug.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.batching.js +270 -0
- package/dist/cljs-runtime/reagent.impl.batching.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.component.js +758 -0
- package/dist/cljs-runtime/reagent.impl.component.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.input.js +175 -0
- package/dist/cljs-runtime/reagent.impl.input.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.protocols.js +99 -0
- package/dist/cljs-runtime/reagent.impl.protocols.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.template.js +660 -0
- package/dist/cljs-runtime/reagent.impl.template.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.util.js +748 -0
- package/dist/cljs-runtime/reagent.impl.util.js.map +1 -0
- package/dist/cljs-runtime/reagent.ratom.js +1668 -0
- package/dist/cljs-runtime/reagent.ratom.js.map +1 -0
- package/dist/cljs-runtime/shadow.esm.esm_import$react.js +5 -0
- package/dist/cljs-runtime/shadow.module.iris-layout.append.js +2 -0
- package/dist/cljs-runtime/shadow.module.iris-layout.prepend.js +2 -0
- package/dist/iris-layout.js +375 -355
- package/dist/styles.css +287 -9
- package/package.json +1 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
import "./cljs.core.js";
|
|
3
|
+
import "./reagent.core.js";
|
|
4
|
+
import "./iris_layout.components.touch_drag.js";
|
|
5
|
+
goog.provide('iris_layout.components.entity_tile');
|
|
6
|
+
/**
|
|
7
|
+
* Determine which half of the tile the cursor is closest to.
|
|
8
|
+
*/
|
|
9
|
+
iris_layout.components.entity_tile.calculate_half = (function iris_layout$components$entity_tile$calculate_half(e,tile_elem){
|
|
10
|
+
var rect = tile_elem.getBoundingClientRect();
|
|
11
|
+
var cx = (rect.left + (rect.width / (2)));
|
|
12
|
+
var cy = (rect.top + (rect.height / (2)));
|
|
13
|
+
var dx = (e.clientX - cx);
|
|
14
|
+
var dy = (e.clientY - cy);
|
|
15
|
+
if((Math.abs(dx) > Math.abs(dy))){
|
|
16
|
+
if((dx < (0))){
|
|
17
|
+
return new cljs.core.Keyword(null,"left","left",-399115937);
|
|
18
|
+
} else {
|
|
19
|
+
return new cljs.core.Keyword(null,"right","right",-452581833);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if((dy < (0))){
|
|
23
|
+
return new cljs.core.Keyword(null,"top","top",-1856271961);
|
|
24
|
+
} else {
|
|
25
|
+
return new cljs.core.Keyword(null,"bottom","bottom",-1550509018);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
iris_layout.components.entity_tile.half__GT_direction = (function iris_layout$components$entity_tile$half__GT_direction(half){
|
|
30
|
+
if(((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(half,new cljs.core.Keyword(null,"left","left",-399115937))) || (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(half,new cljs.core.Keyword(null,"right","right",-452581833))))){
|
|
31
|
+
return new cljs.core.Keyword(null,"horizontal","horizontal",2062109475);
|
|
32
|
+
} else {
|
|
33
|
+
return new cljs.core.Keyword(null,"vertical","vertical",718696748);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
iris_layout.components.entity_tile.direction_labels = new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"top","top",-1856271961),"Split above",new cljs.core.Keyword(null,"bottom","bottom",-1550509018),"Split below",new cljs.core.Keyword(null,"left","left",-399115937),"Split left",new cljs.core.Keyword(null,"right","right",-452581833),"Split right"], null);
|
|
37
|
+
iris_layout.components.entity_tile.drop_indicator = (function iris_layout$components$entity_tile$drop_indicator(half,visible_QMARK_){
|
|
38
|
+
if(cljs.core.truth_(visible_QMARK_)){
|
|
39
|
+
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.iris-drop-indicator","div.iris-drop-indicator",-365975645),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"class","class",-2030961996),["iris-drop-highlight iris-drop-",cljs.core.name(half)].join('')], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.iris-drop-label-container","div.iris-drop-label-container",915701277),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span.iris-drop-label","span.iris-drop-label",355054911),cljs.core.get.cljs$core$IFn$_invoke$arity$3(iris_layout.components.entity_tile.direction_labels,half,"Split")], null)], null)], null);
|
|
40
|
+
} else {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.entity_tile !== 'undefined') && (typeof iris_layout.components.entity_tile.drag_source_tile !== 'undefined')){
|
|
45
|
+
} else {
|
|
46
|
+
iris_layout.components.entity_tile.drag_source_tile = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
47
|
+
}
|
|
48
|
+
if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.entity_tile !== 'undefined') && (typeof iris_layout.components.entity_tile.drag_source_entity !== 'undefined')){
|
|
49
|
+
} else {
|
|
50
|
+
iris_layout.components.entity_tile.drag_source_entity = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
51
|
+
}
|
|
52
|
+
if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.entity_tile !== 'undefined') && (typeof iris_layout.components.entity_tile.fullscreen_tile !== 'undefined')){
|
|
53
|
+
} else {
|
|
54
|
+
iris_layout.components.entity_tile.fullscreen_tile = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
55
|
+
}
|
|
56
|
+
iris_layout.components.entity_tile.clear_drop_state_BANG_ = (function iris_layout$components$entity_tile$clear_drop_state_BANG_(drag_over,closest_edge){
|
|
57
|
+
cljs.core.reset_BANG_(drag_over,false);
|
|
58
|
+
|
|
59
|
+
return cljs.core.reset_BANG_(closest_edge,null);
|
|
60
|
+
});
|
|
61
|
+
iris_layout.components.entity_tile.handle_drag_over = (function iris_layout$components$entity_tile$handle_drag_over(e,dragging,drag_over,closest_edge,tile_ref){
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
|
|
64
|
+
if(cljs.core.truth_(cljs.core.deref(dragging))){
|
|
65
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
66
|
+
} else {
|
|
67
|
+
var temp__5804__auto__ = cljs.core.deref(tile_ref);
|
|
68
|
+
if(cljs.core.truth_(temp__5804__auto__)){
|
|
69
|
+
var el = temp__5804__auto__;
|
|
70
|
+
var half = iris_layout.components.entity_tile.calculate_half(e,el);
|
|
71
|
+
cljs.core.reset_BANG_(closest_edge,half);
|
|
72
|
+
|
|
73
|
+
return cljs.core.reset_BANG_(drag_over,true);
|
|
74
|
+
} else {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
iris_layout.components.entity_tile.handle_drop = (function iris_layout$components$entity_tile$handle_drop(e,node,tile_ref,split_ref,drag_over,closest_edge){
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
|
|
84
|
+
var temp__5804__auto___6924 = cljs.core.deref(tile_ref);
|
|
85
|
+
if(cljs.core.truth_(temp__5804__auto___6924)){
|
|
86
|
+
var el_6925 = temp__5804__auto___6924;
|
|
87
|
+
var half_6926 = iris_layout.components.entity_tile.calculate_half(e,el_6925);
|
|
88
|
+
var direction_6927 = iris_layout.components.entity_tile.half__GT_direction(half_6926);
|
|
89
|
+
var raw_6928 = e.dataTransfer.getData("text/plain");
|
|
90
|
+
try{var data_6929 = JSON.parse(raw_6928);
|
|
91
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(data_6929.source,"tile");
|
|
92
|
+
if(and__5000__auto__){
|
|
93
|
+
return data_6929.entityId;
|
|
94
|
+
} else {
|
|
95
|
+
return and__5000__auto__;
|
|
96
|
+
}
|
|
97
|
+
})())){
|
|
98
|
+
if(cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(data_6929.tileId,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node))){
|
|
99
|
+
var G__6901_6931 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
100
|
+
var G__6902_6932 = data_6929.entityId;
|
|
101
|
+
var G__6903_6933 = direction_6927;
|
|
102
|
+
var G__6904_6934 = new cljs.core.Keyword(null,"tile","tile",758132866);
|
|
103
|
+
var G__6905_6935 = half_6926;
|
|
104
|
+
var fexpr__6900_6936 = cljs.core.deref(split_ref);
|
|
105
|
+
(fexpr__6900_6936.cljs$core$IFn$_invoke$arity$5 ? fexpr__6900_6936.cljs$core$IFn$_invoke$arity$5(G__6901_6931,G__6902_6932,G__6903_6933,G__6904_6934,G__6905_6935) : fexpr__6900_6936.call(null,G__6901_6931,G__6902_6932,G__6903_6933,G__6904_6934,G__6905_6935));
|
|
106
|
+
} else {
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(data_6929.source,"sidebar")){
|
|
110
|
+
var temp__5804__auto___6937__$1 = data_6929.entityId;
|
|
111
|
+
if(cljs.core.truth_(temp__5804__auto___6937__$1)){
|
|
112
|
+
var eid_6938 = temp__5804__auto___6937__$1;
|
|
113
|
+
var G__6907_6939 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
114
|
+
var G__6908_6940 = eid_6938;
|
|
115
|
+
var G__6909_6941 = direction_6927;
|
|
116
|
+
var G__6910_6942 = new cljs.core.Keyword(null,"sidebar","sidebar",35784458);
|
|
117
|
+
var G__6911_6943 = half_6926;
|
|
118
|
+
var fexpr__6906_6944 = cljs.core.deref(split_ref);
|
|
119
|
+
(fexpr__6906_6944.cljs$core$IFn$_invoke$arity$5 ? fexpr__6906_6944.cljs$core$IFn$_invoke$arity$5(G__6907_6939,G__6908_6940,G__6909_6941,G__6910_6942,G__6911_6943) : fexpr__6906_6944.call(null,G__6907_6939,G__6908_6940,G__6909_6941,G__6910_6942,G__6911_6943));
|
|
120
|
+
} else {
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}catch (e6894){var __6945 = e6894;
|
|
126
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = raw_6928;
|
|
127
|
+
if(cljs.core.truth_(and__5000__auto__)){
|
|
128
|
+
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(raw_6928,"");
|
|
129
|
+
} else {
|
|
130
|
+
return and__5000__auto__;
|
|
131
|
+
}
|
|
132
|
+
})())){
|
|
133
|
+
var G__6896_6946 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
134
|
+
var G__6897_6947 = raw_6928;
|
|
135
|
+
var G__6898_6948 = direction_6927;
|
|
136
|
+
var G__6899_6949 = new cljs.core.Keyword(null,"sidebar","sidebar",35784458);
|
|
137
|
+
var fexpr__6895_6950 = cljs.core.deref(split_ref);
|
|
138
|
+
(fexpr__6895_6950.cljs$core$IFn$_invoke$arity$4 ? fexpr__6895_6950.cljs$core$IFn$_invoke$arity$4(G__6896_6946,G__6897_6947,G__6898_6948,G__6899_6949) : fexpr__6895_6950.call(null,G__6896_6946,G__6897_6947,G__6898_6948,G__6899_6949));
|
|
139
|
+
} else {
|
|
140
|
+
}
|
|
141
|
+
}} else {
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
145
|
+
});
|
|
146
|
+
iris_layout.components.entity_tile.handle_touch_end = (function iris_layout$components$entity_tile$handle_touch_end(dragging,split_ref){
|
|
147
|
+
iris_layout.components.touch_drag.cancel_pending_BANG_();
|
|
148
|
+
|
|
149
|
+
if(iris_layout.components.touch_drag.dragging_QMARK_()){
|
|
150
|
+
cljs.core.reset_BANG_(dragging,false);
|
|
151
|
+
|
|
152
|
+
var temp__5804__auto___6951 = iris_layout.components.touch_drag.end_drag_BANG_();
|
|
153
|
+
if(cljs.core.truth_(temp__5804__auto___6951)){
|
|
154
|
+
var drop_info_6952 = temp__5804__auto___6951;
|
|
155
|
+
var map__6912_6953 = drop_info_6952;
|
|
156
|
+
var map__6912_6954__$1 = cljs.core.__destructure_map(map__6912_6953);
|
|
157
|
+
var target_tile_id_6955 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6912_6954__$1,new cljs.core.Keyword(null,"target-tile-id","target-tile-id",-1830903484));
|
|
158
|
+
var half_6956 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6912_6954__$1,new cljs.core.Keyword(null,"half","half",741990005));
|
|
159
|
+
var source_entity_id_6957 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6912_6954__$1,new cljs.core.Keyword(null,"source-entity-id","source-entity-id",-509281427));
|
|
160
|
+
var source_tile_id_6958 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6912_6954__$1,new cljs.core.Keyword(null,"source-tile-id","source-tile-id",1477902631));
|
|
161
|
+
var direction_6959 = iris_layout.components.entity_tile.half__GT_direction(half_6956);
|
|
162
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = target_tile_id_6955;
|
|
163
|
+
if(cljs.core.truth_(and__5000__auto__)){
|
|
164
|
+
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(source_tile_id_6958,target_tile_id_6955);
|
|
165
|
+
} else {
|
|
166
|
+
return and__5000__auto__;
|
|
167
|
+
}
|
|
168
|
+
})())){
|
|
169
|
+
var fexpr__6913_6960 = cljs.core.deref(split_ref);
|
|
170
|
+
(fexpr__6913_6960.cljs$core$IFn$_invoke$arity$5 ? fexpr__6913_6960.cljs$core$IFn$_invoke$arity$5(target_tile_id_6955,source_entity_id_6957,direction_6959,new cljs.core.Keyword(null,"tile","tile",758132866),half_6956) : fexpr__6913_6960.call(null,target_tile_id_6955,source_entity_id_6957,direction_6959,new cljs.core.Keyword(null,"tile","tile",758132866),half_6956));
|
|
171
|
+
} else {
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return cljs.core.reset_BANG_(dragging,false);
|
|
179
|
+
});
|
|
180
|
+
iris_layout.components.entity_tile.handle_drag_start = (function iris_layout$components$entity_tile$handle_drag_start(e,node,dragging){
|
|
181
|
+
e.dataTransfer.setData("text/plain",JSON.stringify(({"tileId": new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node), "entityId": new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node), "source": "tile"})));
|
|
182
|
+
|
|
183
|
+
(e.dataTransfer.effectAllowed = "all");
|
|
184
|
+
|
|
185
|
+
cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_tile,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node));
|
|
186
|
+
|
|
187
|
+
cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_entity,new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node));
|
|
188
|
+
|
|
189
|
+
return cljs.core.reset_BANG_(dragging,true);
|
|
190
|
+
});
|
|
191
|
+
iris_layout.components.entity_tile.handle_drag_end = (function iris_layout$components$entity_tile$handle_drag_end(dragging){
|
|
192
|
+
cljs.core.reset_BANG_(dragging,false);
|
|
193
|
+
|
|
194
|
+
cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_tile,null);
|
|
195
|
+
|
|
196
|
+
return cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_entity,null);
|
|
197
|
+
});
|
|
198
|
+
iris_layout.components.entity_tile.entity_tile_component = (function iris_layout$components$entity_tile$entity_tile_component(node,on_split,on_close,focused_QMARK_,entities,render_entity_tile,_parent_ctx){
|
|
199
|
+
var drag_over = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(false);
|
|
200
|
+
var closest_edge = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
201
|
+
var dragging = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(false);
|
|
202
|
+
var split_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_split);
|
|
203
|
+
var close_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_close);
|
|
204
|
+
var tile_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
205
|
+
var touch_watch_key = ["tile-",cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node))].join('');
|
|
206
|
+
var _ = cljs.core.add_watch(iris_layout.components.touch_drag.hover_target,touch_watch_key,(function (_,___$1,___$2,new_target){
|
|
207
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = new_target;
|
|
208
|
+
if(cljs.core.truth_(and__5000__auto__)){
|
|
209
|
+
return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"tile-id","tile-id",781804456).cljs$core$IFn$_invoke$arity$1(new_target),new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node));
|
|
210
|
+
} else {
|
|
211
|
+
return and__5000__auto__;
|
|
212
|
+
}
|
|
213
|
+
})())){
|
|
214
|
+
var source_id = new cljs.core.Keyword(null,"tile-id","tile-id",781804456).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(iris_layout.components.touch_drag.touch_state));
|
|
215
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(source_id,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node))){
|
|
216
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
217
|
+
} else {
|
|
218
|
+
cljs.core.reset_BANG_(closest_edge,new cljs.core.Keyword(null,"half","half",741990005).cljs$core$IFn$_invoke$arity$1(new_target));
|
|
219
|
+
|
|
220
|
+
return cljs.core.reset_BANG_(drag_over,true);
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
if(cljs.core.truth_(cljs.core.deref(drag_over))){
|
|
224
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
225
|
+
} else {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}));
|
|
230
|
+
return reagent.core.create_class.cljs$core$IFn$_invoke$arity$1(new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"component-will-unmount","component-will-unmount",-2058314698),(function (___$1){
|
|
231
|
+
return cljs.core.remove_watch(iris_layout.components.touch_drag.hover_target,touch_watch_key);
|
|
232
|
+
}),new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853),(function (node__$1,on_split__$1,on_close__$1,focused_QMARK___$1,entities__$1,render_entity_tile__$1,_parent_ctx__$1){
|
|
233
|
+
cljs.core.reset_BANG_(split_ref,on_split__$1);
|
|
234
|
+
|
|
235
|
+
cljs.core.reset_BANG_(close_ref,on_close__$1);
|
|
236
|
+
|
|
237
|
+
var entity = cljs.core.get.cljs$core$IFn$_invoke$arity$2(entities__$1,new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1));
|
|
238
|
+
var entity_name = (function (){var or__5002__auto__ = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(entity);
|
|
239
|
+
if(cljs.core.truth_(or__5002__auto__)){
|
|
240
|
+
return or__5002__auto__;
|
|
241
|
+
} else {
|
|
242
|
+
return new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1);
|
|
243
|
+
}
|
|
244
|
+
})();
|
|
245
|
+
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"data-tile-id","data-tile-id",-1283349274),new cljs.core.Keyword(null,"ref","ref",1289896967),new cljs.core.Keyword(null,"on-drop","on-drop",1867868491),new cljs.core.Keyword(null,"style","style",-496642736),new cljs.core.Keyword(null,"on-drag-leave","on-drag-leave",-373180078),new cljs.core.Keyword(null,"class","class",-2030961996),new cljs.core.Keyword(null,"on-drag-enter","on-drag-enter",-1692112235),new cljs.core.Keyword(null,"on-drag-over","on-drag-over",-93410408),new cljs.core.Keyword(null,"on-touch-start","on-touch-start",447239419),new cljs.core.Keyword(null,"on-touch-end","on-touch-end",1515667389)],[new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1),(function (p1__6914_SHARP_){
|
|
246
|
+
return cljs.core.reset_BANG_(tile_ref,p1__6914_SHARP_);
|
|
247
|
+
}),(function (p1__6916_SHARP_){
|
|
248
|
+
return iris_layout.components.entity_tile.handle_drop(p1__6916_SHARP_,node__$1,tile_ref,split_ref,drag_over,closest_edge);
|
|
249
|
+
}),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"flex","flex",-1425124628),(1)], null),(function (e){
|
|
250
|
+
if(cljs.core.truth_(e.currentTarget.contains(e.relatedTarget))){
|
|
251
|
+
return null;
|
|
252
|
+
} else {
|
|
253
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
254
|
+
}
|
|
255
|
+
}),["iris-entity-tile",(cljs.core.truth_(focused_QMARK___$1)?" iris-entity-tile-focused":null),((cljs.core.not(focused_QMARK___$1))?" iris-entity-tile-unfocused":null),(cljs.core.truth_(cljs.core.deref(drag_over))?" iris-drag-over":null),(cljs.core.truth_(cljs.core.deref(dragging))?" iris-dragging":null),((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(iris_layout.components.entity_tile.fullscreen_tile),new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1)))?" iris-entity-tile-fullscreen":null)].join(''),(function (e){
|
|
256
|
+
return e.preventDefault();
|
|
257
|
+
}),(function (p1__6915_SHARP_){
|
|
258
|
+
return iris_layout.components.entity_tile.handle_drag_over(p1__6915_SHARP_,dragging,drag_over,closest_edge,tile_ref);
|
|
259
|
+
}),(function (_e){
|
|
260
|
+
return iris_layout.components.touch_drag.start_pending_BANG_(new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1),new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1),_e,(function (){
|
|
261
|
+
return cljs.core.reset_BANG_(dragging,true);
|
|
262
|
+
}));
|
|
263
|
+
}),(function (_e){
|
|
264
|
+
return iris_layout.components.entity_tile.handle_touch_end(dragging,split_ref);
|
|
265
|
+
})]),new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.iris-entity-tile-header","div.iris-entity-tile-header",1611784817),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"draggable","draggable",1676206163),true,new cljs.core.Keyword(null,"on-double-click","on-double-click",1434856980),(function (___$1){
|
|
266
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(iris_layout.components.entity_tile.fullscreen_tile),new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1))){
|
|
267
|
+
return cljs.core.reset_BANG_(iris_layout.components.entity_tile.fullscreen_tile,null);
|
|
268
|
+
} else {
|
|
269
|
+
return cljs.core.reset_BANG_(iris_layout.components.entity_tile.fullscreen_tile,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1));
|
|
270
|
+
}
|
|
271
|
+
}),new cljs.core.Keyword(null,"on-drag-start","on-drag-start",-47712205),(function (p1__6917_SHARP_){
|
|
272
|
+
return iris_layout.components.entity_tile.handle_drag_start(p1__6917_SHARP_,node__$1,dragging);
|
|
273
|
+
}),new cljs.core.Keyword(null,"on-drag-end","on-drag-end",520272671),(function (___$1){
|
|
274
|
+
return iris_layout.components.entity_tile.handle_drag_end(dragging);
|
|
275
|
+
})], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span.iris-entity-tile-header-name","span.iris-entity-tile-header-name",-890448661),entity_name], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"button.iris-entity-tile-header-close","button.iris-entity-tile-header-close",-649034559),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"on-click","on-click",1632826543),(function (e){
|
|
276
|
+
e.stopPropagation();
|
|
277
|
+
|
|
278
|
+
if(cljs.core.truth_(cljs.core.deref(close_ref))){
|
|
279
|
+
var G__6919 = new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1);
|
|
280
|
+
var fexpr__6918 = cljs.core.deref(close_ref);
|
|
281
|
+
return (fexpr__6918.cljs$core$IFn$_invoke$arity$1 ? fexpr__6918.cljs$core$IFn$_invoke$arity$1(G__6919) : fexpr__6918.call(null,G__6919));
|
|
282
|
+
} else {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
})], null),"\u00D7"], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.iris-entity-tile-content","div.iris-entity-tile-content",-1333148856),(cljs.core.truth_((function (){var and__5000__auto__ = entity;
|
|
286
|
+
if(cljs.core.truth_(and__5000__auto__)){
|
|
287
|
+
return render_entity_tile__$1;
|
|
288
|
+
} else {
|
|
289
|
+
return and__5000__auto__;
|
|
290
|
+
}
|
|
291
|
+
})())?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,">",">",-555517146),render_entity_tile__$1,entity], null):null)], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [iris_layout.components.entity_tile.drop_indicator,cljs.core.deref(closest_edge),cljs.core.deref(drag_over)], null)], null);
|
|
292
|
+
})], null));
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
//# sourceMappingURL=iris_layout.components.entity_tile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["iris_layout/components/entity_tile.cljs"],"mappings":";;;;;AAKA;;;oDAAA,pDAAMA,gHAEHC,EAAEC;AAFL,AAGE,IAAMC,OAAK,AAAwBD;IAC7BE,KAAG,CAAG,AAAQD,YAAM,cAAA,bAAG,AAASA;IAChCE,KAAG,CAAG,AAAOF,WAAM,eAAA,dAAG,AAAUA;IAChCG,KAAG,CAAG,AAAWL,YAAGG;IACpBG,KAAG,CAAG,AAAWN,YAAGI;AAJ1B,AAKE,GAAI,CAAG,AAACG,SAAYF,MAAI,AAACE,SAAYD;AACnC,GAAI,MAAA,LAAMD;AAAV;;AAAA;;;AACA,GAAI,MAAA,LAAMC;AAAV;;AAAA;;;;AAEN,wDAAA,xDAAME,wHAAiBC;AAAvB,AACE,GAAI,EAAI,kDAAA,lDAACC,6CAAED,gEAAY,kDAAA,lDAACC,6CAAED;AAA1B;;AAAA;;;AAIF,sDAAA,2CAAA,oDAAA,cAAA,0DAAA,cAAA,qDAAA,aAAA,uDAAA,pWAAKE;AAIL,oDAAA,pDAAMC,gHAAgBH,KAAKI;AAA3B,AACE,oBAAMA;AAAN,AAAA,0FAAA,2FAAA,mFAAA,mDAAA,2CAAA,yIAAA,mFAAA,sGAAA,mFAAA,7VAEiB,CAAA,iCAAsC,AAACC,eAAKL,gYAElC,qGAAA,rGAACM,4CAAIJ,oDAAiBF;;AAJjD;;;AAOF,GAAA,QAAAO,wCAAAC,mDAAAC,+DAAAC;AAAA;AAAA,AAAA,AAASC,sDAAiB,6CAAA,7CAACC;;AAC3B,GAAA,QAAAL,wCAAAC,mDAAAC,+DAAAI;AAAA;AAAA,A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;;WArClB,yBAAA,mFAAA,sGA0CI,kBAAM,iBAAA7D,oBAAKuD;AAAL,AAAA,oBAAAvD;AAAYwC;;AAAZxC;;4LA1CV,qIAAA,AAAAX,8BAAA,AAAAA,zVA0CI,AAAA,mFAAA,qFAAA,tCACMmD,uBAAmBe,gHAGzBxF,kEAAgBiB,8BAAcD","names":["iris-layout.components.entity-tile/calculate-half","e","tile-elem","rect","cx","cy","dx","dy","js/Math.abs","iris-layout.components.entity-tile/half->direction","half","cljs.core._EQ_","iris-layout.components.entity-tile/direction-labels","iris-layout.components.entity-tile/drop-indicator","visible?","cljs.core/name","cljs.core.get","js/iris-layout","js/iris-layout.components","js/iris-layout.components.entity-tile","js/iris-layout.components.entity-tile.drag-source-tile","iris-layout.components.entity-tile/drag-source-tile","cljs.core.atom","js/iris-layout.components.entity-tile.drag-source-entity","iris-layout.components.entity-tile/drag-source-entity","js/iris-layout.components.entity-tile.fullscreen-tile","iris-layout.components.entity-tile/fullscreen-tile","reagent.core.atom","iris-layout.components.entity-tile/clear-drop-state!","drag-over","closest-edge","cljs.core/reset!","iris-layout.components.entity-tile/handle-drag-over","dragging","tile-ref","cljs.core/deref","temp__5804__auto__","el","iris-layout.components.entity-tile/handle-drop","node","split-ref","direction","raw","e6894","data","js/JSON.parse","and__5000__auto__","cljs.core.not_EQ_","G__6901","G__6902","G__6903","G__6904","G__6905","fexpr__6900","eid","G__6907","G__6908","G__6909","G__6910","G__6911","fexpr__6906","_","G__6896","G__6897","G__6898","G__6899","fexpr__6895","iris-layout.components.entity-tile/handle-touch-end","iris-layout.components.touch-drag/cancel-pending!","iris-layout.components.touch-drag/dragging?","drop-info","iris-layout.components.touch-drag/end-drag!","map__6912","cljs.core/--destructure-map","target-tile-id","source-entity-id","source-tile-id","fexpr__6913","iris-layout.components.entity-tile/handle-drag-start","js/JSON.stringify","iris-layout.components.entity-tile/handle-drag-end","iris-layout.components.entity-tile/entity-tile-component","on-split","on-close","focused?","entities","render-entity-tile","_parent-ctx","close-ref","touch-watch-key","cljs.core/add-watch","iris-layout.components.touch-drag/hover-target","new-target","source-id","iris-layout.components.touch-drag/touch-state","reagent.core.create_class","cljs.core/remove-watch","p1__6914#","p1__6916#","p1__6915#","p1__6917#","entity","entity-name","or__5002__auto__","cljs.core/not","_e","iris-layout.components.touch-drag/start-pending!","G__6919","fexpr__6918"],"sourcesContent":["(ns iris-layout.components.entity-tile\n \"Entity tile component \u2014 renders a single entity inside the Body layout.\"\n (:require [reagent.core :as r]\n [iris-layout.components.touch-drag :as touch-drag]))\n\n(defn calculate-half\n \"Determine which half of the tile the cursor is closest to.\"\n [e tile-elem]\n (let [rect (.getBoundingClientRect tile-elem)\n cx (+ (.-left rect) (/ (.-width rect) 2))\n cy (+ (.-top rect) (/ (.-height rect) 2))\n dx (- (.-clientX e) cx)\n dy (- (.-clientY e) cy)]\n (if (> (js/Math.abs dx) (js/Math.abs dy))\n (if (neg? dx) :left :right)\n (if (neg? dy) :top :bottom))))\n\n(defn half->direction [half]\n (if (or (= half :left) (= half :right))\n :horizontal\n :vertical))\n\n(def direction-labels\n {:top \"Split above\" :bottom \"Split below\"\n :left \"Split left\" :right \"Split right\"})\n\n(defn drop-indicator [half visible?]\n (when visible?\n [:div.iris-drop-indicator\n [:div {:class (str \"iris-drop-highlight iris-drop-\" (name half))}]\n [:div.iris-drop-label-container\n [:span.iris-drop-label (get direction-labels half \"Split\")]]]))\n\n;; Global atoms\n(defonce drag-source-tile (atom nil))\n(defonce drag-source-entity (atom nil))\n(defonce fullscreen-tile (r/atom nil))\n\n;; --- Extracted handler fns ---\n\n(defn- clear-drop-state! [drag-over closest-edge]\n (reset! drag-over false)\n (reset! closest-edge nil))\n\n(defn- handle-drag-over [e dragging drag-over closest-edge tile-ref]\n (.preventDefault e)\n (if @dragging\n (clear-drop-state! drag-over closest-edge)\n (when-let [el @tile-ref]\n (let [half (calculate-half e el)]\n (reset! closest-edge half)\n (reset! drag-over true)))))\n\n(defn- handle-drop [e node tile-ref split-ref drag-over closest-edge]\n (.preventDefault e)\n (.stopPropagation e)\n (when-let [el @tile-ref]\n (let [half (calculate-half e el)\n direction (half->direction half)\n raw (.getData (.-dataTransfer e) \"text/plain\")]\n (try\n (let [data (js/JSON.parse raw)]\n (cond\n (and (= (.-source data) \"tile\") (.-entityId data))\n (when (not= (.-tileId data) (:id node))\n (@split-ref (:id node) (.-entityId data) direction :tile half))\n\n (= (.-source data) \"sidebar\")\n (when-let [eid (.-entityId data)]\n (@split-ref (:id node) eid direction :sidebar half))))\n (catch :default _\n (when (and raw (not= raw \"\"))\n (@split-ref (:id node) raw direction :sidebar))))))\n (clear-drop-state! drag-over closest-edge))\n\n(defn- handle-touch-end [dragging split-ref]\n (touch-drag/cancel-pending!)\n (when (touch-drag/dragging?)\n (reset! dragging false)\n (when-let [drop-info (touch-drag/end-drag!)]\n (let [{:keys [target-tile-id half source-entity-id source-tile-id]} drop-info\n direction (half->direction half)]\n (when (and target-tile-id (not= source-tile-id target-tile-id))\n (@split-ref target-tile-id source-entity-id direction :tile half)))))\n (reset! dragging false))\n\n(defn- handle-drag-start [e node dragging]\n (.setData (.-dataTransfer e) \"text/plain\"\n (js/JSON.stringify #js {:tileId (:id node)\n :entityId (:entity-id node)\n :source \"tile\"}))\n (set! (.-effectAllowed (.-dataTransfer e)) \"all\")\n (reset! drag-source-tile (:id node))\n (reset! drag-source-entity (:entity-id node))\n (reset! dragging true))\n\n(defn- handle-drag-end [dragging]\n (reset! dragging false)\n (reset! drag-source-tile nil)\n (reset! drag-source-entity nil))\n\n;; --- Main component ---\n\n(defn entity-tile-component\n [node on-split on-close focused? entities render-entity-tile _parent-ctx]\n (let [drag-over (r/atom false)\n closest-edge (r/atom nil)\n dragging (r/atom false)\n split-ref (atom on-split)\n close-ref (atom on-close)\n tile-ref (atom nil)\n touch-watch-key (str \"tile-\" (:id node))\n _ (add-watch touch-drag/hover-target touch-watch-key\n (fn [_ _ _ new-target]\n (if (and new-target (= (:tile-id new-target) (:id node)))\n (let [source-id (:tile-id @touch-drag/touch-state)]\n (if (= source-id (:id node))\n (clear-drop-state! drag-over closest-edge)\n (do (reset! closest-edge (:half new-target))\n (reset! drag-over true))))\n (when @drag-over\n (clear-drop-state! drag-over closest-edge)))))]\n (r/create-class\n {:component-will-unmount\n (fn [_] (remove-watch touch-drag/hover-target touch-watch-key))\n\n :reagent-render\n (fn [node on-split on-close focused? entities render-entity-tile _parent-ctx]\n (reset! split-ref on-split)\n (reset! close-ref on-close)\n (let [entity (get entities (:entity-id node))\n entity-name (or (:name entity) (:entity-id node))]\n [:div\n {:ref #(reset! tile-ref %)\n :data-tile-id (:id node)\n :class (str \"iris-entity-tile\"\n (when focused? \" iris-entity-tile-focused\")\n (when (not focused?) \" iris-entity-tile-unfocused\")\n (when @drag-over \" iris-drag-over\")\n (when @dragging \" iris-dragging\")\n (when (= @fullscreen-tile (:id node)) \" iris-entity-tile-fullscreen\"))\n :style {:flex 1}\n :on-drag-over #(handle-drag-over % dragging drag-over closest-edge tile-ref)\n :on-drag-enter (fn [e] (.preventDefault e))\n :on-drag-leave (fn [e]\n (when-not (.contains (.-currentTarget e) (.-relatedTarget e))\n (clear-drop-state! drag-over closest-edge)))\n :on-drop #(handle-drop % node tile-ref split-ref drag-over closest-edge)\n :on-touch-start (fn [_e]\n (touch-drag/start-pending!\n (:id node) (:entity-id node) _e\n (fn [] (reset! dragging true))))\n :on-touch-end (fn [_e] (handle-touch-end dragging split-ref))}\n\n ;; Header\n [:div.iris-entity-tile-header\n {:draggable true\n :on-double-click (fn [_]\n (if (= @fullscreen-tile (:id node))\n (reset! fullscreen-tile nil)\n (reset! fullscreen-tile (:id node))))\n :on-drag-start #(handle-drag-start % node dragging)\n :on-drag-end (fn [_] (handle-drag-end dragging))}\n [:span.iris-entity-tile-header-name entity-name]\n [:button.iris-entity-tile-header-close\n {:on-click (fn [e]\n (.stopPropagation e)\n (when @close-ref (@close-ref (:entity-id node))))}\n \"\\u00d7\"]]\n\n ;; Content\n [:div.iris-entity-tile-content\n (when (and entity render-entity-tile)\n [:> render-entity-tile entity])]\n\n ;; Drop indicator\n [drop-indicator @closest-edge @drag-over]]))})))\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
import "./cljs.core.js";
|
|
3
|
+
import "./iris_layout.layout.js";
|
|
4
|
+
import "./iris_layout.components.entity_tile.js";
|
|
5
|
+
import "./iris_layout.components.resizer.js";
|
|
6
|
+
goog.provide('iris_layout.components.entity_tile_group');
|
|
7
|
+
/**
|
|
8
|
+
* Recursively render a layout tree node.
|
|
9
|
+
*/
|
|
10
|
+
iris_layout.components.entity_tile_group.entity_tile_group = (function iris_layout$components$entity_tile_group$entity_tile_group(node,on_split,on_close,on_ratio_change,active_entity,entities,render_entity_tile){
|
|
11
|
+
var G__6920 = iris_layout.layout.node_type(node);
|
|
12
|
+
var G__6920__$1 = (((G__6920 instanceof cljs.core.Keyword))?G__6920.fqn:null);
|
|
13
|
+
switch (G__6920__$1) {
|
|
14
|
+
case "tile":
|
|
15
|
+
return new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [iris_layout.components.entity_tile.entity_tile_component,node,on_split,on_close,cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node),active_entity),entities,render_entity_tile,null], null);
|
|
16
|
+
|
|
17
|
+
break;
|
|
18
|
+
case "split":
|
|
19
|
+
var vec__6921 = new cljs.core.Keyword(null,"children","children",-940561982).cljs$core$IFn$_invoke$arity$1(node);
|
|
20
|
+
var child1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__6921,(0),null);
|
|
21
|
+
var child2 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__6921,(1),null);
|
|
22
|
+
var direction = new cljs.core.Keyword(null,"direction","direction",-633359395).cljs$core$IFn$_invoke$arity$1(node);
|
|
23
|
+
var ratio = new cljs.core.Keyword(null,"ratio","ratio",-926560044).cljs$core$IFn$_invoke$arity$1(node);
|
|
24
|
+
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.iris-entity-tile-group","div.iris-entity-tile-group",-1995407678),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"class","class",-2030961996),cljs.core.name(direction)], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"style","style",-496642736),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"flex","flex",-1425124628),ratio], null)], null),new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [iris_layout.components.entity_tile_group.entity_tile_group,child1,on_split,on_close,on_ratio_change,active_entity,entities,render_entity_tile], null)], null),new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [iris_layout.components.resizer.resizer,direction,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node),on_ratio_change], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"style","style",-496642736),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"flex","flex",-1425124628),((1) - ratio)], null)], null),new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [iris_layout.components.entity_tile_group.entity_tile_group,child2,on_split,on_close,on_ratio_change,active_entity,entities,render_entity_tile], null)], null)], null);
|
|
25
|
+
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),"Unknown node type"], null);
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=iris_layout.components.entity_tile_group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["iris_layout/components/entity_tile_group.cljs"],"mappings":";;;;;;AAMA;;;6DAAA,7DAAMA,kIAEHC,KAAKC,SAASC,SAASC,gBAAgBC,cAAcC,SAASC;AAFjE,AAGE,IAAAC,UAAM,AAACE,6BAAiBT;IAAxBO,cAAA,EAAA,CAAAA,mBAAAC,oBAAA,AAAAD,YAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,qWAAA,3QAEGG,yDACAV,KAAKC,SAASC,SACd,AAACS,6CAAE,AAAA,6FAAYX,MAAMI,eACrBC,SAASC;;;KALZ;AAQE,IAAAM,YAAsB,AAAA,2FAAWZ;aAAjC,AAAAa,4CAAAD,UAAA,IAAA,nEAAOE;aAAP,AAAAD,4CAAAD,UAAA,IAAA,nEAAcG;IACRC,YAAU,AAAA,6FAAYhB;IACtBiB,QAAM,AAAA,qFAAQjB;AAFpB,AAAA,0FAAA,kGAAA,2CAAA,0FAAA,mFAAA,mDAAA,2CAAA,uDAAA,2CAAA,4EAAA,iPAAA,kPAAA,mFAAA,mDAAA,2CAAA,uDAAA,2CAAA,oFAAA,3sCAIW,AAACkB,eAAKF,4VACOC,yGACnBlB,2DAAkBe,OAAOb,SAASC,SAASC,gBAAgBC,cAAcC,SAASC,sHACnFa,uCAAgBH,UAAU,AAAA,gFAAKhB,MAAMG,iWACjB,CAAA,MAAKc,0GACxBlB,2DAAkBgB,OAAOd,SAASC,SAASC,gBAAgBC,cAAcC,SAASC;;;;AAjBzF,0FAAA,mDAAA","names":["iris-layout.components.entity-tile-group/entity-tile-group","node","on-split","on-close","on-ratio-change","active-entity","entities","render-entity-tile","G__6920","cljs.core/Keyword","iris-layout.layout/node-type","iris-layout.components.entity-tile/entity-tile-component","cljs.core._EQ_","vec__6921","cljs.core.nth","child1","child2","direction","ratio","cljs.core/name","iris-layout.components.resizer/resizer"],"sourcesContent":["(ns iris-layout.components.entity-tile-group\n \"Entity tile group \u2014 recursive layout tree renderer for the Body.\"\n (:require [iris-layout.layout :as layout]\n [iris-layout.components.entity-tile :as entity-tile]\n [iris-layout.components.resizer :as resizer]))\n\n(defn entity-tile-group\n \"Recursively render a layout tree node.\"\n [node on-split on-close on-ratio-change active-entity entities render-entity-tile]\n (case (layout/node-type node)\n :tile\n [entity-tile/entity-tile-component\n node on-split on-close\n (= (:entity-id node) active-entity)\n entities render-entity-tile nil]\n\n :split\n (let [[child1 child2] (:children node)\n direction (:direction node)\n ratio (:ratio node)]\n [:div.iris-entity-tile-group\n {:class (name direction)}\n [:div {:style {:flex ratio}}\n [entity-tile-group child1 on-split on-close on-ratio-change active-entity entities render-entity-tile]]\n [resizer/resizer direction (:id node) on-ratio-change]\n [:div {:style {:flex (- 1 ratio)}}\n [entity-tile-group child2 on-split on-close on-ratio-change active-entity entities render-entity-tile]]])\n\n [:div \"Unknown node type\"]))\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
import "./cljs.core.js";
|
|
3
|
+
import "./reagent.core.js";
|
|
4
|
+
goog.provide('iris_layout.components.resizer');
|
|
5
|
+
/**
|
|
6
|
+
* Draggable split divider component — supports mouse and touch.
|
|
7
|
+
*/
|
|
8
|
+
iris_layout.components.resizer.resizer = (function iris_layout$components$resizer$resizer(direction,split_id,on_ratio_change){
|
|
9
|
+
var dragging = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(false);
|
|
10
|
+
var callback_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_ratio_change);
|
|
11
|
+
return (function (direction__$1,split_id__$1,on_ratio_change__$1){
|
|
12
|
+
cljs.core.reset_BANG_(callback_ref,on_ratio_change__$1);
|
|
13
|
+
|
|
14
|
+
var start_resize = (function (target,get_pos){
|
|
15
|
+
cljs.core.reset_BANG_(dragging,true);
|
|
16
|
+
|
|
17
|
+
document.body.classList.add("iris-resizing");
|
|
18
|
+
|
|
19
|
+
var parent = target.parentElement;
|
|
20
|
+
parent.classList.add("iris-dragging");
|
|
21
|
+
|
|
22
|
+
var calc_ratio = (function iris_layout$components$resizer$resizer_$_calc_ratio(x,y){
|
|
23
|
+
var rect = parent.getBoundingClientRect();
|
|
24
|
+
var relative_pos = ((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(direction__$1,new cljs.core.Keyword(null,"horizontal","horizontal",2062109475)))?(x - rect.left):(y - rect.top));
|
|
25
|
+
var size = ((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(direction__$1,new cljs.core.Keyword(null,"horizontal","horizontal",2062109475)))?rect.width:rect.height);
|
|
26
|
+
return (relative_pos / size);
|
|
27
|
+
});
|
|
28
|
+
var handle_mouse_move = (function iris_layout$components$resizer$resizer_$_handle_mouse_move(e){
|
|
29
|
+
var G__12609 = split_id__$1;
|
|
30
|
+
var G__12610 = calc_ratio(e.clientX,e.clientY);
|
|
31
|
+
var fexpr__12608 = cljs.core.deref(callback_ref);
|
|
32
|
+
return (fexpr__12608.cljs$core$IFn$_invoke$arity$2 ? fexpr__12608.cljs$core$IFn$_invoke$arity$2(G__12609,G__12610) : fexpr__12608.call(null,G__12609,G__12610));
|
|
33
|
+
});
|
|
34
|
+
var handle_mouse_up = (function iris_layout$components$resizer$resizer_$_handle_mouse_up(_e){
|
|
35
|
+
cljs.core.reset_BANG_(dragging,false);
|
|
36
|
+
|
|
37
|
+
document.body.classList.remove("iris-resizing");
|
|
38
|
+
|
|
39
|
+
parent.classList.remove("iris-dragging");
|
|
40
|
+
|
|
41
|
+
document.removeEventListener("mousemove",handle_mouse_move);
|
|
42
|
+
|
|
43
|
+
return document.removeEventListener("mouseup",iris_layout$components$resizer$resizer_$_handle_mouse_up);
|
|
44
|
+
});
|
|
45
|
+
var handle_touch_move = (function iris_layout$components$resizer$resizer_$_handle_touch_move(e){
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
|
|
48
|
+
var touch = (e.changedTouches[(0)]);
|
|
49
|
+
var G__12616 = split_id__$1;
|
|
50
|
+
var G__12617 = calc_ratio(touch.clientX,touch.clientY);
|
|
51
|
+
var fexpr__12615 = cljs.core.deref(callback_ref);
|
|
52
|
+
return (fexpr__12615.cljs$core$IFn$_invoke$arity$2 ? fexpr__12615.cljs$core$IFn$_invoke$arity$2(G__12616,G__12617) : fexpr__12615.call(null,G__12616,G__12617));
|
|
53
|
+
});
|
|
54
|
+
var handle_touch_end = (function iris_layout$components$resizer$resizer_$_handle_touch_end(_e){
|
|
55
|
+
cljs.core.reset_BANG_(dragging,false);
|
|
56
|
+
|
|
57
|
+
document.body.classList.remove("iris-resizing");
|
|
58
|
+
|
|
59
|
+
parent.classList.remove("iris-dragging");
|
|
60
|
+
|
|
61
|
+
document.removeEventListener("touchmove",handle_touch_move);
|
|
62
|
+
|
|
63
|
+
return document.removeEventListener("touchend",iris_layout$components$resizer$resizer_$_handle_touch_end);
|
|
64
|
+
});
|
|
65
|
+
if(cljs.core.truth_(get_pos)){
|
|
66
|
+
document.addEventListener("touchmove",handle_touch_move,({"passive": false}));
|
|
67
|
+
|
|
68
|
+
return document.addEventListener("touchend",handle_touch_end);
|
|
69
|
+
} else {
|
|
70
|
+
document.addEventListener("mousemove",handle_mouse_move);
|
|
71
|
+
|
|
72
|
+
return document.addEventListener("mouseup",handle_mouse_up);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"class","class",-2030961996),["iris-resizer ",cljs.core.name(direction__$1),(cljs.core.truth_(cljs.core.deref(dragging))?" dragging":null)].join(''),new cljs.core.Keyword(null,"on-mouse-down","on-mouse-down",1147755470),(function (e){
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
|
|
80
|
+
return start_resize(e.currentTarget,null);
|
|
81
|
+
}),new cljs.core.Keyword(null,"on-touch-start","on-touch-start",447239419),(function (e){
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
|
|
86
|
+
return start_resize(e.currentTarget,new cljs.core.Keyword(null,"touch","touch",1496272469));
|
|
87
|
+
})], null)], null);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=iris_layout.components.resizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["iris_layout/components/resizer.cljs"],"mappings":";;;;AAGA;;;yCAAA,zCAAMA,0FAEHC,UAAUC,SAASC;AAFtB,AAGE,IAAMC,WAAS,gDAAA,hDAACC;IACVC,eAAa,AAACC,6CAAKJ;AADzB,AAEE,kBAAKF,cAAUC,aAASC;AAAxB,AACE,AAACK,sBAAOF,aAAaH;;AACrB,IAAMM,eACA,WAAKC,OAAOC;AAAZ,AACE,+BAAA,/BAACH,sBAAOJ;;AACR,4BAAA,5BAAM,AAAaQ;;AACnB,IAAMC,SAAO,AAAiBH;AAA9B,AAEE,qBAAA,rBAAM,AAAaG;;AACnB,iBAAA,8DAAqBC,EAAEC;AAAvB,AACU,IAAMC,OAAK,AAAwBH;IAC7BI,eAAa,EAAI,2DAAA,3DAACC,6CAAEjB,iFACL,CAAGa,IAAE,AAAQE,WACb,CAAGD,IAAE,AAAOC;IAC3BG,OAAK,EAAI,2DAAA,3DAACD,6CAAEjB,iFACL,AAASe,WACT,AAAUA;AANvB,AAOE,QAAGC,eAAaE;;wBAR5B,qEAU4BC;AAV5B,AAWU,IAAAC,WAAenB;IAAfoB,WAAwB,AAACG,WAAW,AAAWL,UAAG,AAAWA;IAA7DG,eAAA,AAAAC,gBAAElB;AAAF,AAAA,QAAAiB,6CAAAA,2CAAAF,SAAAC,YAAAC,uBAAAF,SAAAC;;sBAXV,mEAa0BI;AAb1B,AAcU,+BAAA,/BAAClB,sBAAOJ;;AACR,+BAAA,/BAAS,AAAaQ;;AACtB,wBAAA,xBAAS,AAAaC;;AACtB,6BAAA,7BAAsBc,yCAAwBC;;AAC9C,oCAAA,7BAAsBD,uCAAsBE;;wBAlBtD,qEAoB4BT;AApB5B,AAqBU,AAAiBA;;AACjB,IAAMU,QAAM,kBAAA,jBAAM,AAAkBV;AAApC,AACE,IAAAW,WAAe7B;IAAf8B,WAAwB,AAACP,WAAW,AAAWK,cAAO,AAAWA;IAAjEG,eAAA,AAAAT,gBAAElB;AAAF,AAAA,QAAA2B,6CAAAA,2CAAAF,SAAAC,YAAAC,uBAAAF,SAAAC;;uBAvBZ,oEAyB2BN;AAzB3B,AA0BU,+BAAA,/BAAClB,sBAAOJ;;AACR,+BAAA,/BAAS,AAAaQ;;AACtB,wBAAA,xBAAS,AAAaC;;AACtB,6BAAA,7BAAsBc,yCAAwBO;;AAC9C,oCAAA,7BAAsBP,wCAAuBQ;;AA9BvD,AAiCE,oBAAIxB;AACF,AAAI,0BAAA,8BAAA,aAAA,rEAAmBgB,sCAAwBO;;AAC3C,iCAAA,1BAAmBP,qCAAuBQ;;AAC9C,AAAI,0BAAA,1BAAmBR,sCAAwBC;;AAC3C,iCAAA,1BAAmBD,oCAAsBE;;;AA5C3D,AAAA,0FAAA,mDAAA,2CAAA,gLAAA,xHA+CW,CAAA,gBACK,AAACO,eAAKnC,eACN,kBAAA,AAAAuB,2BAAA,AAAA,YAAA,vBAAOpB,8GAEnB,WAAKgB;AAAL,AACE,AAAiBA;;AACjB,AAAkBA;;AAClB,oCAAA,7BAACX,aAAa,AAAiBW;GAtDrC,wEAwDI,WAAKA;AAAL,AACE,AAAiBA;;AACjB,AAAkBA;;AAClB,oCAAA,7BAACX,aAAa,AAAiBW","names":["iris-layout.components.resizer/resizer","direction","split-id","on-ratio-change","dragging","reagent.core.atom","callback-ref","cljs.core.atom","cljs.core/reset!","start-resize","target","get-pos","js/document.body","parent","x","y","rect","relative-pos","cljs.core._EQ_","size","e","G__12609","G__12610","fexpr__12608","cljs.core/deref","calc-ratio","_e","js/document","handle-mouse-move","handle-mouse-up","touch","G__12616","G__12617","fexpr__12615","handle-touch-move","handle-touch-end","cljs.core/name"],"sourcesContent":["(ns iris-layout.components.resizer\n (:require [reagent.core :as r]))\n\n(defn resizer\n \"Draggable split divider component \u2014 supports mouse and touch.\"\n [direction split-id on-ratio-change]\n (let [dragging (r/atom false)\n callback-ref (atom on-ratio-change)]\n (fn [direction split-id on-ratio-change]\n (reset! callback-ref on-ratio-change)\n (let [start-resize\n (fn [target get-pos]\n (reset! dragging true)\n (.add (.-classList js/document.body) \"iris-resizing\")\n (let [parent (.-parentElement target)]\n ;; Add iris-dragging class to parent to disable flex transitions\n (.add (.-classList parent) \"iris-dragging\")\n (letfn [(calc-ratio [x y]\n (let [rect (.getBoundingClientRect parent)\n relative-pos (if (= direction :horizontal)\n (- x (.-left rect))\n (- y (.-top rect)))\n size (if (= direction :horizontal)\n (.-width rect)\n (.-height rect))]\n (/ relative-pos size)))\n\n (handle-mouse-move [e]\n (@callback-ref split-id (calc-ratio (.-clientX e) (.-clientY e))))\n\n (handle-mouse-up [_e]\n (reset! dragging false)\n (.remove (.-classList js/document.body) \"iris-resizing\")\n (.remove (.-classList parent) \"iris-dragging\")\n (.removeEventListener js/document \"mousemove\" handle-mouse-move)\n (.removeEventListener js/document \"mouseup\" handle-mouse-up))\n\n (handle-touch-move [e]\n (.preventDefault e)\n (let [touch (aget (.-changedTouches e) 0)]\n (@callback-ref split-id (calc-ratio (.-clientX touch) (.-clientY touch)))))\n\n (handle-touch-end [_e]\n (reset! dragging false)\n (.remove (.-classList js/document.body) \"iris-resizing\")\n (.remove (.-classList parent) \"iris-dragging\")\n (.removeEventListener js/document \"touchmove\" handle-touch-move)\n (.removeEventListener js/document \"touchend\" handle-touch-end))]\n\n ;; Detect if touch or mouse based on caller\n (if get-pos\n (do (.addEventListener js/document \"touchmove\" handle-touch-move #js {:passive false})\n (.addEventListener js/document \"touchend\" handle-touch-end))\n (do (.addEventListener js/document \"mousemove\" handle-mouse-move)\n (.addEventListener js/document \"mouseup\" handle-mouse-up))))))]\n\n [:div\n {:class (str \"iris-resizer \"\n (name direction)\n (when @dragging \" dragging\"))\n :on-mouse-down\n (fn [e]\n (.preventDefault e)\n (.stopPropagation e)\n (start-resize (.-currentTarget e) nil))\n :on-touch-start\n (fn [e]\n (.preventDefault e)\n (.stopPropagation e)\n (start-resize (.-currentTarget e) :touch))}]))))\n"]}
|