@p4ulcristian/iris-layout 0.2.5 → 0.2.7
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/iris_layout.components.entity_tile.js +121 -89
- package/dist/cljs-runtime/iris_layout.components.entity_tile.js.map +1 -1
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js +9 -9
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js.map +1 -1
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js +134 -148
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js.map +1 -1
- package/dist/cljs-runtime/iris_layout.core.js +310 -806
- package/dist/cljs-runtime/iris_layout.core.js.map +1 -1
- package/dist/iris-layout.js +62 -55
- package/dist/styles.css +63 -1
- package/package.json +1 -1
|
@@ -81,61 +81,61 @@ e.preventDefault();
|
|
|
81
81
|
|
|
82
82
|
e.stopPropagation();
|
|
83
83
|
|
|
84
|
-
var
|
|
85
|
-
if(cljs.core.truth_(
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
try{var
|
|
91
|
-
if(cljs.core.truth_((function (){var and__5000__auto__ = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(
|
|
84
|
+
var temp__5804__auto___6965 = cljs.core.deref(tile_ref);
|
|
85
|
+
if(cljs.core.truth_(temp__5804__auto___6965)){
|
|
86
|
+
var el_6966 = temp__5804__auto___6965;
|
|
87
|
+
var half_6967 = iris_layout.components.entity_tile.calculate_half(e,el_6966);
|
|
88
|
+
var direction_6968 = iris_layout.components.entity_tile.half__GT_direction(half_6967);
|
|
89
|
+
var raw_6969 = e.dataTransfer.getData("text/plain");
|
|
90
|
+
try{var data_6970 = JSON.parse(raw_6969);
|
|
91
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(data_6970.source,"tile");
|
|
92
92
|
if(and__5000__auto__){
|
|
93
|
-
return
|
|
93
|
+
return data_6970.entityId;
|
|
94
94
|
} else {
|
|
95
95
|
return and__5000__auto__;
|
|
96
96
|
}
|
|
97
97
|
})())){
|
|
98
|
-
if(cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
(
|
|
98
|
+
if(cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(data_6970.tileId,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node))){
|
|
99
|
+
var G__6926_6971 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
100
|
+
var G__6927_6972 = data_6970.entityId;
|
|
101
|
+
var G__6928_6973 = direction_6968;
|
|
102
|
+
var G__6929_6974 = new cljs.core.Keyword(null,"tile","tile",758132866);
|
|
103
|
+
var G__6930_6975 = half_6967;
|
|
104
|
+
var fexpr__6925_6976 = cljs.core.deref(split_ref);
|
|
105
|
+
(fexpr__6925_6976.cljs$core$IFn$_invoke$arity$5 ? fexpr__6925_6976.cljs$core$IFn$_invoke$arity$5(G__6926_6971,G__6927_6972,G__6928_6973,G__6929_6974,G__6930_6975) : fexpr__6925_6976.call(null,G__6926_6971,G__6927_6972,G__6928_6973,G__6929_6974,G__6930_6975));
|
|
106
106
|
} else {
|
|
107
107
|
}
|
|
108
108
|
} else {
|
|
109
|
-
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(
|
|
110
|
-
var
|
|
111
|
-
if(cljs.core.truth_(
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
(
|
|
109
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(data_6970.source,"sidebar")){
|
|
110
|
+
var temp__5804__auto___6977__$1 = data_6970.entityId;
|
|
111
|
+
if(cljs.core.truth_(temp__5804__auto___6977__$1)){
|
|
112
|
+
var eid_6978 = temp__5804__auto___6977__$1;
|
|
113
|
+
var G__6940_6979 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
114
|
+
var G__6941_6980 = eid_6978;
|
|
115
|
+
var G__6942_6981 = direction_6968;
|
|
116
|
+
var G__6943_6982 = new cljs.core.Keyword(null,"sidebar","sidebar",35784458);
|
|
117
|
+
var G__6944_6983 = half_6967;
|
|
118
|
+
var fexpr__6939_6984 = cljs.core.deref(split_ref);
|
|
119
|
+
(fexpr__6939_6984.cljs$core$IFn$_invoke$arity$5 ? fexpr__6939_6984.cljs$core$IFn$_invoke$arity$5(G__6940_6979,G__6941_6980,G__6942_6981,G__6943_6982,G__6944_6983) : fexpr__6939_6984.call(null,G__6940_6979,G__6941_6980,G__6942_6981,G__6943_6982,G__6944_6983));
|
|
120
120
|
} else {
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
}catch (
|
|
126
|
-
if(cljs.core.truth_((function (){var and__5000__auto__ =
|
|
125
|
+
}catch (e6907){var __6985 = e6907;
|
|
126
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = raw_6969;
|
|
127
127
|
if(cljs.core.truth_(and__5000__auto__)){
|
|
128
|
-
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(
|
|
128
|
+
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(raw_6969,"");
|
|
129
129
|
} else {
|
|
130
130
|
return and__5000__auto__;
|
|
131
131
|
}
|
|
132
132
|
})())){
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
var
|
|
137
|
-
var
|
|
138
|
-
(
|
|
133
|
+
var G__6913_6986 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
134
|
+
var G__6914_6987 = raw_6969;
|
|
135
|
+
var G__6915_6988 = direction_6968;
|
|
136
|
+
var G__6916_6989 = new cljs.core.Keyword(null,"sidebar","sidebar",35784458);
|
|
137
|
+
var fexpr__6912_6990 = cljs.core.deref(split_ref);
|
|
138
|
+
(fexpr__6912_6990.cljs$core$IFn$_invoke$arity$4 ? fexpr__6912_6990.cljs$core$IFn$_invoke$arity$4(G__6913_6986,G__6914_6987,G__6915_6988,G__6916_6989) : fexpr__6912_6990.call(null,G__6913_6986,G__6914_6987,G__6915_6988,G__6916_6989));
|
|
139
139
|
} else {
|
|
140
140
|
}
|
|
141
141
|
}} else {
|
|
@@ -143,35 +143,11 @@ var fexpr__6895_6950 = cljs.core.deref(split_ref);
|
|
|
143
143
|
|
|
144
144
|
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
145
145
|
});
|
|
146
|
-
iris_layout.components.entity_tile.handle_touch_end = (function iris_layout$components$entity_tile$handle_touch_end(dragging
|
|
147
|
-
iris_layout.components.touch_drag.
|
|
146
|
+
iris_layout.components.entity_tile.handle_touch_end = (function iris_layout$components$entity_tile$handle_touch_end(dragging){
|
|
147
|
+
iris_layout.components.touch_drag.cancel_touch_BANG_();
|
|
148
148
|
|
|
149
149
|
if(iris_layout.components.touch_drag.dragging_QMARK_()){
|
|
150
|
-
|
|
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
|
-
}
|
|
150
|
+
iris_layout.components.touch_drag.end_drag_BANG_();
|
|
175
151
|
} else {
|
|
176
152
|
}
|
|
177
153
|
|
|
@@ -195,14 +171,16 @@ cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_tile,null);
|
|
|
195
171
|
|
|
196
172
|
return cljs.core.reset_BANG_(iris_layout.components.entity_tile.drag_source_entity,null);
|
|
197
173
|
});
|
|
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){
|
|
174
|
+
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,on_active_entity_change){
|
|
199
175
|
var drag_over = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(false);
|
|
200
176
|
var closest_edge = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
201
177
|
var dragging = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(false);
|
|
202
178
|
var split_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_split);
|
|
203
179
|
var close_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_close);
|
|
180
|
+
var active_entity_change_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(on_active_entity_change);
|
|
204
181
|
var tile_ref = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
|
|
205
182
|
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('');
|
|
183
|
+
var drop_watch_key = ["tile-drop-",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
184
|
var _ = cljs.core.add_watch(iris_layout.components.touch_drag.hover_target,touch_watch_key,(function (_,___$1,___$2,new_target){
|
|
207
185
|
if(cljs.core.truth_((function (){var and__5000__auto__ = new_target;
|
|
208
186
|
if(cljs.core.truth_(and__5000__auto__)){
|
|
@@ -227,13 +205,49 @@ return null;
|
|
|
227
205
|
}
|
|
228
206
|
}
|
|
229
207
|
}));
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
208
|
+
var ___$1 = cljs.core.add_watch(iris_layout.components.touch_drag.drop_result,drop_watch_key,(function (___$1,___$2,___$3,drop_info){
|
|
209
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = drop_info;
|
|
210
|
+
if(cljs.core.truth_(and__5000__auto__)){
|
|
211
|
+
return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"target-tile-id","target-tile-id",-1830903484).cljs$core$IFn$_invoke$arity$1(drop_info),new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node));
|
|
212
|
+
} else {
|
|
213
|
+
return and__5000__auto__;
|
|
214
|
+
}
|
|
215
|
+
})())){
|
|
216
|
+
var map__6953_6995 = drop_info;
|
|
217
|
+
var map__6953_6996__$1 = cljs.core.__destructure_map(map__6953_6995);
|
|
218
|
+
var source_tile_id_6997 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6953_6996__$1,new cljs.core.Keyword(null,"source-tile-id","source-tile-id",1477902631));
|
|
219
|
+
var source_entity_id_6998 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6953_6996__$1,new cljs.core.Keyword(null,"source-entity-id","source-entity-id",-509281427));
|
|
220
|
+
var half_6999 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__6953_6996__$1,new cljs.core.Keyword(null,"half","half",741990005));
|
|
221
|
+
var direction_7000 = iris_layout.components.entity_tile.half__GT_direction(half_6999);
|
|
222
|
+
if(cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(source_tile_id_6997,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node))){
|
|
223
|
+
var G__6955_7001 = new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node);
|
|
224
|
+
var G__6956_7002 = source_entity_id_6998;
|
|
225
|
+
var G__6957_7003 = direction_7000;
|
|
226
|
+
var G__6958_7004 = new cljs.core.Keyword(null,"tile","tile",758132866);
|
|
227
|
+
var G__6959_7005 = half_6999;
|
|
228
|
+
var fexpr__6954_7006 = cljs.core.deref(split_ref);
|
|
229
|
+
(fexpr__6954_7006.cljs$core$IFn$_invoke$arity$5 ? fexpr__6954_7006.cljs$core$IFn$_invoke$arity$5(G__6955_7001,G__6956_7002,G__6957_7003,G__6958_7004,G__6959_7005) : fexpr__6954_7006.call(null,G__6955_7001,G__6956_7002,G__6957_7003,G__6958_7004,G__6959_7005));
|
|
230
|
+
} else {
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
cljs.core.reset_BANG_(iris_layout.components.touch_drag.drop_result,null);
|
|
234
|
+
|
|
235
|
+
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
236
|
+
} else {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
240
|
+
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 (___$2){
|
|
241
|
+
cljs.core.remove_watch(iris_layout.components.touch_drag.hover_target,touch_watch_key);
|
|
242
|
+
|
|
243
|
+
return cljs.core.remove_watch(iris_layout.components.touch_drag.drop_result,drop_watch_key);
|
|
244
|
+
}),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,on_active_entity_change__$1){
|
|
233
245
|
cljs.core.reset_BANG_(split_ref,on_split__$1);
|
|
234
246
|
|
|
235
247
|
cljs.core.reset_BANG_(close_ref,on_close__$1);
|
|
236
248
|
|
|
249
|
+
cljs.core.reset_BANG_(active_entity_change_ref,on_active_entity_change__$1);
|
|
250
|
+
|
|
237
251
|
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
252
|
var entity_name = (function (){var or__5002__auto__ = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(entity);
|
|
239
253
|
if(cljs.core.truth_(or__5002__auto__)){
|
|
@@ -242,43 +256,61 @@ return or__5002__auto__;
|
|
|
242
256
|
return new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1);
|
|
243
257
|
}
|
|
244
258
|
})();
|
|
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)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return
|
|
249
|
-
}
|
|
259
|
+
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,"on-mouse-enter","on-mouse-enter",-1664921661),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)],[(function (___$2){
|
|
260
|
+
if(cljs.core.truth_((function (){var and__5000__auto__ = cljs.core.not(focused_QMARK___$1);
|
|
261
|
+
if(and__5000__auto__){
|
|
262
|
+
return cljs.core.deref(active_entity_change_ref);
|
|
263
|
+
} else {
|
|
264
|
+
return and__5000__auto__;
|
|
265
|
+
}
|
|
266
|
+
})())){
|
|
267
|
+
var G__6961 = new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1);
|
|
268
|
+
var fexpr__6960 = cljs.core.deref(active_entity_change_ref);
|
|
269
|
+
return (fexpr__6960.cljs$core$IFn$_invoke$arity$1 ? fexpr__6960.cljs$core$IFn$_invoke$arity$1(G__6961) : fexpr__6960.call(null,G__6961));
|
|
270
|
+
} else {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}),new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(node__$1),(function (p1__6949_SHARP_){
|
|
274
|
+
return cljs.core.reset_BANG_(tile_ref,p1__6949_SHARP_);
|
|
275
|
+
}),(function (p1__6951_SHARP_){
|
|
276
|
+
return iris_layout.components.entity_tile.handle_drop(p1__6951_SHARP_,node__$1,tile_ref,split_ref,drag_over,closest_edge);
|
|
277
|
+
}),(function (){var G__6962 = new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"flex","flex",-1425124628),(1)], null);
|
|
278
|
+
if(cljs.core.truth_(new cljs.core.Keyword(null,"color","color",1011675173).cljs$core$IFn$_invoke$arity$1(entity))){
|
|
279
|
+
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__6962,"--iris-tile-color",new cljs.core.Keyword(null,"color","color",1011675173).cljs$core$IFn$_invoke$arity$1(entity));
|
|
280
|
+
} else {
|
|
281
|
+
return G__6962;
|
|
282
|
+
}
|
|
283
|
+
})(),(function (e){
|
|
250
284
|
if(cljs.core.truth_(e.currentTarget.contains(e.relatedTarget))){
|
|
251
285
|
return null;
|
|
252
286
|
} else {
|
|
253
287
|
return iris_layout.components.entity_tile.clear_drop_state_BANG_(drag_over,closest_edge);
|
|
254
288
|
}
|
|
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)
|
|
289
|
+
}),["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)].join(''),(function (e){
|
|
256
290
|
return e.preventDefault();
|
|
257
|
-
}),(function (
|
|
258
|
-
return iris_layout.components.entity_tile.handle_drag_over(
|
|
259
|
-
}),(function (
|
|
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){
|
|
291
|
+
}),(function (p1__6950_SHARP_){
|
|
292
|
+
return iris_layout.components.entity_tile.handle_drag_over(p1__6950_SHARP_,dragging,drag_over,closest_edge,tile_ref);
|
|
293
|
+
})]),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, 6, [new cljs.core.Keyword(null,"draggable","draggable",1676206163),true,new cljs.core.Keyword(null,"on-double-click","on-double-click",1434856980),(function (___$2){
|
|
266
294
|
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
295
|
return cljs.core.reset_BANG_(iris_layout.components.entity_tile.fullscreen_tile,null);
|
|
268
296
|
} else {
|
|
269
297
|
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
298
|
}
|
|
271
|
-
}),new cljs.core.Keyword(null,"on-drag-start","on-drag-start",-47712205),(function (
|
|
272
|
-
return iris_layout.components.entity_tile.handle_drag_start(
|
|
273
|
-
}),new cljs.core.Keyword(null,"on-drag-end","on-drag-end",520272671),(function (___$
|
|
299
|
+
}),new cljs.core.Keyword(null,"on-drag-start","on-drag-start",-47712205),(function (p1__6952_SHARP_){
|
|
300
|
+
return iris_layout.components.entity_tile.handle_drag_start(p1__6952_SHARP_,node__$1,dragging);
|
|
301
|
+
}),new cljs.core.Keyword(null,"on-drag-end","on-drag-end",520272671),(function (___$2){
|
|
274
302
|
return iris_layout.components.entity_tile.handle_drag_end(dragging);
|
|
303
|
+
}),new cljs.core.Keyword(null,"on-touch-start","on-touch-start",447239419),(function (e){
|
|
304
|
+
return iris_layout.components.touch_drag.start_touch_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);
|
|
305
|
+
}),new cljs.core.Keyword(null,"on-touch-end","on-touch-end",1515667389),(function (_e){
|
|
306
|
+
return iris_layout.components.entity_tile.handle_touch_end(dragging);
|
|
275
307
|
})], 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
308
|
e.stopPropagation();
|
|
277
309
|
|
|
278
310
|
if(cljs.core.truth_(cljs.core.deref(close_ref))){
|
|
279
|
-
var
|
|
280
|
-
var
|
|
281
|
-
return (
|
|
311
|
+
var G__6964 = new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(node__$1);
|
|
312
|
+
var fexpr__6963 = cljs.core.deref(close_ref);
|
|
313
|
+
return (fexpr__6963.cljs$core$IFn$_invoke$arity$1 ? fexpr__6963.cljs$core$IFn$_invoke$arity$1(G__6964) : fexpr__6963.call(null,G__6964));
|
|
282
314
|
} else {
|
|
283
315
|
return null;
|
|
284
316
|
}
|
|
@@ -1 +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,S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sBAAOE;;GACrB,WAAKwE;AAAL,AAAS,OAACtC,oDAAiBlC,SAASO;KAtBtD,mFAAA,mGAAA,2CAAA,+DAAA,KAAA,2EA2BsB,WAAKqB;AAAL,AACE,GAAI,6CAAA,AAAA1B,7CAACxB,6DAAGe,oDAAgB,AAAA,gFAAKa;AAC3B,gFAAA,zEAACR,sBAAOL;;AACR,OAACK,sBAAOL,mDAAgB,AAAA,gFAAKa;;GA9BvD,sEAAA,WAAA6D;AAAA,AA+BqB,4DAAAA,rDAACtB,qEAAoBvC,SAAKN;GA/B/C,kEAgCkB,WAAK4B;AAAL,AAAQ,OAACmB,mDAAgB/C;WAhC3C,mFAAA,mIAAA,mFAAA,qHAAA,2CAAA,vQAiCwCqE,oUAExB,WAAKrG;AAAL,AACE,AAAkBA;;AAClB,oBAAA,AAAAkC,gBAAOqD;AAAP,AAAiB,IAAAmB,UAAY,AAAA,6FAAYpE;IAAxBqE,cAAA,AAAAzE,gBAAEqD;AAAF,AAAA,QAAAoB,4CAAAA,0CAAAD,WAAAC,sBAAAD;;AAAjB;;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"]}
|
|
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;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X,8BAAA,AAAAA,zVA6CI,AAAA,mFAAA,qFAAA,tCACM4C,uBAAmB8B,gHAGzBhG,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","e6907","data","js/JSON.parse","and__5000__auto__","cljs.core.not_EQ_","G__6926","G__6927","G__6928","G__6929","G__6930","fexpr__6925","eid","G__6940","G__6941","G__6942","G__6943","G__6944","fexpr__6939","_","G__6913","G__6914","G__6915","G__6916","fexpr__6912","iris-layout.components.entity-tile/handle-touch-end","iris-layout.components.touch-drag/cancel-touch!","iris-layout.components.touch-drag/dragging?","iris-layout.components.touch-drag/end-drag!","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","on-active-entity-change","close-ref","active-entity-change-ref","touch-watch-key","drop-watch-key","cljs.core/add-watch","iris-layout.components.touch-drag/hover-target","new-target","source-id","iris-layout.components.touch-drag/touch-state","iris-layout.components.touch-drag/drop-result","drop-info","map__6953","cljs.core/--destructure-map","source-tile-id","source-entity-id","G__6955","G__6956","G__6957","G__6958","G__6959","fexpr__6954","reagent.core.create_class","cljs.core/remove-watch","p1__6949#","p1__6951#","p1__6950#","p1__6952#","entity","entity-name","or__5002__auto__","cljs.core/not","G__6962","cljs.core.assoc","G__6961","fexpr__6960","iris-layout.components.touch-drag/start-touch!","_e","G__6964","fexpr__6963"],"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]\n (touch-drag/cancel-touch!)\n (when (touch-drag/dragging?)\n (touch-drag/end-drag!))\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 on-active-entity-change]\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 active-entity-change-ref (atom on-active-entity-change)\n tile-ref (atom nil)\n touch-watch-key (str \"tile-\" (:id node))\n drop-watch-key (str \"tile-drop-\" (: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 _ (add-watch touch-drag/drop-result drop-watch-key\n (fn [_ _ _ drop-info]\n (when (and drop-info (= (:target-tile-id drop-info) (:id node)))\n (let [{:keys [source-tile-id source-entity-id half]} drop-info\n direction (half->direction half)]\n (when (not= source-tile-id (:id node))\n (@split-ref (:id node) source-entity-id direction :tile half)))\n (reset! touch-drag/drop-result nil)\n (clear-drop-state! drag-over closest-edge))))]\n (r/create-class\n {:component-will-unmount\n (fn [_]\n (remove-watch touch-drag/hover-target touch-watch-key)\n (remove-watch touch-drag/drop-result drop-watch-key))\n\n :reagent-render\n (fn [node on-split on-close focused? entities render-entity-tile _parent-ctx on-active-entity-change]\n (reset! split-ref on-split)\n (reset! close-ref on-close)\n (reset! active-entity-change-ref on-active-entity-change)\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 :style (cond-> {:flex 1}\n (:color entity) (assoc \"--iris-tile-color\" (:color entity)))\n :on-mouse-enter (fn [_]\n (when (and (not focused?) @active-entity-change-ref)\n (@active-entity-change-ref (:entity-id node))))\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 }\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 :on-touch-start (fn [e]\n (touch-drag/start-touch!\n (:id node) (:entity-id node) e))\n :on-touch-end (fn [_e] (handle-touch-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"]}
|
|
@@ -7,21 +7,21 @@ goog.provide('iris_layout.components.entity_tile_group');
|
|
|
7
7
|
/**
|
|
8
8
|
* Recursively render a layout tree node.
|
|
9
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
|
|
12
|
-
var
|
|
13
|
-
switch (
|
|
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,on_active_entity_change){
|
|
11
|
+
var G__6991 = iris_layout.layout.node_type(node);
|
|
12
|
+
var G__6991__$1 = (((G__6991 instanceof cljs.core.Keyword))?G__6991.fqn:null);
|
|
13
|
+
switch (G__6991__$1) {
|
|
14
14
|
case "tile":
|
|
15
|
-
return new cljs.core.PersistentVector(null,
|
|
15
|
+
return new cljs.core.PersistentVector(null, 9, 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,on_active_entity_change], null);
|
|
16
16
|
|
|
17
17
|
break;
|
|
18
18
|
case "split":
|
|
19
|
-
var
|
|
20
|
-
var child1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(
|
|
21
|
-
var child2 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(
|
|
19
|
+
var vec__6992 = 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__6992,(0),null);
|
|
21
|
+
var child2 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__6992,(1),null);
|
|
22
22
|
var direction = new cljs.core.Keyword(null,"direction","direction",-633359395).cljs$core$IFn$_invoke$arity$1(node);
|
|
23
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,
|
|
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, 9, 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,on_active_entity_change], 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, 9, 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,on_active_entity_change], null)], null)], null);
|
|
25
25
|
|
|
26
26
|
break;
|
|
27
27
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["iris_layout/components/entity_tile_group.cljs"],"mappings":";;;;;;AAMA;;;6DAAA,7DAAMA,kIAEHC,KAAKC,SAASC,SAASC,gBAAgBC,cAAcC,SAASC;
|
|
1
|
+
{"version":3,"sources":["iris_layout/components/entity_tile_group.cljs"],"mappings":";;;;;;AAMA;;;6DAAA,7DAAMA,kIAEHC,KAAKC,SAASC,SAASC,gBAAgBC,cAAcC,SAASC,mBAAmBC;AAFpF,AAGE,IAAAC,UAAM,AAACE,6BAAiBV;IAAxBQ,cAAA,EAAA,CAAAA,mBAAAC,oBAAA,AAAAD,YAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,qWAAA,3QAEGG,yDACAX,KAAKC,SAASC,SACd,AAACU,6CAAE,AAAA,6FAAYZ,MAAMI,eACrBC,SAASC,wBAAuBC;;;KALnC;AAQE,IAAAM,YAAsB,AAAA,2FAAWb;aAAjC,AAAAc,4CAAAD,UAAA,IAAA,nEAAOE;aAAP,AAAAD,4CAAAD,UAAA,IAAA,nEAAcG;IACRC,YAAU,AAAA,6FAAYjB;IACtBkB,QAAM,AAAA,qFAAQlB;AAFpB,AAAA,0FAAA,kGAAA,2CAAA,0FAAA,mFAAA,mDAAA,2CAAA,uDAAA,2CAAA,4EAAA,yQAAA,kPAAA,mFAAA,mDAAA,2CAAA,uDAAA,2CAAA,oFAAA,nuCAIW,AAACmB,eAAKF,4VACOC,yGACnBnB,2DAAkBgB,OAAOd,SAASC,SAASC,gBAAgBC,cAAcC,SAASC,mBAAmBC,2HACtGa,uCAAgBH,UAAU,AAAA,gFAAKjB,MAAMG,iWACjB,CAAA,MAAKe,0GACxBnB,2DAAkBiB,OAAOf,SAASC,SAASC,gBAAgBC,cAAcC,SAASC,mBAAmBC;;;;AAjB5G,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","on-active-entity-change","G__6991","cljs.core/Keyword","iris-layout.layout/node-type","iris-layout.components.entity-tile/entity-tile-component","cljs.core._EQ_","vec__6992","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 on-active-entity-change]\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 on-active-entity-change]\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 on-active-entity-change]]\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 on-active-entity-change]]])\n\n [:div \"Unknown node type\"]))\n"]}
|