@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.
Files changed (201) hide show
  1. package/dist/cljs-runtime/cljs.core.js +38746 -0
  2. package/dist/cljs-runtime/cljs.core.js.map +1 -0
  3. package/dist/cljs-runtime/cljs.pprint.js +8400 -0
  4. package/dist/cljs-runtime/cljs.pprint.js.map +1 -0
  5. package/dist/cljs-runtime/cljs.stacktrace.js +561 -0
  6. package/dist/cljs-runtime/cljs.stacktrace.js.map +1 -0
  7. package/dist/cljs-runtime/cljs_env.js +1286 -0
  8. package/dist/cljs-runtime/clojure.data.js +295 -0
  9. package/dist/cljs-runtime/clojure.data.js.map +1 -0
  10. package/dist/cljs-runtime/clojure.set.js +382 -0
  11. package/dist/cljs-runtime/clojure.set.js.map +1 -0
  12. package/dist/cljs-runtime/clojure.string.js +480 -0
  13. package/dist/cljs-runtime/clojure.string.js.map +1 -0
  14. package/dist/cljs-runtime/clojure.walk.js +132 -0
  15. package/dist/cljs-runtime/clojure.walk.js.map +1 -0
  16. package/dist/cljs-runtime/devtools.async.js +90 -0
  17. package/dist/cljs-runtime/devtools.async.js.map +1 -0
  18. package/dist/cljs-runtime/devtools.context.js +11 -0
  19. package/dist/cljs-runtime/devtools.context.js.map +1 -0
  20. package/dist/cljs-runtime/devtools.core.js +175 -0
  21. package/dist/cljs-runtime/devtools.core.js.map +1 -0
  22. package/dist/cljs-runtime/devtools.defaults.js +20 -0
  23. package/dist/cljs-runtime/devtools.defaults.js.map +1 -0
  24. package/dist/cljs-runtime/devtools.format.js +631 -0
  25. package/dist/cljs-runtime/devtools.format.js.map +1 -0
  26. package/dist/cljs-runtime/devtools.formatters.budgeting.js +182 -0
  27. package/dist/cljs-runtime/devtools.formatters.budgeting.js.map +1 -0
  28. package/dist/cljs-runtime/devtools.formatters.core.js +220 -0
  29. package/dist/cljs-runtime/devtools.formatters.core.js.map +1 -0
  30. package/dist/cljs-runtime/devtools.formatters.helpers.js +228 -0
  31. package/dist/cljs-runtime/devtools.formatters.helpers.js.map +1 -0
  32. package/dist/cljs-runtime/devtools.formatters.js +261 -0
  33. package/dist/cljs-runtime/devtools.formatters.js.map +1 -0
  34. package/dist/cljs-runtime/devtools.formatters.markup.js +1174 -0
  35. package/dist/cljs-runtime/devtools.formatters.markup.js.map +1 -0
  36. package/dist/cljs-runtime/devtools.formatters.printing.js +313 -0
  37. package/dist/cljs-runtime/devtools.formatters.printing.js.map +1 -0
  38. package/dist/cljs-runtime/devtools.formatters.state.js +325 -0
  39. package/dist/cljs-runtime/devtools.formatters.state.js.map +1 -0
  40. package/dist/cljs-runtime/devtools.formatters.templating.js +666 -0
  41. package/dist/cljs-runtime/devtools.formatters.templating.js.map +1 -0
  42. package/dist/cljs-runtime/devtools.hints.js +193 -0
  43. package/dist/cljs-runtime/devtools.hints.js.map +1 -0
  44. package/dist/cljs-runtime/devtools.munging.js +1058 -0
  45. package/dist/cljs-runtime/devtools.munging.js.map +1 -0
  46. package/dist/cljs-runtime/devtools.prefs.js +87 -0
  47. package/dist/cljs-runtime/devtools.prefs.js.map +1 -0
  48. package/dist/cljs-runtime/devtools.preload.js +11 -0
  49. package/dist/cljs-runtime/devtools.preload.js.map +1 -0
  50. package/dist/cljs-runtime/devtools.protocols.js +98 -0
  51. package/dist/cljs-runtime/devtools.protocols.js.map +1 -0
  52. package/dist/cljs-runtime/devtools.reporter.js +81 -0
  53. package/dist/cljs-runtime/devtools.reporter.js.map +1 -0
  54. package/dist/cljs-runtime/devtools.toolbox.js +141 -0
  55. package/dist/cljs-runtime/devtools.toolbox.js.map +1 -0
  56. package/dist/cljs-runtime/devtools.util.js +517 -0
  57. package/dist/cljs-runtime/devtools.util.js.map +1 -0
  58. package/dist/cljs-runtime/devtools.version.js +9 -0
  59. package/dist/cljs-runtime/devtools.version.js.map +1 -0
  60. package/dist/cljs-runtime/goog.array.array.js +659 -0
  61. package/dist/cljs-runtime/goog.array.array.js.map +9 -0
  62. package/dist/cljs-runtime/goog.asserts.asserts.js +133 -0
  63. package/dist/cljs-runtime/goog.asserts.asserts.js.map +9 -0
  64. package/dist/cljs-runtime/goog.asserts.dom.js +90 -0
  65. package/dist/cljs-runtime/goog.asserts.dom.js.map +9 -0
  66. package/dist/cljs-runtime/goog.async.nexttick.js +93 -0
  67. package/dist/cljs-runtime/goog.async.nexttick.js.map +9 -0
  68. package/dist/cljs-runtime/goog.base.js +1261 -0
  69. package/dist/cljs-runtime/goog.base.js.map +9 -0
  70. package/dist/cljs-runtime/goog.collections.maps.js +82 -0
  71. package/dist/cljs-runtime/goog.collections.maps.js.map +9 -0
  72. package/dist/cljs-runtime/goog.debug.entrypointregistry.js +44 -0
  73. package/dist/cljs-runtime/goog.debug.entrypointregistry.js.map +9 -0
  74. package/dist/cljs-runtime/goog.debug.error.js +30 -0
  75. package/dist/cljs-runtime/goog.debug.error.js.map +9 -0
  76. package/dist/cljs-runtime/goog.dom.asserts.js +40 -0
  77. package/dist/cljs-runtime/goog.dom.asserts.js.map +9 -0
  78. package/dist/cljs-runtime/goog.dom.browserfeature.js +21 -0
  79. package/dist/cljs-runtime/goog.dom.browserfeature.js.map +9 -0
  80. package/dist/cljs-runtime/goog.dom.dom.js +1087 -0
  81. package/dist/cljs-runtime/goog.dom.dom.js.map +9 -0
  82. package/dist/cljs-runtime/goog.dom.element.js +69 -0
  83. package/dist/cljs-runtime/goog.dom.element.js.map +9 -0
  84. package/dist/cljs-runtime/goog.dom.htmlelement.js +7 -0
  85. package/dist/cljs-runtime/goog.dom.htmlelement.js.map +9 -0
  86. package/dist/cljs-runtime/goog.dom.nodetype.js +6 -0
  87. package/dist/cljs-runtime/goog.dom.nodetype.js.map +9 -0
  88. package/dist/cljs-runtime/goog.dom.safe.js +277 -0
  89. package/dist/cljs-runtime/goog.dom.safe.js.map +9 -0
  90. package/dist/cljs-runtime/goog.dom.tagname.js +147 -0
  91. package/dist/cljs-runtime/goog.dom.tagname.js.map +9 -0
  92. package/dist/cljs-runtime/goog.dom.tags.js +10 -0
  93. package/dist/cljs-runtime/goog.dom.tags.js.map +9 -0
  94. package/dist/cljs-runtime/goog.flags.flags.js +12 -0
  95. package/dist/cljs-runtime/goog.flags.flags.js.map +9 -0
  96. package/dist/cljs-runtime/goog.fs.blob.js +38 -0
  97. package/dist/cljs-runtime/goog.fs.blob.js.map +9 -0
  98. package/dist/cljs-runtime/goog.fs.url.js +37 -0
  99. package/dist/cljs-runtime/goog.fs.url.js.map +9 -0
  100. package/dist/cljs-runtime/goog.functions.functions.js +211 -0
  101. package/dist/cljs-runtime/goog.functions.functions.js.map +9 -0
  102. package/dist/cljs-runtime/goog.html.safehtml.js +321 -0
  103. package/dist/cljs-runtime/goog.html.safehtml.js.map +9 -0
  104. package/dist/cljs-runtime/goog.html.safescript.js +65 -0
  105. package/dist/cljs-runtime/goog.html.safescript.js.map +9 -0
  106. package/dist/cljs-runtime/goog.html.safestyle.js +175 -0
  107. package/dist/cljs-runtime/goog.html.safestyle.js.map +9 -0
  108. package/dist/cljs-runtime/goog.html.safestylesheet.js +99 -0
  109. package/dist/cljs-runtime/goog.html.safestylesheet.js.map +9 -0
  110. package/dist/cljs-runtime/goog.html.safeurl.js +231 -0
  111. package/dist/cljs-runtime/goog.html.safeurl.js.map +9 -0
  112. package/dist/cljs-runtime/goog.html.trustedresourceurl.js +123 -0
  113. package/dist/cljs-runtime/goog.html.trustedresourceurl.js.map +9 -0
  114. package/dist/cljs-runtime/goog.html.trustedtypes.js +16 -0
  115. package/dist/cljs-runtime/goog.html.trustedtypes.js.map +9 -0
  116. package/dist/cljs-runtime/goog.html.uncheckedconversions.js +52 -0
  117. package/dist/cljs-runtime/goog.html.uncheckedconversions.js.map +9 -0
  118. package/dist/cljs-runtime/goog.labs.useragent.browser.js +352 -0
  119. package/dist/cljs-runtime/goog.labs.useragent.browser.js.map +9 -0
  120. package/dist/cljs-runtime/goog.labs.useragent.engine.js +73 -0
  121. package/dist/cljs-runtime/goog.labs.useragent.engine.js.map +9 -0
  122. package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js +14 -0
  123. package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js.map +9 -0
  124. package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js +74 -0
  125. package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js.map +9 -0
  126. package/dist/cljs-runtime/goog.labs.useragent.platform.js +147 -0
  127. package/dist/cljs-runtime/goog.labs.useragent.platform.js.map +9 -0
  128. package/dist/cljs-runtime/goog.labs.useragent.useragent.js +21 -0
  129. package/dist/cljs-runtime/goog.labs.useragent.useragent.js.map +9 -0
  130. package/dist/cljs-runtime/goog.labs.useragent.util.js +81 -0
  131. package/dist/cljs-runtime/goog.labs.useragent.util.js.map +9 -0
  132. package/dist/cljs-runtime/goog.math.coordinate.js +97 -0
  133. package/dist/cljs-runtime/goog.math.coordinate.js.map +9 -0
  134. package/dist/cljs-runtime/goog.math.integer.js +445 -0
  135. package/dist/cljs-runtime/goog.math.integer.js.map +9 -0
  136. package/dist/cljs-runtime/goog.math.long.js +437 -0
  137. package/dist/cljs-runtime/goog.math.long.js.map +9 -0
  138. package/dist/cljs-runtime/goog.math.math.js +158 -0
  139. package/dist/cljs-runtime/goog.math.math.js.map +9 -0
  140. package/dist/cljs-runtime/goog.math.size.js +76 -0
  141. package/dist/cljs-runtime/goog.math.size.js.map +9 -0
  142. package/dist/cljs-runtime/goog.object.object.js +284 -0
  143. package/dist/cljs-runtime/goog.object.object.js.map +9 -0
  144. package/dist/cljs-runtime/goog.reflect.reflect.js +32 -0
  145. package/dist/cljs-runtime/goog.reflect.reflect.js.map +9 -0
  146. package/dist/cljs-runtime/goog.string.const.js +35 -0
  147. package/dist/cljs-runtime/goog.string.const.js.map +9 -0
  148. package/dist/cljs-runtime/goog.string.internal.js +119 -0
  149. package/dist/cljs-runtime/goog.string.internal.js.map +9 -0
  150. package/dist/cljs-runtime/goog.string.string.js +462 -0
  151. package/dist/cljs-runtime/goog.string.string.js.map +9 -0
  152. package/dist/cljs-runtime/goog.string.stringbuffer.js +32 -0
  153. package/dist/cljs-runtime/goog.string.stringbuffer.js.map +9 -0
  154. package/dist/cljs-runtime/goog.string.typedstring.js +9 -0
  155. package/dist/cljs-runtime/goog.string.typedstring.js.map +9 -0
  156. package/dist/cljs-runtime/goog.structs.structs.js +199 -0
  157. package/dist/cljs-runtime/goog.structs.structs.js.map +9 -0
  158. package/dist/cljs-runtime/goog.uri.uri.js +628 -0
  159. package/dist/cljs-runtime/goog.uri.uri.js.map +9 -0
  160. package/dist/cljs-runtime/goog.uri.utils.js +326 -0
  161. package/dist/cljs-runtime/goog.uri.utils.js.map +9 -0
  162. package/dist/cljs-runtime/goog.useragent.useragent.js +139 -0
  163. package/dist/cljs-runtime/goog.useragent.useragent.js.map +9 -0
  164. package/dist/cljs-runtime/iris_layout.components.entity_card_group.js +202 -0
  165. package/dist/cljs-runtime/iris_layout.components.entity_card_group.js.map +1 -0
  166. package/dist/cljs-runtime/iris_layout.components.entity_tile.js +295 -0
  167. package/dist/cljs-runtime/iris_layout.components.entity_tile.js.map +1 -0
  168. package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js +33 -0
  169. package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js.map +1 -0
  170. package/dist/cljs-runtime/iris_layout.components.resizer.js +91 -0
  171. package/dist/cljs-runtime/iris_layout.components.resizer.js.map +1 -0
  172. package/dist/cljs-runtime/iris_layout.components.touch_drag.js +399 -0
  173. package/dist/cljs-runtime/iris_layout.components.touch_drag.js.map +1 -0
  174. package/dist/cljs-runtime/iris_layout.core.js +1372 -0
  175. package/dist/cljs-runtime/iris_layout.core.js.map +1 -0
  176. package/dist/cljs-runtime/iris_layout.layout.js +328 -0
  177. package/dist/cljs-runtime/iris_layout.layout.js.map +1 -0
  178. package/dist/cljs-runtime/reagent.core.js +993 -0
  179. package/dist/cljs-runtime/reagent.core.js.map +1 -0
  180. package/dist/cljs-runtime/reagent.debug.js +75 -0
  181. package/dist/cljs-runtime/reagent.debug.js.map +1 -0
  182. package/dist/cljs-runtime/reagent.impl.batching.js +270 -0
  183. package/dist/cljs-runtime/reagent.impl.batching.js.map +1 -0
  184. package/dist/cljs-runtime/reagent.impl.component.js +758 -0
  185. package/dist/cljs-runtime/reagent.impl.component.js.map +1 -0
  186. package/dist/cljs-runtime/reagent.impl.input.js +175 -0
  187. package/dist/cljs-runtime/reagent.impl.input.js.map +1 -0
  188. package/dist/cljs-runtime/reagent.impl.protocols.js +99 -0
  189. package/dist/cljs-runtime/reagent.impl.protocols.js.map +1 -0
  190. package/dist/cljs-runtime/reagent.impl.template.js +660 -0
  191. package/dist/cljs-runtime/reagent.impl.template.js.map +1 -0
  192. package/dist/cljs-runtime/reagent.impl.util.js +748 -0
  193. package/dist/cljs-runtime/reagent.impl.util.js.map +1 -0
  194. package/dist/cljs-runtime/reagent.ratom.js +1668 -0
  195. package/dist/cljs-runtime/reagent.ratom.js.map +1 -0
  196. package/dist/cljs-runtime/shadow.esm.esm_import$react.js +5 -0
  197. package/dist/cljs-runtime/shadow.module.iris-layout.append.js +2 -0
  198. package/dist/cljs-runtime/shadow.module.iris-layout.prepend.js +2 -0
  199. package/dist/iris-layout.js +375 -355
  200. package/dist/styles.css +287 -9
  201. package/package.json +1 -1
