@witchcraft/layout 1.0.0

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 (336) hide show
  1. package/README.md +474 -0
  2. package/dist/module.d.mts +14 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +26 -0
  5. package/dist/runtime/components/LayoutDecos.d.vue.ts +0 -0
  6. package/dist/runtime/components/LayoutDecos.vue +54 -0
  7. package/dist/runtime/components/LayoutDecos.vue.d.ts +0 -0
  8. package/dist/runtime/components/LayoutEdges.d.vue.ts +0 -0
  9. package/dist/runtime/components/LayoutEdges.vue +145 -0
  10. package/dist/runtime/components/LayoutEdges.vue.d.ts +0 -0
  11. package/dist/runtime/components/LayoutFrame.d.vue.ts +0 -0
  12. package/dist/runtime/components/LayoutFrame.vue +41 -0
  13. package/dist/runtime/components/LayoutFrame.vue.d.ts +0 -0
  14. package/dist/runtime/components/LayoutShapeSquare.d.vue.ts +0 -0
  15. package/dist/runtime/components/LayoutShapeSquare.vue +36 -0
  16. package/dist/runtime/components/LayoutShapeSquare.vue.d.ts +0 -0
  17. package/dist/runtime/components/LayoutWindow.d.vue.ts +0 -0
  18. package/dist/runtime/components/LayoutWindow.vue +183 -0
  19. package/dist/runtime/components/LayoutWindow.vue.d.ts +0 -0
  20. package/dist/runtime/composables/useFrames.d.ts +0 -0
  21. package/dist/runtime/composables/useFrames.js +184 -0
  22. package/dist/runtime/demo/App.d.vue.ts +0 -0
  23. package/dist/runtime/demo/App.vue +123 -0
  24. package/dist/runtime/demo/App.vue.d.ts +0 -0
  25. package/dist/runtime/demo/DemoControls.d.vue.ts +0 -0
  26. package/dist/runtime/demo/DemoControls.vue +14 -0
  27. package/dist/runtime/demo/DemoControls.vue.d.ts +0 -0
  28. package/dist/runtime/demo/README.md +1 -0
  29. package/dist/runtime/demo/main.d.ts +0 -0
  30. package/dist/runtime/demo/main.js +4 -0
  31. package/dist/runtime/demo/sharedLayoutInstance.d.ts +0 -0
  32. package/dist/runtime/demo/sharedLayoutInstance.js +5 -0
  33. package/dist/runtime/demo/tailwind.css +1 -0
  34. package/dist/runtime/drag/CloseAction.d.ts +0 -0
  35. package/dist/runtime/drag/CloseAction.js +121 -0
  36. package/dist/runtime/drag/DragActionHandler.d.ts +0 -0
  37. package/dist/runtime/drag/DragActionHandler.js +83 -0
  38. package/dist/runtime/drag/DragDirectionStore.d.ts +0 -0
  39. package/dist/runtime/drag/DragDirectionStore.js +45 -0
  40. package/dist/runtime/drag/SplitAction.d.ts +0 -0
  41. package/dist/runtime/drag/SplitAction.js +110 -0
  42. package/dist/runtime/drag/types.d.ts +0 -0
  43. package/dist/runtime/drag/types.js +0 -0
  44. package/dist/runtime/helpers/addPointsToIntersection.d.ts +0 -0
  45. package/dist/runtime/helpers/addPointsToIntersection.js +7 -0
  46. package/dist/runtime/helpers/assertEdgeSorted.d.ts +0 -0
  47. package/dist/runtime/helpers/assertEdgeSorted.js +7 -0
  48. package/dist/runtime/helpers/assertItemIn.d.ts +0 -0
  49. package/dist/runtime/helpers/assertItemIn.js +8 -0
  50. package/dist/runtime/helpers/assertItemNotIn.d.ts +0 -0
  51. package/dist/runtime/helpers/assertItemNotIn.js +7 -0
  52. package/dist/runtime/helpers/assertLayoutHasActiveWindow.d.ts +0 -0
  53. package/dist/runtime/helpers/assertLayoutHasActiveWindow.js +7 -0
  54. package/dist/runtime/helpers/assertValidWinAndFrame.d.ts +0 -0
  55. package/dist/runtime/helpers/assertValidWinAndFrame.js +5 -0
  56. package/dist/runtime/helpers/assertValidWinAndFrameIds.d.ts +0 -0
  57. package/dist/runtime/helpers/assertValidWinAndFrameIds.js +6 -0
  58. package/dist/runtime/helpers/assertWindowHasActiveFrame.d.ts +0 -0
  59. package/dist/runtime/helpers/assertWindowHasActiveFrame.js +7 -0
  60. package/dist/runtime/helpers/clampNumber.d.ts +0 -0
  61. package/dist/runtime/helpers/clampNumber.js +3 -0
  62. package/dist/runtime/helpers/cloneFrame.d.ts +0 -0
  63. package/dist/runtime/helpers/cloneFrame.js +3 -0
  64. package/dist/runtime/helpers/cloneFrames.d.ts +0 -0
  65. package/dist/runtime/helpers/cloneFrames.js +16 -0
  66. package/dist/runtime/helpers/containsEdge.d.ts +0 -0
  67. package/dist/runtime/helpers/containsEdge.js +13 -0
  68. package/dist/runtime/helpers/convertLayoutWindowToWorkspace.d.ts +0 -0
  69. package/dist/runtime/helpers/convertLayoutWindowToWorkspace.js +10 -0
  70. package/dist/runtime/helpers/copySize.d.ts +0 -0
  71. package/dist/runtime/helpers/copySize.js +5 -0
  72. package/dist/runtime/helpers/createEdge.d.ts +0 -0
  73. package/dist/runtime/helpers/createEdge.js +13 -0
  74. package/dist/runtime/helpers/dirToOrientation.d.ts +0 -0
  75. package/dist/runtime/helpers/dirToOrientation.js +10 -0
  76. package/dist/runtime/helpers/dirToSide.d.ts +0 -0
  77. package/dist/runtime/helpers/dirToSide.js +5 -0
  78. package/dist/runtime/helpers/doEdgesOverlap.d.ts +0 -0
  79. package/dist/runtime/helpers/doEdgesOverlap.js +22 -0
  80. package/dist/runtime/helpers/doesEdgeContinueEdge.d.ts +0 -0
  81. package/dist/runtime/helpers/doesEdgeContinueEdge.js +17 -0
  82. package/dist/runtime/helpers/edgeToPoints.d.ts +0 -0
  83. package/dist/runtime/helpers/edgeToPoints.js +3 -0
  84. package/dist/runtime/helpers/findDraggableEdge.d.ts +0 -0
  85. package/dist/runtime/helpers/findDraggableEdge.js +13 -0
  86. package/dist/runtime/helpers/findFrameDraggableEdges.d.ts +0 -0
  87. package/dist/runtime/helpers/findFrameDraggableEdges.js +18 -0
  88. package/dist/runtime/helpers/frameToEdges.d.ts +0 -0
  89. package/dist/runtime/helpers/frameToEdges.js +21 -0
  90. package/dist/runtime/helpers/frameToPoints.d.ts +0 -0
  91. package/dist/runtime/helpers/frameToPoints.js +7 -0
  92. package/dist/runtime/helpers/getEdgeOrientation.d.ts +0 -0
  93. package/dist/runtime/helpers/getEdgeOrientation.js +4 -0
  94. package/dist/runtime/helpers/getEdgeSharedDirection.d.ts +0 -0
  95. package/dist/runtime/helpers/getEdgeSharedDirection.js +7 -0
  96. package/dist/runtime/helpers/getEdgeSide.d.ts +0 -0
  97. package/dist/runtime/helpers/getEdgeSide.js +16 -0
  98. package/dist/runtime/helpers/getFrameById.d.ts +0 -0
  99. package/dist/runtime/helpers/getFrameById.js +5 -0
  100. package/dist/runtime/helpers/getFrameConstant.d.ts +0 -0
  101. package/dist/runtime/helpers/getFrameConstant.js +15 -0
  102. package/dist/runtime/helpers/getIntersections.d.ts +0 -0
  103. package/dist/runtime/helpers/getIntersections.js +63 -0
  104. package/dist/runtime/helpers/getIntersectionsCss.d.ts +0 -0
  105. package/dist/runtime/helpers/getIntersectionsCss.js +56 -0
  106. package/dist/runtime/helpers/getMoveEdgeInfo.d.ts +0 -0
  107. package/dist/runtime/helpers/getMoveEdgeInfo.js +42 -0
  108. package/dist/runtime/helpers/getResizeLimit.d.ts +0 -0
  109. package/dist/runtime/helpers/getResizeLimit.js +39 -0
  110. package/dist/runtime/helpers/getShapeSquareCss.d.ts +0 -0
  111. package/dist/runtime/helpers/getShapeSquareCss.js +17 -0
  112. package/dist/runtime/helpers/getSideTouching.d.ts +0 -0
  113. package/dist/runtime/helpers/getSideTouching.js +7 -0
  114. package/dist/runtime/helpers/getVisualEdgeCss.d.ts +0 -0
  115. package/dist/runtime/helpers/getVisualEdgeCss.js +40 -0
  116. package/dist/runtime/helpers/getVisualEdges.d.ts +0 -0
  117. package/dist/runtime/helpers/getVisualEdges.js +89 -0
  118. package/dist/runtime/helpers/getVisualEdgesCss.d.ts +0 -0
  119. package/dist/runtime/helpers/getVisualEdgesCss.js +4 -0
  120. package/dist/runtime/helpers/getWinAndFrameById.d.ts +0 -0
  121. package/dist/runtime/helpers/getWinAndFrameById.js +14 -0
  122. package/dist/runtime/helpers/getWinByFrameUuid.d.ts +0 -0
  123. package/dist/runtime/helpers/getWinByFrameUuid.js +13 -0
  124. package/dist/runtime/helpers/getWinById.d.ts +0 -0
  125. package/dist/runtime/helpers/getWinById.js +5 -0
  126. package/dist/runtime/helpers/getWindowConstant.d.ts +0 -0
  127. package/dist/runtime/helpers/getWindowConstant.js +14 -0
  128. package/dist/runtime/helpers/inRange.d.ts +0 -0
  129. package/dist/runtime/helpers/inRange.js +3 -0
  130. package/dist/runtime/helpers/index.d.ts +0 -0
  131. package/dist/runtime/helpers/index.js +62 -0
  132. package/dist/runtime/helpers/isEdgeEqual.d.ts +0 -0
  133. package/dist/runtime/helpers/isEdgeEqual.js +11 -0
  134. package/dist/runtime/helpers/isEdgeParallel.d.ts +0 -0
  135. package/dist/runtime/helpers/isEdgeParallel.js +7 -0
  136. package/dist/runtime/helpers/isPointEqual.d.ts +0 -0
  137. package/dist/runtime/helpers/isPointEqual.js +3 -0
  138. package/dist/runtime/helpers/isSizeAboveMin.d.ts +0 -0
  139. package/dist/runtime/helpers/isSizeAboveMin.js +3 -0
  140. package/dist/runtime/helpers/isSizeEqual.d.ts +0 -0
  141. package/dist/runtime/helpers/isSizeEqual.js +3 -0
  142. package/dist/runtime/helpers/isWindowEdge.d.ts +0 -0
  143. package/dist/runtime/helpers/isWindowEdge.js +7 -0
  144. package/dist/runtime/helpers/isWindowEdgePoint.d.ts +0 -0
  145. package/dist/runtime/helpers/isWindowEdgePoint.js +5 -0
  146. package/dist/runtime/helpers/moveEdge.d.ts +0 -0
  147. package/dist/runtime/helpers/moveEdge.js +8 -0
  148. package/dist/runtime/helpers/numberToScaledPercent.d.ts +0 -0
  149. package/dist/runtime/helpers/numberToScaledPercent.js +5 -0
  150. package/dist/runtime/helpers/numberToScaledSize.d.ts +0 -0
  151. package/dist/runtime/helpers/numberToScaledSize.js +19 -0
  152. package/dist/runtime/helpers/oppositeSide.d.ts +0 -0
  153. package/dist/runtime/helpers/oppositeSide.js +30 -0
  154. package/dist/runtime/helpers/resizeByEdge.d.ts +0 -0
  155. package/dist/runtime/helpers/resizeByEdge.js +29 -0
  156. package/dist/runtime/helpers/sideToDirection.d.ts +0 -0
  157. package/dist/runtime/helpers/sideToDirection.js +11 -0
  158. package/dist/runtime/helpers/sideToOrientation.d.ts +0 -0
  159. package/dist/runtime/helpers/sideToOrientation.js +10 -0
  160. package/dist/runtime/helpers/splitEdge.d.ts +0 -0
  161. package/dist/runtime/helpers/splitEdge.js +20 -0
  162. package/dist/runtime/helpers/toCoord.d.ts +0 -0
  163. package/dist/runtime/helpers/toCoord.js +10 -0
  164. package/dist/runtime/helpers/toId.d.ts +0 -0
  165. package/dist/runtime/helpers/toId.js +4 -0
  166. package/dist/runtime/helpers/toWindowCoord.d.ts +0 -0
  167. package/dist/runtime/helpers/toWindowCoord.js +14 -0
  168. package/dist/runtime/helpers/unionEdges.d.ts +0 -0
  169. package/dist/runtime/helpers/unionEdges.js +8 -0
  170. package/dist/runtime/helpers/updateWindowSizeWithEvent.d.ts +0 -0
  171. package/dist/runtime/helpers/updateWindowSizeWithEvent.js +8 -0
  172. package/dist/runtime/index.d.ts +0 -0
  173. package/dist/runtime/index.js +5 -0
  174. package/dist/runtime/layout/closeFrame.d.ts +0 -0
  175. package/dist/runtime/layout/closeFrame.js +13 -0
  176. package/dist/runtime/layout/closeFrames.d.ts +0 -0
  177. package/dist/runtime/layout/closeFrames.js +8 -0
  178. package/dist/runtime/layout/createSplitDecoEdge.d.ts +0 -0
  179. package/dist/runtime/layout/createSplitDecoEdge.js +24 -0
  180. package/dist/runtime/layout/createSplitDecoFromDrag.d.ts +0 -0
  181. package/dist/runtime/layout/createSplitDecoFromDrag.js +14 -0
  182. package/dist/runtime/layout/debugFrame.d.ts +0 -0
  183. package/dist/runtime/layout/debugFrame.js +4 -0
  184. package/dist/runtime/layout/findFramesTouchingEdge.d.ts +0 -0
  185. package/dist/runtime/layout/findFramesTouchingEdge.js +33 -0
  186. package/dist/runtime/layout/findSafeSplitEdge.d.ts +0 -0
  187. package/dist/runtime/layout/findSafeSplitEdge.js +20 -0
  188. package/dist/runtime/layout/findVisualEdge.d.ts +0 -0
  189. package/dist/runtime/layout/findVisualEdge.js +9 -0
  190. package/dist/runtime/layout/frameCreate.d.ts +0 -0
  191. package/dist/runtime/layout/frameCreate.js +13 -0
  192. package/dist/runtime/layout/frameSplit.d.ts +0 -0
  193. package/dist/runtime/layout/frameSplit.js +9 -0
  194. package/dist/runtime/layout/getCloseFrameInfo.d.ts +0 -0
  195. package/dist/runtime/layout/getCloseFrameInfo.js +103 -0
  196. package/dist/runtime/layout/getFrameSplitInfo.d.ts +0 -0
  197. package/dist/runtime/layout/getFrameSplitInfo.js +40 -0
  198. package/dist/runtime/layout/getFrameTo.d.ts +0 -0
  199. package/dist/runtime/layout/getFrameTo.js +47 -0
  200. package/dist/runtime/layout/index.d.ts +0 -0
  201. package/dist/runtime/layout/index.js +22 -0
  202. package/dist/runtime/layout/isPointInFrame.d.ts +0 -0
  203. package/dist/runtime/layout/isPointInFrame.js +4 -0
  204. package/dist/runtime/layout/layoutAddWindow.d.ts +0 -0
  205. package/dist/runtime/layout/layoutAddWindow.js +4 -0
  206. package/dist/runtime/layout/layoutCreate.d.ts +0 -0
  207. package/dist/runtime/layout/layoutCreate.js +7 -0
  208. package/dist/runtime/layout/layoutRemoveWindow.d.ts +0 -0
  209. package/dist/runtime/layout/layoutRemoveWindow.js +5 -0
  210. package/dist/runtime/layout/resizeFrame.d.ts +0 -0
  211. package/dist/runtime/layout/resizeFrame.js +69 -0
  212. package/dist/runtime/layout/windowAddFrame.d.ts +0 -0
  213. package/dist/runtime/layout/windowAddFrame.js +4 -0
  214. package/dist/runtime/layout/windowCreate.d.ts +0 -0
  215. package/dist/runtime/layout/windowCreate.js +13 -0
  216. package/dist/runtime/layout/windowRemoveFrame.d.ts +0 -0
  217. package/dist/runtime/layout/windowRemoveFrame.js +5 -0
  218. package/dist/runtime/layout/windowSetActiveFrame.d.ts +0 -0
  219. package/dist/runtime/layout/windowSetActiveFrame.js +5 -0
  220. package/dist/runtime/settings.d.ts +0 -0
  221. package/dist/runtime/settings.js +54 -0
  222. package/dist/runtime/types/index.d.ts +0 -0
  223. package/dist/runtime/types/index.js +120 -0
  224. package/dist/runtime/utils/KnownError.d.ts +0 -0
  225. package/dist/runtime/utils/KnownError.js +9 -0
  226. package/dist/types.d.mts +5 -0
  227. package/package.json +153 -0
  228. package/src/module.ts +43 -0
  229. package/src/runtime/components/LayoutDecos.vue +62 -0
  230. package/src/runtime/components/LayoutEdges.vue +172 -0
  231. package/src/runtime/components/LayoutFrame.vue +47 -0
  232. package/src/runtime/components/LayoutShapeSquare.vue +38 -0
  233. package/src/runtime/components/LayoutWindow.vue +223 -0
  234. package/src/runtime/composables/useFrames.ts +251 -0
  235. package/src/runtime/demo/App.vue +140 -0
  236. package/src/runtime/demo/DemoControls.vue +17 -0
  237. package/src/runtime/demo/README.md +1 -0
  238. package/src/runtime/demo/main.ts +9 -0
  239. package/src/runtime/demo/sharedLayoutInstance.ts +7 -0
  240. package/src/runtime/demo/tailwind.css +4 -0
  241. package/src/runtime/drag/CloseAction.ts +158 -0
  242. package/src/runtime/drag/DragActionHandler.ts +146 -0
  243. package/src/runtime/drag/DragDirectionStore.ts +63 -0
  244. package/src/runtime/drag/SplitAction.ts +147 -0
  245. package/src/runtime/drag/types.ts +107 -0
  246. package/src/runtime/helpers/addPointsToIntersection.ts +9 -0
  247. package/src/runtime/helpers/assertEdgeSorted.ts +11 -0
  248. package/src/runtime/helpers/assertItemIn.ts +13 -0
  249. package/src/runtime/helpers/assertItemNotIn.ts +10 -0
  250. package/src/runtime/helpers/assertLayoutHasActiveWindow.ts +9 -0
  251. package/src/runtime/helpers/assertValidWinAndFrame.ts +16 -0
  252. package/src/runtime/helpers/assertValidWinAndFrameIds.ts +9 -0
  253. package/src/runtime/helpers/assertWindowHasActiveFrame.ts +9 -0
  254. package/src/runtime/helpers/clampNumber.ts +9 -0
  255. package/src/runtime/helpers/cloneFrame.ts +5 -0
  256. package/src/runtime/helpers/cloneFrames.ts +20 -0
  257. package/src/runtime/helpers/containsEdge.ts +16 -0
  258. package/src/runtime/helpers/convertLayoutWindowToWorkspace.ts +18 -0
  259. package/src/runtime/helpers/copySize.ts +7 -0
  260. package/src/runtime/helpers/createEdge.ts +19 -0
  261. package/src/runtime/helpers/dirToOrientation.ts +12 -0
  262. package/src/runtime/helpers/dirToSide.ts +7 -0
  263. package/src/runtime/helpers/doEdgesOverlap.ts +25 -0
  264. package/src/runtime/helpers/doesEdgeContinueEdge.ts +20 -0
  265. package/src/runtime/helpers/edgeToPoints.ts +5 -0
  266. package/src/runtime/helpers/findDraggableEdge.ts +24 -0
  267. package/src/runtime/helpers/findFrameDraggableEdges.ts +32 -0
  268. package/src/runtime/helpers/frameToEdges.ts +32 -0
  269. package/src/runtime/helpers/frameToPoints.ts +14 -0
  270. package/src/runtime/helpers/getEdgeOrientation.ts +6 -0
  271. package/src/runtime/helpers/getEdgeSharedDirection.ts +10 -0
  272. package/src/runtime/helpers/getEdgeSide.ts +27 -0
  273. package/src/runtime/helpers/getFrameById.ts +15 -0
  274. package/src/runtime/helpers/getFrameConstant.ts +22 -0
  275. package/src/runtime/helpers/getIntersections.ts +87 -0
  276. package/src/runtime/helpers/getIntersectionsCss.ts +65 -0
  277. package/src/runtime/helpers/getMoveEdgeInfo.ts +69 -0
  278. package/src/runtime/helpers/getResizeLimit.ts +60 -0
  279. package/src/runtime/helpers/getShapeSquareCss.ts +28 -0
  280. package/src/runtime/helpers/getSideTouching.ts +9 -0
  281. package/src/runtime/helpers/getVisualEdgeCss.ts +53 -0
  282. package/src/runtime/helpers/getVisualEdges.ts +155 -0
  283. package/src/runtime/helpers/getVisualEdgesCss.ts +13 -0
  284. package/src/runtime/helpers/getWinAndFrameById.ts +28 -0
  285. package/src/runtime/helpers/getWinByFrameUuid.ts +19 -0
  286. package/src/runtime/helpers/getWinById.ts +12 -0
  287. package/src/runtime/helpers/getWindowConstant.ts +21 -0
  288. package/src/runtime/helpers/inRange.ts +5 -0
  289. package/src/runtime/helpers/index.ts +64 -0
  290. package/src/runtime/helpers/isEdgeEqual.ts +14 -0
  291. package/src/runtime/helpers/isEdgeParallel.ts +10 -0
  292. package/src/runtime/helpers/isPointEqual.ts +5 -0
  293. package/src/runtime/helpers/isSizeAboveMin.ts +8 -0
  294. package/src/runtime/helpers/isSizeEqual.ts +5 -0
  295. package/src/runtime/helpers/isWindowEdge.ts +11 -0
  296. package/src/runtime/helpers/isWindowEdgePoint.ts +8 -0
  297. package/src/runtime/helpers/moveEdge.ts +21 -0
  298. package/src/runtime/helpers/numberToScaledPercent.ts +19 -0
  299. package/src/runtime/helpers/numberToScaledSize.ts +28 -0
  300. package/src/runtime/helpers/oppositeSide.ts +45 -0
  301. package/src/runtime/helpers/resizeByEdge.ts +45 -0
  302. package/src/runtime/helpers/sideToDirection.ts +15 -0
  303. package/src/runtime/helpers/sideToOrientation.ts +12 -0
  304. package/src/runtime/helpers/splitEdge.ts +23 -0
  305. package/src/runtime/helpers/toCoord.ts +13 -0
  306. package/src/runtime/helpers/toId.ts +9 -0
  307. package/src/runtime/helpers/toWindowCoord.ts +23 -0
  308. package/src/runtime/helpers/unionEdges.ts +11 -0
  309. package/src/runtime/helpers/updateWindowSizeWithEvent.ts +10 -0
  310. package/src/runtime/index.ts +5 -0
  311. package/src/runtime/layout/closeFrame.ts +33 -0
  312. package/src/runtime/layout/closeFrames.ts +14 -0
  313. package/src/runtime/layout/createSplitDecoEdge.ts +34 -0
  314. package/src/runtime/layout/createSplitDecoFromDrag.ts +24 -0
  315. package/src/runtime/layout/debugFrame.ts +6 -0
  316. package/src/runtime/layout/findFramesTouchingEdge.ts +92 -0
  317. package/src/runtime/layout/findSafeSplitEdge.ts +39 -0
  318. package/src/runtime/layout/findVisualEdge.ts +11 -0
  319. package/src/runtime/layout/frameCreate.ts +23 -0
  320. package/src/runtime/layout/frameSplit.ts +31 -0
  321. package/src/runtime/layout/getCloseFrameInfo.ts +193 -0
  322. package/src/runtime/layout/getFrameSplitInfo.ts +65 -0
  323. package/src/runtime/layout/getFrameTo.ts +65 -0
  324. package/src/runtime/layout/index.ts +24 -0
  325. package/src/runtime/layout/isPointInFrame.ts +7 -0
  326. package/src/runtime/layout/layoutAddWindow.ts +6 -0
  327. package/src/runtime/layout/layoutCreate.ts +12 -0
  328. package/src/runtime/layout/layoutRemoveWindow.ts +7 -0
  329. package/src/runtime/layout/resizeFrame.ts +106 -0
  330. package/src/runtime/layout/windowAddFrame.ts +10 -0
  331. package/src/runtime/layout/windowCreate.ts +18 -0
  332. package/src/runtime/layout/windowRemoveFrame.ts +7 -0
  333. package/src/runtime/layout/windowSetActiveFrame.ts +7 -0
  334. package/src/runtime/settings.ts +63 -0
  335. package/src/runtime/types/index.ts +293 -0
  336. package/src/runtime/utils/KnownError.ts +24 -0
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <LayoutShapeSquare
3
+ v-if="activeFrame"
4
+ :css="getShapeSquareCss(activeFrame, `var(--layoutEdgeWidth,2px)`)"
5
+ :class="twMerge(
6
+ `
7
+ active-frame-edge
8
+ pointer-events-none
9
+ z-0
10
+ border-blue-500
11
+ border
12
+ `
13
+ )"
14
+ />
15
+
16
+ <template
17
+ v-for="css, i of cssDragEdges"
18
+ :key="i"
19
+ >
20
+ <LayoutShapeSquare
21
+ :css="css.thick"
22
+ :class="twMerge(`
23
+ drag-edge
24
+ z-20
25
+ hover:cursor-pointer
26
+ [&:hover+.edge]:bg-blue-500/50
27
+ `)"
28
+ @pointerdown="emit('dragStart', $event, { edge: edges[i] })"
29
+ />
30
+ <LayoutShapeSquare
31
+ :css="css.thin"
32
+ :class="twMerge(`
33
+ pointer-events-none
34
+ edge
35
+ `)"
36
+ />
37
+ </template>
38
+ <LayoutShapeSquare
39
+ :css="css"
40
+ :class="twMerge(`
41
+ grabbed-edge
42
+ z-20
43
+ bg-blue-500/50
44
+ cursor-pointer
45
+ `)"
46
+ v-for="css, i of cssDragEdge"
47
+ :key="i"
48
+ />
49
+ <template v-for="css, i of cssDragIntersections" :key="i">
50
+ <LayoutShapeSquare
51
+ :css="css.thick"
52
+ :class="twMerge(
53
+ `
54
+ drag-intersection
55
+ z-30
56
+ rounded-full
57
+ hover:cursor-pointer
58
+ [&:hover+.intersection]:bg-blue-500/50
59
+ `
60
+ )"
61
+ @pointerdown="emit('dragStart', $event, { intersection: wantedIntersections[i] })"
62
+ />
63
+ <LayoutShapeSquare
64
+ :css="css.thin"
65
+ :class="twMerge(
66
+ `
67
+ intersection
68
+ z-30
69
+ rounded-full
70
+ pointer-events-none
71
+ `,
72
+ css.thin._shifted && `w-[7px] h-[7px]`
73
+ )"
74
+ />
75
+ </template>
76
+ </template>
77
+
78
+ <script setup>
79
+ import { twMerge } from "@witchcraft/ui/utils/twMerge";
80
+ import { computed, ref, useAttrs } from "vue";
81
+ import LayoutShapeSquare from "./LayoutShapeSquare.vue";
82
+ import { frameToEdges } from "../helpers/frameToEdges.js";
83
+ import { getIntersectionsCss } from "../helpers/getIntersectionsCss.js";
84
+ import { getShapeSquareCss } from "../helpers/getShapeSquareCss.js";
85
+ import { getVisualEdgesCss } from "../helpers/getVisualEdgesCss.js";
86
+ import { isEdgeEqual } from "../helpers/isEdgeEqual.js";
87
+ import { toWindowCoord } from "../helpers/toWindowCoord.js";
88
+ import {
89
+ } from "../types/index.js";
90
+ const $attrs = useAttrs();
91
+ const emit = defineEmits(["dragStart"]);
92
+ const props = defineProps({
93
+ edges: { type: Array, required: true },
94
+ intersections: { type: Array, required: true },
95
+ win: { type: Object, required: true },
96
+ activeFrame: { type: Object, required: false, default: void 0 },
97
+ draggingEdge: { type: null, required: false, default: void 0 },
98
+ draggingIntersection: { type: Object, required: false, default: void 0 }
99
+ });
100
+ const activeFrameCssEdges = computed(() => {
101
+ if (!props.activeFrame) return [];
102
+ return getVisualEdgesCss(Object.values(frameToEdges(props.activeFrame)), {
103
+ edgeWidth: `var(--layoutEdgeWidth, 2px)`
104
+ });
105
+ });
106
+ const cssDragEdges = computed(() => {
107
+ const thickEdges = getVisualEdgesCss(
108
+ props.draggingEdge ? props.edges.filter((_) => !isEdgeEqual(props.draggingEdge, _)) : props.edges,
109
+ {
110
+ edgeWidth: `var(--layoutHandleWidth, 8px)`,
111
+ padLongAxis: `var(--layoutEdgeWidth, 2px)`
112
+ }
113
+ );
114
+ const thinEdges = getVisualEdgesCss(props.edges, {
115
+ edgeWidth: `var(--layoutEdgeWidth, 2px)`,
116
+ padLongAxis: `(var(--layoutEdgeWidth, 2px) + var(--layoutExtraDragEdgePadding, 0px))`
117
+ });
118
+ const edges = [];
119
+ for (let i = 0; i < thickEdges.length; i++) {
120
+ edges.push({ thin: thinEdges[i], thick: thickEdges[i] });
121
+ }
122
+ return edges;
123
+ });
124
+ const cssDragEdge = computed(() => {
125
+ if (!props.draggingEdge) return [];
126
+ return getVisualEdgesCss([props.draggingEdge], {
127
+ edgeWidth: `var(--layoutEdgeWidth, 2px)`,
128
+ padLongAxis: `(var(--layoutEdgeWidth, 2px) + var(--layoutExtraDragEdgePadding, 0px))`
129
+ });
130
+ });
131
+ const wantedIntersections = computed(
132
+ () => props.intersections.filter((_) => !_.isWindowEdge && (_.count === 4 || _.count === 1 && _.sharesEdge))
133
+ );
134
+ const cssDragIntersections = computed(() => {
135
+ const intersections = [];
136
+ const thick = getIntersectionsCss(wantedIntersections.value, {
137
+ intersectionWidth: `var(--layoutIntersectionWidth, 15px)`
138
+ });
139
+ const thin = getIntersectionsCss(wantedIntersections.value, {});
140
+ for (let i = 0; i < thick.length; i++) {
141
+ intersections.push({ thick: thick[i], thin: thin[i] });
142
+ }
143
+ return intersections;
144
+ });
145
+ </script>
File without changes
File without changes
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <!-- @vue-expect-error just let it inherit extra attrs -->
3
+ <!-- overflow-hidden is just in case, if the frame's css is not properly set to h-full, overflow-auto, or the border/padding are too large, we can still get overflows -->
4
+ <LayoutShapeSquare
5
+ tabindex="0"
6
+ :css="getShapeSquareCss(frame)"
7
+ :class="twMerge(
8
+ `
9
+ frame
10
+ p-[var(--layoutEdgeWidth,_2px)]
11
+ overflow-hidden
12
+ `,
13
+ $attrs.class
14
+ )"
15
+ v-bind="{ ...$attrs, class: void 0 }"
16
+ @focus="emit('focus')"
17
+ >
18
+ <slot>
19
+ <div class="p-2 text-xs bg-neutral-500">
20
+ {{ debugFrame(frame) }}
21
+ </div>
22
+ <div>No slot found for `frame-{{ frame.id }}`. </div>
23
+ </slot>
24
+ </LayoutShapeSquare>
25
+ </template>
26
+
27
+ <script setup>
28
+ import { twMerge } from "@witchcraft/ui/utils/twMerge";
29
+ import {} from "vue";
30
+ import { useAttrs } from "vue";
31
+ const $attrs = useAttrs();
32
+ import LayoutShapeSquare from "./LayoutShapeSquare.vue";
33
+ import { getShapeSquareCss } from "../helpers/getShapeSquareCss";
34
+ import { debugFrame } from "../layout/debugFrame.js";
35
+ import {} from "../types/index.js";
36
+ const emit = defineEmits(["focus"]);
37
+ defineProps({
38
+ frame: { type: Object, required: true },
39
+ isActiveFrame: { type: Boolean, required: true }
40
+ });
41
+ </script>
File without changes
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div
3
+ :style="`
4
+ --posX:${css.x};
5
+ --posY:${css.y};
6
+ --width:${css.width};
7
+ --height:${css.height};
8
+ ${css.translate ? `--translate:${css.translate}` : ``}
9
+ ` + style"
10
+ :class="twMerge(
11
+ `
12
+ absolute
13
+ w-[var(--width)]
14
+ h-[var(--height)]
15
+ top-[var(--posY)]
16
+ left-[var(--posX)]
17
+ `,
18
+ css.translate && `[transform:var(--translate)]`,
19
+ $attrs.class
20
+ )"
21
+ v-bind="{ ...$attrs, class: void 0 }"
22
+ >
23
+ <slot/>
24
+ </div>
25
+ </template>
26
+
27
+ <script setup>
28
+ import { twMerge } from "@witchcraft/ui/utils/twMerge";
29
+ import {} from "vue";
30
+ import { useAttrs } from "vue";
31
+ const $attrs = useAttrs();
32
+ const props = defineProps({
33
+ style: { type: String, required: false, default: "" },
34
+ css: { type: Object, required: true }
35
+ });
36
+ </script>
File without changes
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <!-- overflow hidden is because the borders inside will make it overflow -->
3
+ <div :class="twMerge(
4
+ `window
5
+ relative
6
+ overflow-hidden
7
+ `,
8
+ isDragging && `dragging cursor-pointer`,
9
+ requestType && `request-${requestType}`,
10
+ $attrs.attrs.class
11
+ )"
12
+ ref="windowEl"
13
+ v-bind="{ ...$attrs.attrs, class: void 0 }"
14
+ >
15
+ <template v-if="windowEl && win">
16
+ <LayoutFrameComponent :frame="frame"
17
+ :is-active-frame="frame.id === win.activeFrame"
18
+ v-for="frame of frames"
19
+ :key="frame.id"
20
+ v-bind="$attrs.frameAttrs"
21
+ @focus="windowSetActiveFrame(win, frame.id)"
22
+ >
23
+ <slot :name="`frame-${frame.id}`" v-bind="{ frame }"/>
24
+ </LayoutFrameComponent>
25
+ <LayoutEdgesComponent
26
+ :win="win"
27
+ :active-frame="win.activeFrame ? frames[win.activeFrame] : void 0"
28
+ :edges="visualEdges"
29
+ :intersections="intersections"
30
+ :dragging-edge="draggingEdges.length === 1 ? draggingEdges[0] : void 0"
31
+ :dragging-intersection="draggingIntersection"
32
+ v-bind="$attrs.edgesAttrs"
33
+ @drag-start="dragStart"
34
+ />
35
+ <LayoutDecosComponent
36
+ :frames="frames"
37
+ :split-decos="splitDecos"
38
+ :close-decos="closeDecos"
39
+ v-bind="$attrs.decosAttrs"
40
+ />
41
+ <slot name="extra-decos"/>
42
+ </template>
43
+ <Teleport v-if="instructionsTeleportTo && filteredUsageInstructions.length > 0" defer :to="instructionsTeleportTo">
44
+ <span aria-live="polite">
45
+ <span
46
+ class="
47
+ after:content-['┃']
48
+ after:text-accent-500
49
+ last:after:content-none
50
+ after:mx-1
51
+ after:text-gray-500
52
+ "
53
+ v-for="instruction of filteredUsageInstructions"
54
+ :key="instruction"
55
+ >
56
+ {{ instruction }}
57
+ </span>
58
+ </span>
59
+ </Teleport>
60
+ </div>
61
+ </template>
62
+
63
+ <script setup>
64
+ import { useDivideAttrs } from "@witchcraft/ui/composables/useDivideAttrs";
65
+ import { useGlobalResizeObserver } from "@witchcraft/ui/composables/useGlobalResizeObserver";
66
+ import { twMerge } from "@witchcraft/ui/utils/twMerge";
67
+ import { computed, ref, watch } from "vue";
68
+ import LayoutDecosComponent from "./LayoutDecos.vue";
69
+ import LayoutEdgesComponent from "./LayoutEdges.vue";
70
+ import LayoutFrameComponent from "./LayoutFrame.vue";
71
+ import { useFrames } from "../composables/useFrames.js";
72
+ import { CloseAction } from "../drag/CloseAction";
73
+ import { DragActionHandler } from "../drag/DragActionHandler";
74
+ import { SplitAction } from "../drag/SplitAction.js";
75
+ import {} from "../drag/types.js";
76
+ import { updateWindowWithEvent } from "../helpers/updateWindowSizeWithEvent.js";
77
+ import { windowSetActiveFrame } from "../layout/windowSetActiveFrame.js";
78
+ import {} from "../types/index.js";
79
+ const $attrs = useDivideAttrs(["frame", "edges", "decos"]);
80
+ const win = defineModel("win", { type: Object, ...{ required: true } });
81
+ const props = defineProps({
82
+ additionalDragActions: { type: Array, required: false, default: () => [] },
83
+ splitKeyHandler: { type: Function, required: false, default: void 0 },
84
+ closeKeyHandler: { type: Function, required: false, default: void 0 },
85
+ usageInstructions: { type: Object, required: false, default: () => ({}) },
86
+ instructionsTeleportTo: { type: null, required: true },
87
+ allowWindowSizeUpdate: { type: Boolean, required: false, default: true }
88
+ });
89
+ const emit = defineEmits(["isShowingDrag", "dragState"]);
90
+ const filteredUsageInstructions = computed(() => Object.values(props.usageInstructions).filter((_) => _ !== void 0).map((_) => _));
91
+ const splitKeyHandler = props.splitKeyHandler ?? ((e, state2) => e.altKey || state2.isDraggingFromWindowEdge);
92
+ const closeKeyHandler = props.closeKeyHandler ?? ((e) => {
93
+ if (e.ctrlKey && e.shiftKey) {
94
+ return "force";
95
+ }
96
+ if (e.shiftKey) return true;
97
+ return false;
98
+ });
99
+ const windowEl = ref(null);
100
+ const showDragging = ref(true);
101
+ const closeDecos = ref([]);
102
+ const splitDecos = ref([]);
103
+ const requestType = ref();
104
+ const dragActionHandler = new DragActionHandler(
105
+ (type, _e, state2) => type === "move" ? !state2.isDraggingFromWindowEdge : void 0,
106
+ [
107
+ new SplitAction(
108
+ splitKeyHandler,
109
+ ((decos) => splitDecos.value = decos),
110
+ {
111
+ onStart: () => showDragging.value = false,
112
+ onCancel: () => showDragging.value = true
113
+ }
114
+ ),
115
+ new CloseAction(
116
+ closeKeyHandler,
117
+ ((decos) => closeDecos.value = decos)
118
+ ),
119
+ ...props.additionalDragActions
120
+ ],
121
+ {
122
+ onEvent: (e, cancel) => {
123
+ showDragging.value = true;
124
+ if (e instanceof KeyboardEvent && e.key === "Escape") {
125
+ cancel();
126
+ }
127
+ },
128
+ onRequestChange: (type) => {
129
+ requestType.value = type;
130
+ },
131
+ onEnd: () => {
132
+ requestType.value = void 0;
133
+ showDragging.value = true;
134
+ }
135
+ }
136
+ );
137
+ const {
138
+ dragStart,
139
+ visualEdges,
140
+ isDragging,
141
+ draggingEdges,
142
+ draggingIntersection,
143
+ frames,
144
+ intersections,
145
+ state
146
+ } = useFrames(
147
+ win,
148
+ showDragging,
149
+ dragActionHandler
150
+ );
151
+ function getWindowOffset() {
152
+ const windowElRect = windowEl.value.getBoundingClientRect();
153
+ return {
154
+ pxX: Math.floor(windowElRect.x),
155
+ pxY: Math.floor(windowElRect.y)
156
+ };
157
+ }
158
+ function getWindowSize() {
159
+ const windowElRect = windowEl.value.getBoundingClientRect();
160
+ return {
161
+ pxWidth: Math.floor(windowElRect.width),
162
+ pxHeight: Math.floor(windowElRect.height)
163
+ };
164
+ }
165
+ function updateWindowSize() {
166
+ if (!props.allowWindowSizeUpdate) return;
167
+ const newSize = { ...getWindowSize(), ...getWindowOffset() };
168
+ updateWindowWithEvent(win.value, newSize);
169
+ }
170
+ useGlobalResizeObserver(windowEl, updateWindowSize);
171
+ watch(() => props.allowWindowSizeUpdate, (newval, oldval) => {
172
+ if (oldval === false && newval === true) {
173
+ updateWindowSize();
174
+ }
175
+ });
176
+ watch(state, () => emit("dragState", state.value));
177
+ watch(showDragging, () => emit("isShowingDrag", showDragging.value));
178
+ defineExpose({
179
+ state,
180
+ win,
181
+ updateWindowSize
182
+ });
183
+ </script>
File without changes
File without changes
@@ -0,0 +1,184 @@
1
+ import { debounce } from "@alanscodelog/utils/debounce";
2
+ import { keys } from "@alanscodelog/utils/keys";
3
+ import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from "vue";
4
+ import { DragDirectionStore } from "../drag/DragDirectionStore.js";
5
+ import { cloneFrame } from "../helpers/cloneFrame.js";
6
+ import { getIntersections } from "../helpers/getIntersections.js";
7
+ import { getVisualEdges } from "../helpers/getVisualEdges.js";
8
+ import { isWindowEdge } from "../helpers/isWindowEdge.js";
9
+ import { moveEdge } from "../helpers/moveEdge.js";
10
+ import { toWindowCoord } from "../helpers/toWindowCoord.js";
11
+ import { findFramesTouchingEdge } from "../layout/findFramesTouchingEdge.js";
12
+ import { isPointInFrame } from "../layout/isPointInFrame.js";
13
+ export function useFrames(win, showDragging, handler) {
14
+ const draggingEdges = ref([]);
15
+ const touchingFrames = ref([]);
16
+ const allTouchingFrames = computed(() => {
17
+ const result = {};
18
+ for (const entry of touchingFrames.value) {
19
+ for (const frame of Object.values(entry)) {
20
+ result[frame.id] = frame;
21
+ }
22
+ }
23
+ return result;
24
+ });
25
+ const touchingFramesArrays = computed(() => touchingFrames.value.map((entry) => Object.values(entry)));
26
+ const isDragging = ref(false);
27
+ const dragPoint = ref();
28
+ const dragDirections = ref({});
29
+ const draggingIntersection = ref(void 0);
30
+ const isDraggingFromWindowEdge = ref(false);
31
+ const frames = computed(
32
+ () => isDragging.value && showDragging.value ? { ...win.value.frames, ...allTouchingFrames.value } : win.value.frames
33
+ );
34
+ const dragHoveredFrame = computed(() => {
35
+ if (isDragging.value) {
36
+ for (const id of keys(frames.value)) {
37
+ if (isPointInFrame(frames.value[id], dragPoint.value)) {
38
+ return frames.value[id];
39
+ }
40
+ }
41
+ }
42
+ return void 0;
43
+ });
44
+ const visualEdges = ref([]);
45
+ const intersections = computed(() => getIntersections(visualEdges.value));
46
+ const debounceGetDraggableEdges = debounce((f) => {
47
+ visualEdges.value = getVisualEdges(f, { includeWindowEdges: true });
48
+ }, 50, {});
49
+ watchEffect(() => {
50
+ if (isDragging.value) return;
51
+ debounceGetDraggableEdges(Object.values(frames.value));
52
+ });
53
+ function forceRecalculateEdges() {
54
+ visualEdges.value = getVisualEdges(Object.values(frames.value), { includeWindowEdges: true });
55
+ }
56
+ const dragDirStore = new DragDirectionStore({
57
+ onUpdate: (dir) => dragDirections.value = dir
58
+ });
59
+ const state = computed(() => ({
60
+ dragDirections: dragDirections.value,
61
+ dragPoint: dragPoint.value,
62
+ isDragging: isDragging.value,
63
+ draggingEdges: draggingEdges.value,
64
+ draggingIntersection: draggingIntersection.value,
65
+ visualEdges: visualEdges.value,
66
+ touchingFrames: touchingFrames.value,
67
+ touchingFramesArrays: touchingFramesArrays.value,
68
+ frames: frames.value,
69
+ dragHoveredFrame: dragHoveredFrame.value,
70
+ intersections: intersections.value,
71
+ isDraggingFromWindowEdge: isDraggingFromWindowEdge.value,
72
+ win: win.value
73
+ }));
74
+ let controller;
75
+ function resetState() {
76
+ draggingEdges.value = [];
77
+ draggingIntersection.value = void 0;
78
+ isDragging.value = false;
79
+ dragPoint.value = void 0;
80
+ touchingFrames.value = [];
81
+ dragDirStore.reset();
82
+ forceRecalculateEdges();
83
+ }
84
+ function dragStart(e, { edge, intersection }) {
85
+ controller = new AbortController();
86
+ controller.signal.addEventListener("abort", () => resetState());
87
+ e.preventDefault();
88
+ window.addEventListener("pointermove", dragMove, { signal: controller.signal });
89
+ window.addEventListener("pointerup", dragEnd, { signal: controller.signal });
90
+ const point = toWindowCoord(win.value, e);
91
+ dragPoint.value = point;
92
+ isDragging.value = true;
93
+ draggingIntersection.value = intersection;
94
+ draggingEdges.value = edge ? [edge] : [
95
+ ...draggingIntersection.value?.sharedEdges.horizontal ?? [],
96
+ ...draggingIntersection.value?.sharedEdges.vertical ?? []
97
+ ];
98
+ dragDirStore.update(point);
99
+ isDraggingFromWindowEdge.value = draggingEdges.value.some((_) => isWindowEdge(_));
100
+ const framesArray = Object.values(win.value.frames);
101
+ touchingFrames.value = [];
102
+ const clones = /* @__PURE__ */ new Map();
103
+ for (let i = 0; i < draggingEdges.value.length; i++) {
104
+ const draggingEdge = draggingEdges.value[i];
105
+ touchingFrames.value[i] = {};
106
+ for (const { frame } of findFramesTouchingEdge(draggingEdge, framesArray)) {
107
+ if (!clones.has(frame.id)) {
108
+ const clone = cloneFrame(frame);
109
+ touchingFrames.value[i][frame.id] = clone;
110
+ clones.set(frame.id, clone);
111
+ } else {
112
+ touchingFrames.value[i][frame.id] = clones.get(frame.id);
113
+ }
114
+ }
115
+ }
116
+ handler.onDragChange("start", e, state.value, forceRecalculateEdges, cancel);
117
+ }
118
+ function dragMove(e) {
119
+ e.preventDefault();
120
+ const point = toWindowCoord(win.value, e);
121
+ const didChange = dragDirStore.update(point);
122
+ dragPoint.value = point;
123
+ if (!didChange) return;
124
+ const allowed = handler.onDragChange("move", e, state.value, forceRecalculateEdges, cancel);
125
+ if (!allowed) return;
126
+ requestAnimationFrame(() => {
127
+ for (let i = 0; i < draggingEdges.value.length; i++) {
128
+ const draggingEdge = draggingEdges.value[i];
129
+ if (draggingEdge) {
130
+ moveEdge(touchingFramesArrays.value[i], draggingEdge, point);
131
+ }
132
+ }
133
+ forceRecalculateEdges();
134
+ });
135
+ }
136
+ function dragEnd(e, { apply = true } = {}) {
137
+ if (e) {
138
+ const point = toWindowCoord(win.value, e);
139
+ dragPoint.value = point;
140
+ }
141
+ const doApply = apply && handler.onDragApply(state.value, forceRecalculateEdges);
142
+ if (doApply) {
143
+ for (const frame of touchingFramesArrays.value.flat()) {
144
+ win.value.frames[frame.id] = frame;
145
+ }
146
+ }
147
+ handler.onDragChange("end", e, state.value, forceRecalculateEdges, cancel);
148
+ controller?.abort();
149
+ }
150
+ function cancel() {
151
+ dragEnd(void 0, { apply: false });
152
+ }
153
+ const keydownController = new AbortController();
154
+ const wrappedKeydownHandler = (e) => {
155
+ handler.eventHandler(e, state.value, forceRecalculateEdges);
156
+ };
157
+ onMounted(() => {
158
+ window.addEventListener("keydown", wrappedKeydownHandler, { signal: keydownController.signal });
159
+ window.addEventListener("keyup", wrappedKeydownHandler, { signal: keydownController.signal });
160
+ });
161
+ onBeforeUnmount(() => {
162
+ controller?.abort();
163
+ keydownController?.abort();
164
+ });
165
+ return {
166
+ dragStart,
167
+ dragEnd,
168
+ cancel,
169
+ dragDirections,
170
+ dragPoint,
171
+ isDragging,
172
+ draggingEdges,
173
+ draggingIntersection,
174
+ visualEdges,
175
+ touchingFrames,
176
+ touchingFramesArrays,
177
+ frames,
178
+ dragHoveredFrame,
179
+ intersections,
180
+ isDraggingFromWindowEdge,
181
+ forceRecalculateEdges,
182
+ state
183
+ };
184
+ }
File without changes