@@ -0,0 +1,399 @@
1
+ import "./cljs_env.js";
2
+ import "./cljs.core.js";
3
+ import "./reagent.core.js";
4
+ goog.provide('iris_layout.components.touch_drag');
5
+ iris_layout.components.touch_drag.long_press_ms = (400);
6
+ iris_layout.components.touch_drag.move_tolerance = (10);
7
+ if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.touch_drag !== 'undefined') && (typeof iris_layout.components.touch_drag.touch_state !== 'undefined')){
8
+ } else {
9
+ iris_layout.components.touch_drag.touch_state = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
10
+ }
11
+ if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.touch_drag !== 'undefined') && (typeof iris_layout.components.touch_drag.hover_target !== 'undefined')){
12
+ } else {
13
+ iris_layout.components.touch_drag.hover_target = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
14
+ }
15
+ if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.touch_drag !== 'undefined') && (typeof iris_layout.components.touch_drag.nav_edge_target !== 'undefined')){
16
+ } else {
17
+ iris_layout.components.touch_drag.nav_edge_target = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(null);
18
+ }
19
+ if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.touch_drag !== 'undefined') && (typeof iris_layout.components.touch_drag.pending !== 'undefined')){
20
+ } else {
21
+ iris_layout.components.touch_drag.pending = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
22
+ }
23
+ iris_layout.components.touch_drag.dragging_QMARK_ = (function iris_layout$components$touch_drag$dragging_QMARK_(){
24
+ return (!((cljs.core.deref(iris_layout.components.touch_drag.touch_state) == null)));
25
+ });
26
+ iris_layout.components.touch_drag.pending_QMARK_ = (function iris_layout$components$touch_drag$pending_QMARK_(){
27
+ return (!((cljs.core.deref(iris_layout.components.touch_drag.pending) == null)));
28
+ });
29
+ iris_layout.components.touch_drag.create_ghost_BANG_ = (function iris_layout$components$touch_drag$create_ghost_BANG_(x,y){
30
+ var ghost = document.createElement("div");
31
+ (ghost.className = "iris-touch-drag-ghost");
32
+
33
+ (ghost.style.cssText = ["position:fixed;z-index:10000;pointer-events:none;","background:rgba(99,102,241,0.8);color:#fff;padding:6px 14px;","border-radius:8px;font-size:12px;font-weight:500;","box-shadow:0 4px 20px rgba(0,0,0,0.4);","left:",cljs.core.str.cljs$core$IFn$_invoke$arity$1((x - (40))),"px;","top:",cljs.core.str.cljs$core$IFn$_invoke$arity$1((y - (20))),"px;"].join(''));
34
+
35
+ document.body.appendChild(ghost);
36
+
37
+ return ghost;
38
+ });
39
+ /**
40
+ * Begin long-press detection on a header touchstart.
41
+ */
42
+ iris_layout.components.touch_drag.start_pending_BANG_ = (function iris_layout$components$touch_drag$start_pending_BANG_(tile_id,entity_id,touch_event,on_activate){
43
+ var touch = (touch_event.changedTouches[(0)]);
44
+ var x = touch.clientX;
45
+ var y = touch.clientY;
46
+ var timer = setTimeout((function (){
47
+ var ghost = iris_layout.components.touch_drag.create_ghost_BANG_(x,y);
48
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.touch_state,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"tile-id","tile-id",781804456),tile_id,new cljs.core.Keyword(null,"entity-id","entity-id",1485898093),entity_id,new cljs.core.Keyword(null,"ghost-el","ghost-el",-316931125),ghost,new cljs.core.Keyword(null,"active?","active?",459499776),true], null));
49
+
50
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.pending,null);
51
+
52
+ var temp__5804__auto___12630 = window.getSelection();
53
+ if(cljs.core.truth_(temp__5804__auto___12630)){
54
+ var sel_12631 = temp__5804__auto___12630;
55
+ sel_12631.removeAllRanges();
56
+ } else {
57
+ }
58
+
59
+ if(cljs.core.truth_(navigator.vibrate)){
60
+ navigator.vibrate((30));
61
+ } else {
62
+ }
63
+
64
+ if(cljs.core.truth_(on_activate)){
65
+ return (on_activate.cljs$core$IFn$_invoke$arity$0 ? on_activate.cljs$core$IFn$_invoke$arity$0() : on_activate.call(null));
66
+ } else {
67
+ return null;
68
+ }
69
+ }),iris_layout.components.touch_drag.long_press_ms);
70
+ return cljs.core.reset_BANG_(iris_layout.components.touch_drag.pending,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"timer-id","timer-id",1622357927),timer,new cljs.core.Keyword(null,"start-x","start-x",-193941684),x,new cljs.core.Keyword(null,"start-y","start-y",-771244577),y,new cljs.core.Keyword(null,"tile-id","tile-id",781804456),tile_id,new cljs.core.Keyword(null,"entity-id","entity-id",1485898093),entity_id], null));
71
+ });
72
+ /**
73
+ * Cancel a pending long-press.
74
+ */
75
+ iris_layout.components.touch_drag.cancel_pending_BANG_ = (function iris_layout$components$touch_drag$cancel_pending_BANG_(){
76
+ var temp__5804__auto__ = cljs.core.deref(iris_layout.components.touch_drag.pending);
77
+ if(cljs.core.truth_(temp__5804__auto__)){
78
+ var p = temp__5804__auto__;
79
+ clearTimeout(new cljs.core.Keyword(null,"timer-id","timer-id",1622357927).cljs$core$IFn$_invoke$arity$1(p));
80
+
81
+ return cljs.core.reset_BANG_(iris_layout.components.touch_drag.pending,null);
82
+ } else {
83
+ return null;
84
+ }
85
+ });
86
+ /**
87
+ * Cancel long-press if finger moved too far.
88
+ */
89
+ iris_layout.components.touch_drag.check_move_cancel_BANG_ = (function iris_layout$components$touch_drag$check_move_cancel_BANG_(touch_event){
90
+ var temp__5804__auto__ = cljs.core.deref(iris_layout.components.touch_drag.pending);
91
+ if(cljs.core.truth_(temp__5804__auto__)){
92
+ var p = temp__5804__auto__;
93
+ var touch = (touch_event.changedTouches[(0)]);
94
+ var dx = (touch.clientX - new cljs.core.Keyword(null,"start-x","start-x",-193941684).cljs$core$IFn$_invoke$arity$1(p));
95
+ var dy = (touch.clientY - new cljs.core.Keyword(null,"start-y","start-y",-771244577).cljs$core$IFn$_invoke$arity$1(p));
96
+ if((Math.sqrt(((dx * dx) + (dy * dy))) > iris_layout.components.touch_drag.move_tolerance)){
97
+ return iris_layout.components.touch_drag.cancel_pending_BANG_();
98
+ } else {
99
+ return null;
100
+ }
101
+ } else {
102
+ return null;
103
+ }
104
+ });
105
+ /**
106
+ * Find the closest .iris-entity-tile ancestor from the element at point.
107
+ */
108
+ iris_layout.components.touch_drag.find_tile_element = (function iris_layout$components$touch_drag$find_tile_element(x,y){
109
+ var temp__5804__auto__ = document.elementFromPoint(x,y);
110
+ if(cljs.core.truth_(temp__5804__auto__)){
111
+ var el = temp__5804__auto__;
112
+ return el.closest(".iris-entity-tile");
113
+ } else {
114
+ return null;
115
+ }
116
+ });
117
+ /**
118
+ * Determine which half of an element a point is closest to.
119
+ */
120
+ iris_layout.components.touch_drag.calculate_half_xy = (function iris_layout$components$touch_drag$calculate_half_xy(x,y,el){
121
+ var rect = el.getBoundingClientRect();
122
+ var cx = (rect.left + (rect.width / (2)));
123
+ var cy = (rect.top + (rect.height / (2)));
124
+ var dx = (x - cx);
125
+ var dy = (y - cy);
126
+ if((Math.abs(dx) > Math.abs(dy))){
127
+ if((dx < (0))){
128
+ return new cljs.core.Keyword(null,"left","left",-399115937);
129
+ } else {
130
+ return new cljs.core.Keyword(null,"right","right",-452581833);
131
+ }
132
+ } else {
133
+ if((dy < (0))){
134
+ return new cljs.core.Keyword(null,"top","top",-1856271961);
135
+ } else {
136
+ return new cljs.core.Keyword(null,"bottom","bottom",-1550509018);
137
+ }
138
+ }
139
+ });
140
+ /**
141
+ * Update ghost position and find tile under finger.
142
+ */
143
+ iris_layout.components.touch_drag.move_drag_BANG_ = (function iris_layout$components$touch_drag$move_drag_BANG_(touch_event){
144
+ var temp__5804__auto__ = cljs.core.deref(iris_layout.components.touch_drag.touch_state);
145
+ if(cljs.core.truth_(temp__5804__auto__)){
146
+ var state = temp__5804__auto__;
147
+ var touch = (touch_event.changedTouches[(0)]);
148
+ var x = touch.clientX;
149
+ var y = touch.clientY;
150
+ var ghost = new cljs.core.Keyword(null,"ghost-el","ghost-el",-316931125).cljs$core$IFn$_invoke$arity$1(state);
151
+ if(cljs.core.truth_(ghost)){
152
+ (ghost.style.left = [cljs.core.str.cljs$core$IFn$_invoke$arity$1((x - (40))),"px"].join(''));
153
+
154
+ (ghost.style.top = [cljs.core.str.cljs$core$IFn$_invoke$arity$1((y - (20))),"px"].join(''));
155
+ } else {
156
+ }
157
+
158
+ if(cljs.core.truth_(ghost)){
159
+ (ghost.style.display = "none");
160
+ } else {
161
+ }
162
+
163
+ var el_under = document.elementFromPoint(x,y);
164
+ var nav_el = (cljs.core.truth_(el_under)?el_under.closest(".iris-nav-edge"):null);
165
+ var tile_el = iris_layout.components.touch_drag.find_tile_element(x,y);
166
+ if(cljs.core.truth_(ghost)){
167
+ (ghost.style.display = "");
168
+ } else {
169
+ }
170
+
171
+ if(cljs.core.truth_(nav_el)){
172
+ var dir = (cljs.core.truth_(nav_el.classList.contains("iris-nav-left"))?new cljs.core.Keyword(null,"left","left",-399115937):(cljs.core.truth_(nav_el.classList.contains("iris-nav-right"))?new cljs.core.Keyword(null,"right","right",-452581833):(cljs.core.truth_(nav_el.classList.contains("iris-nav-top"))?new cljs.core.Keyword(null,"up","up",-269712113):(cljs.core.truth_(nav_el.classList.contains("iris-nav-bottom"))?new cljs.core.Keyword(null,"down","down",1565245570):null
173
+ ))));
174
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.nav_edge_target,dir);
175
+
176
+ return cljs.core.reset_BANG_(iris_layout.components.touch_drag.hover_target,null);
177
+ } else {
178
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.nav_edge_target,null);
179
+
180
+ if(cljs.core.truth_(tile_el)){
181
+ var half = iris_layout.components.touch_drag.calculate_half_xy(x,y,tile_el);
182
+ var tile_id = tile_el.getAttribute("data-tile-id");
183
+ return cljs.core.reset_BANG_(iris_layout.components.touch_drag.hover_target,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"tile-el","tile-el",-1881974273),tile_el,new cljs.core.Keyword(null,"tile-id","tile-id",781804456),tile_id,new cljs.core.Keyword(null,"half","half",741990005),half], null));
184
+ } else {
185
+ return cljs.core.reset_BANG_(iris_layout.components.touch_drag.hover_target,null);
186
+ }
187
+ }
188
+ } else {
189
+ return null;
190
+ }
191
+ });
192
+ /**
193
+ * End touch drag — return the drop target info and clean up.
194
+ */
195
+ iris_layout.components.touch_drag.end_drag_BANG_ = (function iris_layout$components$touch_drag$end_drag_BANG_(){
196
+ var state = cljs.core.deref(iris_layout.components.touch_drag.touch_state);
197
+ var target = cljs.core.deref(iris_layout.components.touch_drag.hover_target);
198
+ var temp__5804__auto___12632 = new cljs.core.Keyword(null,"ghost-el","ghost-el",-316931125).cljs$core$IFn$_invoke$arity$1(state);
199
+ if(cljs.core.truth_(temp__5804__auto___12632)){
200
+ var ghost_12633 = temp__5804__auto___12632;
201
+ ghost_12633.remove();
202
+ } else {
203
+ }
204
+
205
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.touch_state,null);
206
+
207
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.hover_target,null);
208
+
209
+ cljs.core.reset_BANG_(iris_layout.components.touch_drag.nav_edge_target,null);
210
+
211
+ if(cljs.core.truth_((function (){var and__5000__auto__ = state;
212
+ if(cljs.core.truth_(and__5000__auto__)){
213
+ return target;
214
+ } else {
215
+ return and__5000__auto__;
216
+ }
217
+ })())){
218
+ return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"source-tile-id","source-tile-id",1477902631),new cljs.core.Keyword(null,"tile-id","tile-id",781804456).cljs$core$IFn$_invoke$arity$1(state),new cljs.core.Keyword(null,"source-entity-id","source-entity-id",-509281427),new cljs.core.Keyword(null,"entity-id","entity-id",1485898093).cljs$core$IFn$_invoke$arity$1(state),new cljs.core.Keyword(null,"target-tile-id","target-tile-id",-1830903484),new cljs.core.Keyword(null,"tile-id","tile-id",781804456).cljs$core$IFn$_invoke$arity$1(target),new cljs.core.Keyword(null,"half","half",741990005),new cljs.core.Keyword(null,"half","half",741990005).cljs$core$IFn$_invoke$arity$1(target)], null);
219
+ } else {
220
+ return null;
221
+ }
222
+ });
223
+ if((typeof iris_layout !== 'undefined') && (typeof iris_layout.components !== 'undefined') && (typeof iris_layout.components.touch_drag !== 'undefined') && (typeof iris_layout.components.touch_drag._touch_listeners !== 'undefined')){
224
+ } else {
225
+ iris_layout.components.touch_drag._touch_listeners = (function (){
226
+ document.addEventListener("touchmove",(function (e){
227
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
228
+ e.preventDefault();
229
+
230
+ return iris_layout.components.touch_drag.move_drag_BANG_(e);
231
+ } else {
232
+ if(iris_layout.components.touch_drag.pending_QMARK_()){
233
+ return iris_layout.components.touch_drag.check_move_cancel_BANG_(e);
234
+ } else {
235
+ return null;
236
+ }
237
+ }
238
+ }),({"passive": false}));
239
+
240
+ document.addEventListener("touchend",(function (_e){
241
+ iris_layout.components.touch_drag.cancel_pending_BANG_();
242
+
243
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
244
+ setTimeout((function (){
245
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
246
+ return iris_layout.components.touch_drag.end_drag_BANG_();
247
+ } else {
248
+ return null;
249
+ }
250
+ }),(100));
251
+ } else {
252
+ }
253
+
254
+ return setTimeout((function (){
255
+ var seq__12622 = cljs.core.seq(cljs.core.array_seq.cljs$core$IFn$_invoke$arity$1(document.querySelectorAll(".iris-touch-drag-ghost")));
256
+ var chunk__12623 = null;
257
+ var count__12624 = (0);
258
+ var i__12625 = (0);
259
+ while(true){
260
+ if((i__12625 < count__12624)){
261
+ var ghost = chunk__12623.cljs$core$IIndexed$_nth$arity$2(null,i__12625);
262
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
263
+ } else {
264
+ ghost.remove();
265
+ }
266
+
267
+
268
+ var G__12634 = seq__12622;
269
+ var G__12635 = chunk__12623;
270
+ var G__12636 = count__12624;
271
+ var G__12637 = (i__12625 + (1));
272
+ seq__12622 = G__12634;
273
+ chunk__12623 = G__12635;
274
+ count__12624 = G__12636;
275
+ i__12625 = G__12637;
276
+ continue;
277
+ } else {
278
+ var temp__5804__auto__ = cljs.core.seq(seq__12622);
279
+ if(temp__5804__auto__){
280
+ var seq__12622__$1 = temp__5804__auto__;
281
+ if(cljs.core.chunked_seq_QMARK_(seq__12622__$1)){
282
+ var c__5525__auto__ = cljs.core.chunk_first(seq__12622__$1);
283
+ var G__12639 = cljs.core.chunk_rest(seq__12622__$1);
284
+ var G__12640 = c__5525__auto__;
285
+ var G__12641 = cljs.core.count(c__5525__auto__);
286
+ var G__12642 = (0);
287
+ seq__12622 = G__12639;
288
+ chunk__12623 = G__12640;
289
+ count__12624 = G__12641;
290
+ i__12625 = G__12642;
291
+ continue;
292
+ } else {
293
+ var ghost = cljs.core.first(seq__12622__$1);
294
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
295
+ } else {
296
+ ghost.remove();
297
+ }
298
+
299
+
300
+ var G__12643 = cljs.core.next(seq__12622__$1);
301
+ var G__12644 = null;
302
+ var G__12645 = (0);
303
+ var G__12646 = (0);
304
+ seq__12622 = G__12643;
305
+ chunk__12623 = G__12644;
306
+ count__12624 = G__12645;
307
+ i__12625 = G__12646;
308
+ continue;
309
+ }
310
+ } else {
311
+ return null;
312
+ }
313
+ }
314
+ break;
315
+ }
316
+ }),(300));
317
+ }),({"passive": true}));
318
+
319
+ document.addEventListener("contextmenu",(function (e){
320
+ if(((iris_layout.components.touch_drag.pending_QMARK_()) || (iris_layout.components.touch_drag.dragging_QMARK_()))){
321
+ return e.preventDefault();
322
+ } else {
323
+ return null;
324
+ }
325
+ }),({"passive": false}));
326
+
327
+ document.addEventListener("touchcancel",(function (_e){
328
+ iris_layout.components.touch_drag.cancel_pending_BANG_();
329
+
330
+ if(iris_layout.components.touch_drag.dragging_QMARK_()){
331
+ iris_layout.components.touch_drag.end_drag_BANG_();
332
+ } else {
333
+ }
334
+
335
+ return setTimeout((function (){
336
+ var seq__12626 = cljs.core.seq(cljs.core.array_seq.cljs$core$IFn$_invoke$arity$1(document.querySelectorAll(".iris-touch-drag-ghost")));
337
+ var chunk__12627 = null;
338
+ var count__12628 = (0);
339
+ var i__12629 = (0);
340
+ while(true){
341
+ if((i__12629 < count__12628)){
342
+ var ghost = chunk__12627.cljs$core$IIndexed$_nth$arity$2(null,i__12629);
343
+ ghost.remove();
344
+
345
+
346
+ var G__12647 = seq__12626;
347
+ var G__12648 = chunk__12627;
348
+ var G__12649 = count__12628;
349
+ var G__12650 = (i__12629 + (1));
350
+ seq__12626 = G__12647;
351
+ chunk__12627 = G__12648;
352
+ count__12628 = G__12649;
353
+ i__12629 = G__12650;
354
+ continue;
355
+ } else {
356
+ var temp__5804__auto__ = cljs.core.seq(seq__12626);
357
+ if(temp__5804__auto__){
358
+ var seq__12626__$1 = temp__5804__auto__;
359
+ if(cljs.core.chunked_seq_QMARK_(seq__12626__$1)){
360
+ var c__5525__auto__ = cljs.core.chunk_first(seq__12626__$1);
361
+ var G__12651 = cljs.core.chunk_rest(seq__12626__$1);
362
+ var G__12652 = c__5525__auto__;
363
+ var G__12653 = cljs.core.count(c__5525__auto__);
364
+ var G__12654 = (0);
365
+ seq__12626 = G__12651;
366
+ chunk__12627 = G__12652;
367
+ count__12628 = G__12653;
368
+ i__12629 = G__12654;
369
+ continue;
370
+ } else {
371
+ var ghost = cljs.core.first(seq__12626__$1);
372
+ ghost.remove();
373
+
374
+
375
+ var G__12655 = cljs.core.next(seq__12626__$1);
376
+ var G__12656 = null;
377
+ var G__12657 = (0);
378
+ var G__12658 = (0);
379
+ seq__12626 = G__12655;
380
+ chunk__12627 = G__12656;
381
+ count__12628 = G__12657;
382
+ i__12629 = G__12658;
383
+ continue;
384
+ }
385
+ } else {
386
+ return null;
387
+ }
388
+ }
389
+ break;
390
+ }
391
+ }),(100));
392
+ }),({"passive": true}));
393
+
394
+ return true;
395
+ })()
396
+ ;
397
+ }
398
+
399
+ //# sourceMappingURL=iris_layout.components.touch_drag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["iris_layout/components/touch_drag.cljs"],"mappings":";;;;AAaA,kDAAA,lDAAKA;AAGL,mDAAA,nDAAKC;AAGL,GAAA,QAAAC,wCAAAC,mDAAAC,8DAAAC;AAAA;AAAA,AAAA,AAASC,gDAAY,gDAAA,hDAACC;;AAGtB,GAAA,QAAAL,wCAAAC,mDAAAC,8DAAAI;AAAA;AAAA,AAAA,AAASC,iDAAa,gDAAA,hDAACF;;AAIvB,GAAA,QAAAL,wCAAAC,mDAAAC,8DAAAM;AAAA;AAAA,AAA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AAAE;eAAA;eAAA;eAAA;;;;;;;;AAAA;;;;;GAFJ;GALJ,aAAA;;AAlCF","names":["iris-layout.components.touch-drag/long-press-ms","iris-layout.components.touch-drag/move-tolerance","js/iris-layout","js/iris-layout.components","js/iris-layout.components.touch-drag","js/iris-layout.components.touch-drag.touch-state","iris-layout.components.touch-drag/touch-state","reagent.core.atom","js/iris-layout.components.touch-drag.hover-target","iris-layout.components.touch-drag/hover-target","js/iris-layout.components.touch-drag.nav-edge-target","iris-layout.components.touch-drag/nav-edge-target","js/iris-layout.components.touch-drag.pending","iris-layout.components.touch-drag/pending","cljs.core.atom","iris-layout.components.touch-drag/dragging?","cljs.core/deref","iris-layout.components.touch-drag/pending?","iris-layout.components.touch-drag/create-ghost!","x","y","ghost","js/document.createElement","js/document.body","iris-layout.components.touch-drag/start-pending!","tile-id","entity-id","touch-event","on-activate","touch","timer","js/setTimeout","cljs.core/reset!","temp__5804__auto__","sel","js/window.getSelection","js/navigator","iris-layout.components.touch-drag/cancel-pending!","p","js/clearTimeout","iris-layout.components.touch-drag/check-move-cancel!","dx","dy","js/Math.sqrt","iris-layout.components.touch-drag/find-tile-element","el","js/document.elementFromPoint","iris-layout.components.touch-drag/calculate-half-xy","rect","cx","cy","js/Math.abs","iris-layout.components.touch-drag/move-drag!","state","el-under","nav-el","tile-el","dir","half","iris-layout.components.touch-drag/end-drag!","target","and__5000__auto__","js/iris-layout.components.touch-drag._touch-listeners","iris-layout.components.touch-drag/_touch-listeners","js/document","e","_e","seq__12622","cljs.core/seq","chunk__12623","count__12624","i__12625","cljs.core/chunked-seq?","c__5525__auto__","cljs.core/chunk-first","cljs.core/chunk-rest","cljs.core/count","cljs.core/first","cljs.core/next","cljs.core.array_seq","seq__12626","chunk__12627","count__12628","i__12629"],"sourcesContent":["(ns iris-layout.components.touch-drag\n \"Touch drag state \u2014 shared across all tiles for mobile drag-drop.\n\n On touch devices, HTML5 Drag and Drop doesn't work. This module\n provides a global touch-drag state that tiles subscribe to.\n\n Flow:\n 1. Header long-press (~400ms) \u2192 sets drag source info, creates ghost\n 2. Global touchmove \u2192 updates ghost position, finds tile under finger\n 3. Touchend \u2192 performs drop on target tile, cleans up\"\n (:require [reagent.core :as r]))\n\n;; Long-press duration in ms\n(def long-press-ms 400)\n\n;; Tolerance in px \u2014 if finger moves more than this, cancel long-press\n(def move-tolerance 10)\n\n;; Global touch drag state\n(defonce touch-state (r/atom nil))\n;; Shape: {:tile-id str :entity-id str :ghost-el DOM :active? bool}\n\n(defonce hover-target (r/atom nil))\n;; Shape: {:tile-el DOM :tile-id str :half keyword} or nil\n\n;; Nav edge target \u2014 tracks when touch hovers over a nav edge during drag\n(defonce nav-edge-target (r/atom nil))\n;; Shape: :left | :right | :up | :down | nil\n\n;; Long-press pending state (not reactive, internal only)\n(defonce ^:private pending (atom nil))\n;; Shape: {:timer-id int :start-x num :start-y num :tile-id str :entity-id str}\n\n(defn dragging? []\n (some? @touch-state))\n\n(defn pending? []\n (some? @pending))\n\n(defn- create-ghost! [x y]\n (let [ghost (js/document.createElement \"div\")]\n (set! (.-className ghost) \"iris-touch-drag-ghost\")\n (set! (.-cssText (.-style ghost))\n (str \"position:fixed;z-index:10000;pointer-events:none;\"\n \"background:rgba(99,102,241,0.8);color:#fff;padding:6px 14px;\"\n \"border-radius:8px;font-size:12px;font-weight:500;\"\n \"box-shadow:0 4px 20px rgba(0,0,0,0.4);\"\n \"left:\" (- x 40) \"px;\"\n \"top:\" (- y 20) \"px;\"))\n (.appendChild js/document.body ghost)\n ghost))\n\n(defn start-pending!\n \"Begin long-press detection on a header touchstart.\"\n [tile-id entity-id touch-event on-activate]\n (let [touch (aget (.-changedTouches touch-event) 0)\n x (.-clientX touch)\n y (.-clientY touch)\n timer (js/setTimeout\n (fn []\n ;; Long-press triggered \u2014 activate drag\n (let [ghost (create-ghost! x y)]\n (reset! touch-state {:tile-id tile-id\n :entity-id entity-id\n :ghost-el ghost\n :active? true})\n (reset! pending nil)\n ;; Clear any text selection\n (when-let [sel (js/window.getSelection)]\n (.removeAllRanges sel))\n ;; Vibrate for haptic feedback if available\n (when (.-vibrate js/navigator)\n (.vibrate js/navigator 30))\n (when on-activate (on-activate))))\n long-press-ms)]\n (reset! pending {:timer-id timer\n :start-x x\n :start-y y\n :tile-id tile-id\n :entity-id entity-id})))\n\n(defn cancel-pending!\n \"Cancel a pending long-press.\"\n []\n (when-let [p @pending]\n (js/clearTimeout (:timer-id p))\n (reset! pending nil)))\n\n(defn check-move-cancel!\n \"Cancel long-press if finger moved too far.\"\n [touch-event]\n (when-let [p @pending]\n (let [touch (aget (.-changedTouches touch-event) 0)\n dx (- (.-clientX touch) (:start-x p))\n dy (- (.-clientY touch) (:start-y p))]\n (when (> (js/Math.sqrt (+ (* dx dx) (* dy dy))) move-tolerance)\n (cancel-pending!)))))\n\n(defn- find-tile-element\n \"Find the closest .iris-entity-tile ancestor from the element at point.\"\n [x y]\n (when-let [el (js/document.elementFromPoint x y)]\n (.closest el \".iris-entity-tile\")))\n\n(defn- calculate-half-xy\n \"Determine which half of an element a point is closest to.\"\n [x y el]\n (let [rect (.getBoundingClientRect el)\n cx (+ (.-left rect) (/ (.-width rect) 2))\n cy (+ (.-top rect) (/ (.-height rect) 2))\n dx (- x cx)\n dy (- y 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 move-drag!\n \"Update ghost position and find tile under finger.\"\n [touch-event]\n (when-let [state @touch-state]\n (let [touch (aget (.-changedTouches touch-event) 0)\n x (.-clientX touch)\n y (.-clientY touch)\n ghost (:ghost-el state)]\n ;; Move ghost\n (when ghost\n (set! (.-left (.-style ghost)) (str (- x 40) \"px\"))\n (set! (.-top (.-style ghost)) (str (- y 20) \"px\")))\n ;; Hide ghost briefly to find element underneath\n (when ghost (set! (.-display (.-style ghost)) \"none\"))\n (let [el-under (js/document.elementFromPoint x y)\n nav-el (when el-under (.closest el-under \".iris-nav-edge\"))\n tile-el (find-tile-element x y)]\n (when ghost (set! (.-display (.-style ghost)) \"\"))\n (if nav-el\n (let [dir (cond\n (.contains (.-classList nav-el) \"iris-nav-left\") :left\n (.contains (.-classList nav-el) \"iris-nav-right\") :right\n (.contains (.-classList nav-el) \"iris-nav-top\") :up\n (.contains (.-classList nav-el) \"iris-nav-bottom\") :down\n :else nil)]\n (reset! nav-edge-target dir)\n (reset! hover-target nil))\n (do\n (reset! nav-edge-target nil)\n (if tile-el\n (let [half (calculate-half-xy x y tile-el)\n tile-id (.getAttribute tile-el \"data-tile-id\")]\n (reset! hover-target {:tile-el tile-el :tile-id tile-id :half half}))\n (reset! hover-target nil))))))))\n\n(defn end-drag!\n \"End touch drag \u2014 return the drop target info and clean up.\"\n []\n (let [state @touch-state\n target @hover-target]\n ;; Clean up ghost\n (when-let [ghost (:ghost-el state)]\n (.remove ghost))\n (reset! touch-state nil)\n (reset! hover-target nil)\n (reset! nav-edge-target nil)\n ;; Return drop info\n (when (and state target)\n {:source-tile-id (:tile-id state)\n :source-entity-id (:entity-id state)\n :target-tile-id (:tile-id target)\n :half (:half target)})))\n\n;; Global touch listeners (attached once)\n(defonce _touch-listeners\n (do\n (.addEventListener js/document \"touchmove\"\n (fn [e]\n (cond\n ;; Active drag \u2014 move ghost and find target\n (dragging?)\n (do (.preventDefault e)\n (move-drag! e))\n ;; Pending long-press \u2014 check if moved too far\n (pending?)\n (check-move-cancel! e)))\n #js {:passive false})\n (.addEventListener js/document \"touchend\"\n (fn [_e]\n ;; Cancel pending long-press on lift\n (cancel-pending!)\n ;; Safety cleanup for active drag (individual tiles handle the drop)\n ;; Also remove any orphaned ghost elements\n (when (dragging?)\n (js/setTimeout #(when (dragging?) (end-drag!)) 100))\n ;; Belt-and-suspenders: remove any leftover ghost elements\n (js/setTimeout\n (fn []\n (doseq [ghost (array-seq (.querySelectorAll js/document \".iris-touch-drag-ghost\"))]\n (when-not (dragging?)\n (.remove ghost))))\n 300))\n #js {:passive true})\n ;; Prevent context menu during long-press / active drag\n (.addEventListener js/document \"contextmenu\"\n (fn [e]\n (when (or (pending?) (dragging?))\n (.preventDefault e)))\n #js {:passive false})\n (.addEventListener js/document \"touchcancel\"\n (fn [_e]\n (cancel-pending!)\n (when (dragging?) (end-drag!))\n ;; Remove any orphaned ghost elements\n (js/setTimeout\n (fn []\n (doseq [ghost (array-seq (.querySelectorAll js/document \".iris-touch-drag-ghost\"))]\n (.remove ghost)))\n 100))\n #js {:passive true})\n true))\n"]}