@vuu-ui/vuu-utils 2.1.18 → 2.1.19-beta.1

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 (350) hide show
  1. package/package.json +10 -12
  2. package/types/ThemeProvider.d.ts +4 -4
  3. package/types/data-utils.d.ts +1 -1
  4. package/types/date/date-utils.d.ts +8 -8
  5. package/types/feature-utils.d.ts +1 -1
  6. package/types/filters/filter-utils.d.ts +15 -15
  7. package/cjs/node_modules/@dnd-kit/abstract/index.js +0 -1488
  8. package/cjs/node_modules/@dnd-kit/abstract/index.js.map +0 -1
  9. package/cjs/node_modules/@dnd-kit/abstract/modifiers.js +0 -85
  10. package/cjs/node_modules/@dnd-kit/abstract/modifiers.js.map +0 -1
  11. package/cjs/node_modules/@dnd-kit/collision/dist/index.js +0 -91
  12. package/cjs/node_modules/@dnd-kit/collision/dist/index.js.map +0 -1
  13. package/cjs/node_modules/@dnd-kit/dom/index.js +0 -1991
  14. package/cjs/node_modules/@dnd-kit/dom/index.js.map +0 -1
  15. package/cjs/node_modules/@dnd-kit/dom/sortable.js +0 -828
  16. package/cjs/node_modules/@dnd-kit/dom/sortable.js.map +0 -1
  17. package/cjs/node_modules/@dnd-kit/dom/utilities.js +0 -1389
  18. package/cjs/node_modules/@dnd-kit/dom/utilities.js.map +0 -1
  19. package/cjs/node_modules/@dnd-kit/geometry/dist/index.js +0 -310
  20. package/cjs/node_modules/@dnd-kit/geometry/dist/index.js.map +0 -1
  21. package/cjs/node_modules/@dnd-kit/react/hooks.js +0 -134
  22. package/cjs/node_modules/@dnd-kit/react/hooks.js.map +0 -1
  23. package/cjs/node_modules/@dnd-kit/react/index.js +0 -398
  24. package/cjs/node_modules/@dnd-kit/react/index.js.map +0 -1
  25. package/cjs/node_modules/@dnd-kit/react/sortable.js +0 -177
  26. package/cjs/node_modules/@dnd-kit/react/sortable.js.map +0 -1
  27. package/cjs/node_modules/@dnd-kit/react/utilities.js +0 -19
  28. package/cjs/node_modules/@dnd-kit/react/utilities.js.map +0 -1
  29. package/cjs/node_modules/@dnd-kit/state/dist/index.js +0 -280
  30. package/cjs/node_modules/@dnd-kit/state/dist/index.js.map +0 -1
  31. package/cjs/node_modules/@preact/signals-core/dist/signals-core.js +0 -11
  32. package/cjs/node_modules/@preact/signals-core/dist/signals-core.js.map +0 -1
  33. package/cjs/packages/vuu-utils/src/Clock.js +0 -62
  34. package/cjs/packages/vuu-utils/src/Clock.js.map +0 -1
  35. package/cjs/packages/vuu-utils/src/PageVisibilityObserver.js +0 -80
  36. package/cjs/packages/vuu-utils/src/PageVisibilityObserver.js.map +0 -1
  37. package/cjs/packages/vuu-utils/src/ScaledDecimal.js +0 -43
  38. package/cjs/packages/vuu-utils/src/ScaledDecimal.js.map +0 -1
  39. package/cjs/packages/vuu-utils/src/ShellContext.js +0 -13
  40. package/cjs/packages/vuu-utils/src/ShellContext.js.map +0 -1
  41. package/cjs/packages/vuu-utils/src/ThemeProvider.js +0 -85
  42. package/cjs/packages/vuu-utils/src/ThemeProvider.js.map +0 -1
  43. package/cjs/packages/vuu-utils/src/array-utils.js +0 -87
  44. package/cjs/packages/vuu-utils/src/array-utils.js.map +0 -1
  45. package/cjs/packages/vuu-utils/src/box-utils.js +0 -53
  46. package/cjs/packages/vuu-utils/src/box-utils.js.map +0 -1
  47. package/cjs/packages/vuu-utils/src/column-utils.js +0 -1057
  48. package/cjs/packages/vuu-utils/src/column-utils.js.map +0 -1
  49. package/cjs/packages/vuu-utils/src/common-types.js +0 -15
  50. package/cjs/packages/vuu-utils/src/common-types.js.map +0 -1
  51. package/cjs/packages/vuu-utils/src/component-registry.js +0 -144
  52. package/cjs/packages/vuu-utils/src/component-registry.js.map +0 -1
  53. package/cjs/packages/vuu-utils/src/context-definitions/DataContext.js +0 -21
  54. package/cjs/packages/vuu-utils/src/context-definitions/DataContext.js.map +0 -1
  55. package/cjs/packages/vuu-utils/src/context-definitions/DataProvider.js +0 -19
  56. package/cjs/packages/vuu-utils/src/context-definitions/DataProvider.js.map +0 -1
  57. package/cjs/packages/vuu-utils/src/context-definitions/DataSourceProvider.js +0 -33
  58. package/cjs/packages/vuu-utils/src/context-definitions/DataSourceProvider.js.map +0 -1
  59. package/cjs/packages/vuu-utils/src/context-definitions/WorkspaceContext.js +0 -20
  60. package/cjs/packages/vuu-utils/src/context-definitions/WorkspaceContext.js.map +0 -1
  61. package/cjs/packages/vuu-utils/src/cookie-utils.js +0 -22
  62. package/cjs/packages/vuu-utils/src/cookie-utils.js.map +0 -1
  63. package/cjs/packages/vuu-utils/src/css-utils.js +0 -9
  64. package/cjs/packages/vuu-utils/src/css-utils.js.map +0 -1
  65. package/cjs/packages/vuu-utils/src/data-editing/DataEditingProvider.js +0 -28
  66. package/cjs/packages/vuu-utils/src/data-editing/DataEditingProvider.js.map +0 -1
  67. package/cjs/packages/vuu-utils/src/data-editing/EditButtons.js +0 -34
  68. package/cjs/packages/vuu-utils/src/data-editing/EditButtons.js.map +0 -1
  69. package/cjs/packages/vuu-utils/src/data-editing/EditSession.js +0 -204
  70. package/cjs/packages/vuu-utils/src/data-editing/EditSession.js.map +0 -1
  71. package/cjs/packages/vuu-utils/src/data-editing/edit-utils.js +0 -37
  72. package/cjs/packages/vuu-utils/src/data-editing/edit-utils.js.map +0 -1
  73. package/cjs/packages/vuu-utils/src/data-editing/useEditableTable.js +0 -81
  74. package/cjs/packages/vuu-utils/src/data-editing/useEditableTable.js.map +0 -1
  75. package/cjs/packages/vuu-utils/src/data-utils.js +0 -96
  76. package/cjs/packages/vuu-utils/src/data-utils.js.map +0 -1
  77. package/cjs/packages/vuu-utils/src/datasource/BaseDataSource.js +0 -317
  78. package/cjs/packages/vuu-utils/src/datasource/BaseDataSource.js.map +0 -1
  79. package/cjs/packages/vuu-utils/src/datasource/datasource-action-utils.js +0 -14
  80. package/cjs/packages/vuu-utils/src/datasource/datasource-action-utils.js.map +0 -1
  81. package/cjs/packages/vuu-utils/src/datasource/datasource-filter-utils.js +0 -40
  82. package/cjs/packages/vuu-utils/src/datasource/datasource-filter-utils.js.map +0 -1
  83. package/cjs/packages/vuu-utils/src/datasource/datasource-utils.js +0 -218
  84. package/cjs/packages/vuu-utils/src/datasource/datasource-utils.js.map +0 -1
  85. package/cjs/packages/vuu-utils/src/date/date-utils.js +0 -131
  86. package/cjs/packages/vuu-utils/src/date/date-utils.js.map +0 -1
  87. package/cjs/packages/vuu-utils/src/date/dateTimePattern.js +0 -26
  88. package/cjs/packages/vuu-utils/src/date/dateTimePattern.js.map +0 -1
  89. package/cjs/packages/vuu-utils/src/date/formatter.js +0 -82
  90. package/cjs/packages/vuu-utils/src/date/formatter.js.map +0 -1
  91. package/cjs/packages/vuu-utils/src/date/types.js +0 -32
  92. package/cjs/packages/vuu-utils/src/date/types.js.map +0 -1
  93. package/cjs/packages/vuu-utils/src/debug-utils.js +0 -34
  94. package/cjs/packages/vuu-utils/src/debug-utils.js.map +0 -1
  95. package/cjs/packages/vuu-utils/src/event-emitter.js +0 -113
  96. package/cjs/packages/vuu-utils/src/event-emitter.js.map +0 -1
  97. package/cjs/packages/vuu-utils/src/feature-utils.js +0 -139
  98. package/cjs/packages/vuu-utils/src/feature-utils.js.map +0 -1
  99. package/cjs/packages/vuu-utils/src/filters/filter-utils.js +0 -182
  100. package/cjs/packages/vuu-utils/src/filters/filter-utils.js.map +0 -1
  101. package/cjs/packages/vuu-utils/src/filters/filterAsQuery.js +0 -69
  102. package/cjs/packages/vuu-utils/src/filters/filterAsQuery.js.map +0 -1
  103. package/cjs/packages/vuu-utils/src/form-utils.js +0 -117
  104. package/cjs/packages/vuu-utils/src/form-utils.js.map +0 -1
  105. package/cjs/packages/vuu-utils/src/formatting-utils.js +0 -98
  106. package/cjs/packages/vuu-utils/src/formatting-utils.js.map +0 -1
  107. package/cjs/packages/vuu-utils/src/getUniqueId.js +0 -6
  108. package/cjs/packages/vuu-utils/src/getUniqueId.js.map +0 -1
  109. package/cjs/packages/vuu-utils/src/group-utils.js +0 -27
  110. package/cjs/packages/vuu-utils/src/group-utils.js.map +0 -1
  111. package/cjs/packages/vuu-utils/src/html-utils.js +0 -162
  112. package/cjs/packages/vuu-utils/src/html-utils.js.map +0 -1
  113. package/cjs/packages/vuu-utils/src/index.js +0 -475
  114. package/cjs/packages/vuu-utils/src/index.js.map +0 -1
  115. package/cjs/packages/vuu-utils/src/input-utils.js +0 -10
  116. package/cjs/packages/vuu-utils/src/input-utils.js.map +0 -1
  117. package/cjs/packages/vuu-utils/src/invariant.js +0 -13
  118. package/cjs/packages/vuu-utils/src/invariant.js.map +0 -1
  119. package/cjs/packages/vuu-utils/src/itemToString.js +0 -23
  120. package/cjs/packages/vuu-utils/src/itemToString.js.map +0 -1
  121. package/cjs/packages/vuu-utils/src/json-utils.js +0 -105
  122. package/cjs/packages/vuu-utils/src/json-utils.js.map +0 -1
  123. package/cjs/packages/vuu-utils/src/keyboard-utils.js +0 -30
  124. package/cjs/packages/vuu-utils/src/keyboard-utils.js.map +0 -1
  125. package/cjs/packages/vuu-utils/src/keyset.js +0 -72
  126. package/cjs/packages/vuu-utils/src/keyset.js.map +0 -1
  127. package/cjs/packages/vuu-utils/src/list-utils.js +0 -11
  128. package/cjs/packages/vuu-utils/src/list-utils.js.map +0 -1
  129. package/cjs/packages/vuu-utils/src/local-storage-utils.js +0 -35
  130. package/cjs/packages/vuu-utils/src/local-storage-utils.js.map +0 -1
  131. package/cjs/packages/vuu-utils/src/logging-utils.js +0 -65
  132. package/cjs/packages/vuu-utils/src/logging-utils.js.map +0 -1
  133. package/cjs/packages/vuu-utils/src/module-utils.js +0 -6
  134. package/cjs/packages/vuu-utils/src/module-utils.js.map +0 -1
  135. package/cjs/packages/vuu-utils/src/nanoid/index.js +0 -22
  136. package/cjs/packages/vuu-utils/src/nanoid/index.js.map +0 -1
  137. package/cjs/packages/vuu-utils/src/perf-utils.js +0 -35
  138. package/cjs/packages/vuu-utils/src/perf-utils.js.map +0 -1
  139. package/cjs/packages/vuu-utils/src/promise-utils.js +0 -42
  140. package/cjs/packages/vuu-utils/src/promise-utils.js.map +0 -1
  141. package/cjs/packages/vuu-utils/src/protocol-message-utils.js +0 -104
  142. package/cjs/packages/vuu-utils/src/protocol-message-utils.js.map +0 -1
  143. package/cjs/packages/vuu-utils/src/range-utils.js +0 -115
  144. package/cjs/packages/vuu-utils/src/range-utils.js.map +0 -1
  145. package/cjs/packages/vuu-utils/src/react-utils.js +0 -72
  146. package/cjs/packages/vuu-utils/src/react-utils.js.map +0 -1
  147. package/cjs/packages/vuu-utils/src/round-decimal.js +0 -131
  148. package/cjs/packages/vuu-utils/src/round-decimal.js.map +0 -1
  149. package/cjs/packages/vuu-utils/src/row-utils.js +0 -59
  150. package/cjs/packages/vuu-utils/src/row-utils.js.map +0 -1
  151. package/cjs/packages/vuu-utils/src/selection-utils.js +0 -34
  152. package/cjs/packages/vuu-utils/src/selection-utils.js.map +0 -1
  153. package/cjs/packages/vuu-utils/src/shell-layout-types.js +0 -13
  154. package/cjs/packages/vuu-utils/src/shell-layout-types.js.map +0 -1
  155. package/cjs/packages/vuu-utils/src/sort-utils.js +0 -78
  156. package/cjs/packages/vuu-utils/src/sort-utils.js.map +0 -1
  157. package/cjs/packages/vuu-utils/src/table-schema-utils.js +0 -13
  158. package/cjs/packages/vuu-utils/src/table-schema-utils.js.map +0 -1
  159. package/cjs/packages/vuu-utils/src/text-utils.js +0 -21
  160. package/cjs/packages/vuu-utils/src/text-utils.js.map +0 -1
  161. package/cjs/packages/vuu-utils/src/theme-utils.js +0 -36
  162. package/cjs/packages/vuu-utils/src/theme-utils.js.map +0 -1
  163. package/cjs/packages/vuu-utils/src/tree-utils.js +0 -114
  164. package/cjs/packages/vuu-utils/src/tree-utils.js.map +0 -1
  165. package/cjs/packages/vuu-utils/src/ts-utils.js +0 -12
  166. package/cjs/packages/vuu-utils/src/ts-utils.js.map +0 -1
  167. package/cjs/packages/vuu-utils/src/typeahead-utils.js +0 -6
  168. package/cjs/packages/vuu-utils/src/typeahead-utils.js.map +0 -1
  169. package/cjs/packages/vuu-utils/src/url-utils.js +0 -21
  170. package/cjs/packages/vuu-utils/src/url-utils.js.map +0 -1
  171. package/cjs/packages/vuu-utils/src/useId.js +0 -9
  172. package/cjs/packages/vuu-utils/src/useId.js.map +0 -1
  173. package/cjs/packages/vuu-utils/src/useLayoutEffectSkipFirst.js +0 -17
  174. package/cjs/packages/vuu-utils/src/useLayoutEffectSkipFirst.js.map +0 -1
  175. package/cjs/packages/vuu-utils/src/useResizeObserver.js +0 -134
  176. package/cjs/packages/vuu-utils/src/useResizeObserver.js.map +0 -1
  177. package/cjs/packages/vuu-utils/src/useStateRef.js +0 -23
  178. package/cjs/packages/vuu-utils/src/useStateRef.js.map +0 -1
  179. package/esm/node_modules/@dnd-kit/abstract/index.js +0 -1472
  180. package/esm/node_modules/@dnd-kit/abstract/index.js.map +0 -1
  181. package/esm/node_modules/@dnd-kit/abstract/modifiers.js +0 -82
  182. package/esm/node_modules/@dnd-kit/abstract/modifiers.js.map +0 -1
  183. package/esm/node_modules/@dnd-kit/collision/dist/index.js +0 -86
  184. package/esm/node_modules/@dnd-kit/collision/dist/index.js.map +0 -1
  185. package/esm/node_modules/@dnd-kit/dom/index.js +0 -1977
  186. package/esm/node_modules/@dnd-kit/dom/index.js.map +0 -1
  187. package/esm/node_modules/@dnd-kit/dom/sortable.js +0 -822
  188. package/esm/node_modules/@dnd-kit/dom/sortable.js.map +0 -1
  189. package/esm/node_modules/@dnd-kit/dom/utilities.js +0 -1344
  190. package/esm/node_modules/@dnd-kit/dom/utilities.js.map +0 -1
  191. package/esm/node_modules/@dnd-kit/geometry/dist/index.js +0 -303
  192. package/esm/node_modules/@dnd-kit/geometry/dist/index.js.map +0 -1
  193. package/esm/node_modules/@dnd-kit/react/hooks.js +0 -126
  194. package/esm/node_modules/@dnd-kit/react/hooks.js.map +0 -1
  195. package/esm/node_modules/@dnd-kit/react/index.js +0 -392
  196. package/esm/node_modules/@dnd-kit/react/index.js.map +0 -1
  197. package/esm/node_modules/@dnd-kit/react/sortable.js +0 -175
  198. package/esm/node_modules/@dnd-kit/react/sortable.js.map +0 -1
  199. package/esm/node_modules/@dnd-kit/react/utilities.js +0 -17
  200. package/esm/node_modules/@dnd-kit/react/utilities.js.map +0 -1
  201. package/esm/node_modules/@dnd-kit/state/dist/index.js +0 -266
  202. package/esm/node_modules/@dnd-kit/state/dist/index.js.map +0 -1
  203. package/esm/node_modules/@preact/signals-core/dist/signals-core.js +0 -4
  204. package/esm/node_modules/@preact/signals-core/dist/signals-core.js.map +0 -1
  205. package/esm/packages/vuu-utils/src/Clock.js +0 -60
  206. package/esm/packages/vuu-utils/src/Clock.js.map +0 -1
  207. package/esm/packages/vuu-utils/src/PageVisibilityObserver.js +0 -78
  208. package/esm/packages/vuu-utils/src/PageVisibilityObserver.js.map +0 -1
  209. package/esm/packages/vuu-utils/src/ScaledDecimal.js +0 -37
  210. package/esm/packages/vuu-utils/src/ScaledDecimal.js.map +0 -1
  211. package/esm/packages/vuu-utils/src/ShellContext.js +0 -10
  212. package/esm/packages/vuu-utils/src/ShellContext.js.map +0 -1
  213. package/esm/packages/vuu-utils/src/ThemeProvider.js +0 -78
  214. package/esm/packages/vuu-utils/src/ThemeProvider.js.map +0 -1
  215. package/esm/packages/vuu-utils/src/array-utils.js +0 -79
  216. package/esm/packages/vuu-utils/src/array-utils.js.map +0 -1
  217. package/esm/packages/vuu-utils/src/box-utils.js +0 -47
  218. package/esm/packages/vuu-utils/src/box-utils.js.map +0 -1
  219. package/esm/packages/vuu-utils/src/column-utils.js +0 -970
  220. package/esm/packages/vuu-utils/src/column-utils.js.map +0 -1
  221. package/esm/packages/vuu-utils/src/common-types.js +0 -13
  222. package/esm/packages/vuu-utils/src/common-types.js.map +0 -1
  223. package/esm/packages/vuu-utils/src/component-registry.js +0 -128
  224. package/esm/packages/vuu-utils/src/component-registry.js.map +0 -1
  225. package/esm/packages/vuu-utils/src/context-definitions/DataContext.js +0 -18
  226. package/esm/packages/vuu-utils/src/context-definitions/DataContext.js.map +0 -1
  227. package/esm/packages/vuu-utils/src/context-definitions/DataProvider.js +0 -16
  228. package/esm/packages/vuu-utils/src/context-definitions/DataProvider.js.map +0 -1
  229. package/esm/packages/vuu-utils/src/context-definitions/DataSourceProvider.js +0 -29
  230. package/esm/packages/vuu-utils/src/context-definitions/DataSourceProvider.js.map +0 -1
  231. package/esm/packages/vuu-utils/src/context-definitions/WorkspaceContext.js +0 -17
  232. package/esm/packages/vuu-utils/src/context-definitions/WorkspaceContext.js.map +0 -1
  233. package/esm/packages/vuu-utils/src/cookie-utils.js +0 -19
  234. package/esm/packages/vuu-utils/src/cookie-utils.js.map +0 -1
  235. package/esm/packages/vuu-utils/src/css-utils.js +0 -7
  236. package/esm/packages/vuu-utils/src/css-utils.js.map +0 -1
  237. package/esm/packages/vuu-utils/src/data-editing/DataEditingProvider.js +0 -25
  238. package/esm/packages/vuu-utils/src/data-editing/DataEditingProvider.js.map +0 -1
  239. package/esm/packages/vuu-utils/src/data-editing/EditButtons.js +0 -32
  240. package/esm/packages/vuu-utils/src/data-editing/EditButtons.js.map +0 -1
  241. package/esm/packages/vuu-utils/src/data-editing/EditSession.js +0 -201
  242. package/esm/packages/vuu-utils/src/data-editing/EditSession.js.map +0 -1
  243. package/esm/packages/vuu-utils/src/data-editing/edit-utils.js +0 -34
  244. package/esm/packages/vuu-utils/src/data-editing/edit-utils.js.map +0 -1
  245. package/esm/packages/vuu-utils/src/data-editing/useEditableTable.js +0 -79
  246. package/esm/packages/vuu-utils/src/data-editing/useEditableTable.js.map +0 -1
  247. package/esm/packages/vuu-utils/src/data-utils.js +0 -82
  248. package/esm/packages/vuu-utils/src/data-utils.js.map +0 -1
  249. package/esm/packages/vuu-utils/src/datasource/BaseDataSource.js +0 -314
  250. package/esm/packages/vuu-utils/src/datasource/BaseDataSource.js.map +0 -1
  251. package/esm/packages/vuu-utils/src/datasource/datasource-action-utils.js +0 -8
  252. package/esm/packages/vuu-utils/src/datasource/datasource-action-utils.js.map +0 -1
  253. package/esm/packages/vuu-utils/src/datasource/datasource-filter-utils.js +0 -38
  254. package/esm/packages/vuu-utils/src/datasource/datasource-filter-utils.js.map +0 -1
  255. package/esm/packages/vuu-utils/src/datasource/datasource-utils.js +0 -193
  256. package/esm/packages/vuu-utils/src/datasource/datasource-utils.js.map +0 -1
  257. package/esm/packages/vuu-utils/src/date/date-utils.js +0 -121
  258. package/esm/packages/vuu-utils/src/date/date-utils.js.map +0 -1
  259. package/esm/packages/vuu-utils/src/date/dateTimePattern.js +0 -22
  260. package/esm/packages/vuu-utils/src/date/dateTimePattern.js.map +0 -1
  261. package/esm/packages/vuu-utils/src/date/formatter.js +0 -79
  262. package/esm/packages/vuu-utils/src/date/formatter.js.map +0 -1
  263. package/esm/packages/vuu-utils/src/date/types.js +0 -26
  264. package/esm/packages/vuu-utils/src/date/types.js.map +0 -1
  265. package/esm/packages/vuu-utils/src/debug-utils.js +0 -32
  266. package/esm/packages/vuu-utils/src/debug-utils.js.map +0 -1
  267. package/esm/packages/vuu-utils/src/event-emitter.js +0 -111
  268. package/esm/packages/vuu-utils/src/event-emitter.js.map +0 -1
  269. package/esm/packages/vuu-utils/src/feature-utils.js +0 -125
  270. package/esm/packages/vuu-utils/src/feature-utils.js.map +0 -1
  271. package/esm/packages/vuu-utils/src/filters/filter-utils.js +0 -159
  272. package/esm/packages/vuu-utils/src/filters/filter-utils.js.map +0 -1
  273. package/esm/packages/vuu-utils/src/filters/filterAsQuery.js +0 -65
  274. package/esm/packages/vuu-utils/src/filters/filterAsQuery.js.map +0 -1
  275. package/esm/packages/vuu-utils/src/form-utils.js +0 -110
  276. package/esm/packages/vuu-utils/src/form-utils.js.map +0 -1
  277. package/esm/packages/vuu-utils/src/formatting-utils.js +0 -93
  278. package/esm/packages/vuu-utils/src/formatting-utils.js.map +0 -1
  279. package/esm/packages/vuu-utils/src/getUniqueId.js +0 -4
  280. package/esm/packages/vuu-utils/src/getUniqueId.js.map +0 -1
  281. package/esm/packages/vuu-utils/src/group-utils.js +0 -23
  282. package/esm/packages/vuu-utils/src/group-utils.js.map +0 -1
  283. package/esm/packages/vuu-utils/src/html-utils.js +0 -145
  284. package/esm/packages/vuu-utils/src/html-utils.js.map +0 -1
  285. package/esm/packages/vuu-utils/src/index.js +0 -77
  286. package/esm/packages/vuu-utils/src/index.js.map +0 -1
  287. package/esm/packages/vuu-utils/src/input-utils.js +0 -7
  288. package/esm/packages/vuu-utils/src/input-utils.js.map +0 -1
  289. package/esm/packages/vuu-utils/src/invariant.js +0 -11
  290. package/esm/packages/vuu-utils/src/invariant.js.map +0 -1
  291. package/esm/packages/vuu-utils/src/itemToString.js +0 -21
  292. package/esm/packages/vuu-utils/src/itemToString.js.map +0 -1
  293. package/esm/packages/vuu-utils/src/json-utils.js +0 -103
  294. package/esm/packages/vuu-utils/src/json-utils.js.map +0 -1
  295. package/esm/packages/vuu-utils/src/keyboard-utils.js +0 -16
  296. package/esm/packages/vuu-utils/src/keyboard-utils.js.map +0 -1
  297. package/esm/packages/vuu-utils/src/keyset.js +0 -70
  298. package/esm/packages/vuu-utils/src/keyset.js.map +0 -1
  299. package/esm/packages/vuu-utils/src/list-utils.js +0 -9
  300. package/esm/packages/vuu-utils/src/list-utils.js.map +0 -1
  301. package/esm/packages/vuu-utils/src/local-storage-utils.js +0 -30
  302. package/esm/packages/vuu-utils/src/local-storage-utils.js.map +0 -1
  303. package/esm/packages/vuu-utils/src/logging-utils.js +0 -61
  304. package/esm/packages/vuu-utils/src/logging-utils.js.map +0 -1
  305. package/esm/packages/vuu-utils/src/module-utils.js +0 -4
  306. package/esm/packages/vuu-utils/src/module-utils.js.map +0 -1
  307. package/esm/packages/vuu-utils/src/nanoid/index.js +0 -20
  308. package/esm/packages/vuu-utils/src/nanoid/index.js.map +0 -1
  309. package/esm/packages/vuu-utils/src/perf-utils.js +0 -32
  310. package/esm/packages/vuu-utils/src/perf-utils.js.map +0 -1
  311. package/esm/packages/vuu-utils/src/promise-utils.js +0 -40
  312. package/esm/packages/vuu-utils/src/promise-utils.js.map +0 -1
  313. package/esm/packages/vuu-utils/src/protocol-message-utils.js +0 -75
  314. package/esm/packages/vuu-utils/src/protocol-message-utils.js.map +0 -1
  315. package/esm/packages/vuu-utils/src/range-utils.js +0 -108
  316. package/esm/packages/vuu-utils/src/range-utils.js.map +0 -1
  317. package/esm/packages/vuu-utils/src/react-utils.js +0 -66
  318. package/esm/packages/vuu-utils/src/react-utils.js.map +0 -1
  319. package/esm/packages/vuu-utils/src/round-decimal.js +0 -127
  320. package/esm/packages/vuu-utils/src/round-decimal.js.map +0 -1
  321. package/esm/packages/vuu-utils/src/row-utils.js +0 -54
  322. package/esm/packages/vuu-utils/src/row-utils.js.map +0 -1
  323. package/esm/packages/vuu-utils/src/selection-utils.js +0 -31
  324. package/esm/packages/vuu-utils/src/selection-utils.js.map +0 -1
  325. package/esm/packages/vuu-utils/src/shell-layout-types.js +0 -11
  326. package/esm/packages/vuu-utils/src/shell-layout-types.js.map +0 -1
  327. package/esm/packages/vuu-utils/src/sort-utils.js +0 -73
  328. package/esm/packages/vuu-utils/src/sort-utils.js.map +0 -1
  329. package/esm/packages/vuu-utils/src/table-schema-utils.js +0 -11
  330. package/esm/packages/vuu-utils/src/table-schema-utils.js.map +0 -1
  331. package/esm/packages/vuu-utils/src/text-utils.js +0 -18
  332. package/esm/packages/vuu-utils/src/text-utils.js.map +0 -1
  333. package/esm/packages/vuu-utils/src/theme-utils.js +0 -34
  334. package/esm/packages/vuu-utils/src/theme-utils.js.map +0 -1
  335. package/esm/packages/vuu-utils/src/tree-utils.js +0 -108
  336. package/esm/packages/vuu-utils/src/tree-utils.js.map +0 -1
  337. package/esm/packages/vuu-utils/src/ts-utils.js +0 -8
  338. package/esm/packages/vuu-utils/src/ts-utils.js.map +0 -1
  339. package/esm/packages/vuu-utils/src/typeahead-utils.js +0 -4
  340. package/esm/packages/vuu-utils/src/typeahead-utils.js.map +0 -1
  341. package/esm/packages/vuu-utils/src/url-utils.js +0 -18
  342. package/esm/packages/vuu-utils/src/url-utils.js.map +0 -1
  343. package/esm/packages/vuu-utils/src/useId.js +0 -7
  344. package/esm/packages/vuu-utils/src/useId.js.map +0 -1
  345. package/esm/packages/vuu-utils/src/useLayoutEffectSkipFirst.js +0 -15
  346. package/esm/packages/vuu-utils/src/useLayoutEffectSkipFirst.js.map +0 -1
  347. package/esm/packages/vuu-utils/src/useResizeObserver.js +0 -130
  348. package/esm/packages/vuu-utils/src/useResizeObserver.js.map +0 -1
  349. package/esm/packages/vuu-utils/src/useStateRef.js +0 -21
  350. package/esm/packages/vuu-utils/src/useStateRef.js.map +0 -1
@@ -1,1977 +0,0 @@
1
- import { configurator, Sensor, DragDropManager as DragDropManager$1, Plugin, CorePlugin, Draggable as Draggable$1, descriptor, Droppable as Droppable$1 } from '../abstract/index.js';
2
- import { ScrollDirection, getFrameTransform, DOMRectangle, getComputedStyles, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle, getDocument, Listeners, isElement, scrollIntoViewIfNeeded, isTextInput, isHTMLElement, scheduler, generateUniqueId, isSafari, cloneElement, ProxiedElements, getFrameElement, Styles, isKeyboardEvent, canScroll, detectScrollIntent, PositionObserver as FrameObserver, getFinalKeyframe, animateTransform, getElementFromPoint, getScrollableAncestors, isPointerEvent } from './utilities.js';
3
- import { effects, computed, reactive, deepEqual } from '../state/dist/index.js';
4
- import { exceedsDistance, Point, Rectangle, Axes } from '../geometry/dist/index.js';
5
- import { defaultCollisionDetection } from '../collision/dist/index.js';
6
- import { untracked as h, effect as E, signal as d, batch as o } from '../../@preact/signals-core/dist/signals-core.js';
7
-
8
- var __create = Object.create;
9
- var __defProp = Object.defineProperty;
10
- var __defProps = Object.defineProperties;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
- var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
17
- var __typeError = (msg) => {
18
- throw TypeError(msg);
19
- };
20
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21
- var __spreadValues = (a, b) => {
22
- for (var prop in b || (b = {}))
23
- if (__hasOwnProp.call(b, prop))
24
- __defNormalProp(a, prop, b[prop]);
25
- if (__getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(b)) {
27
- if (__propIsEnum.call(b, prop))
28
- __defNormalProp(a, prop, b[prop]);
29
- }
30
- return a;
31
- };
32
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
33
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
34
- var __objRest = (source, exclude) => {
35
- var target = {};
36
- for (var prop in source)
37
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
38
- target[prop] = source[prop];
39
- if (source != null && __getOwnPropSymbols)
40
- for (var prop of __getOwnPropSymbols(source)) {
41
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
42
- target[prop] = source[prop];
43
- }
44
- return target;
45
- };
46
- var __decoratorStart = (base) => {
47
- var _a4;
48
- return [, , , __create((_a4 = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a4 : null)];
49
- };
50
- var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
51
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
52
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
53
- var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
54
- var __runInitializers = (array, flags, self, value) => {
55
- for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
56
- return value;
57
- };
58
- var __decorateElement = (array, flags, name, decorators, target, extra) => {
59
- var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
60
- var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
61
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
62
- var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
63
- return __privateGet(this, extra);
64
- }, set [name](x) {
65
- return __privateSet(this, extra, x);
66
- } }, name));
67
- k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
68
- for (var i = decorators.length - 1; i >= 0; i--) {
69
- ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
70
- if (k) {
71
- ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
72
- if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
73
- if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
74
- }
75
- it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
76
- if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
77
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
78
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
79
- }
80
- return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
81
- };
82
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
83
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
84
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
85
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
86
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
87
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
88
-
89
- // src/core/plugins/accessibility/defaults.ts
90
- var defaultAttributes = {
91
- role: "button",
92
- roleDescription: "draggable"};
93
- var defaultDescriptionIdPrefix = `dnd-kit-description`;
94
- var defaultAnnouncementIdPrefix = `dnd-kit-announcement`;
95
- var defaultScreenReaderInstructions = {
96
- draggable: `To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel.`
97
- };
98
- var defaultAnnouncements = {
99
- dragstart({ operation: { source } }) {
100
- if (!source) return;
101
- return `Picked up draggable item ${source.id}.`;
102
- },
103
- dragover({ operation: { source, target } }) {
104
- if (!source || source.id === (target == null ? void 0 : target.id)) return;
105
- if (target) {
106
- return `Draggable item ${source.id} was moved over droppable target ${target.id}.`;
107
- }
108
- return `Draggable item ${source.id} is no longer over a droppable target.`;
109
- },
110
- dragend({ operation: { source, target }, canceled }) {
111
- if (!source) return;
112
- if (canceled) {
113
- return `Dragging was cancelled. Draggable item ${source.id} was dropped.`;
114
- }
115
- if (target) {
116
- return `Draggable item ${source.id} was dropped over droppable target ${target.id}`;
117
- }
118
- return `Draggable item ${source.id} was dropped.`;
119
- }
120
- };
121
-
122
- // src/core/plugins/accessibility/utilities.ts
123
- function isFocusable(element) {
124
- const tagName = element.tagName.toLowerCase();
125
- return ["input", "select", "textarea", "a", "button"].includes(tagName);
126
- }
127
-
128
- // src/core/plugins/accessibility/HiddenText.ts
129
- function createHiddenText(id, value) {
130
- const element = document.createElement("div");
131
- element.id = id;
132
- element.style.setProperty("display", "none");
133
- element.textContent = value;
134
- return element;
135
- }
136
-
137
- // src/core/plugins/accessibility/LiveRegion.ts
138
- function createLiveRegion(id) {
139
- const element = document.createElement("div");
140
- element.id = id;
141
- element.setAttribute("role", "status");
142
- element.setAttribute("aria-live", "polite");
143
- element.setAttribute("aria-atomic", "true");
144
- element.style.setProperty("position", "fixed");
145
- element.style.setProperty("width", "1px");
146
- element.style.setProperty("height", "1px");
147
- element.style.setProperty("margin", "-1px");
148
- element.style.setProperty("border", "0");
149
- element.style.setProperty("padding", "0");
150
- element.style.setProperty("overflow", "hidden");
151
- element.style.setProperty("clip", "rect(0 0 0 0)");
152
- element.style.setProperty("clip-path", "inset(100%)");
153
- element.style.setProperty("white-space", "nowrap");
154
- return element;
155
- }
156
-
157
- // src/core/plugins/accessibility/Accessibility.ts
158
- var debouncedEvents = ["dragover", "dragmove"];
159
- var Accessibility = class extends Plugin {
160
- constructor(manager, options) {
161
- super(manager);
162
- const {
163
- id,
164
- idPrefix: {
165
- description: descriptionPrefix = defaultDescriptionIdPrefix,
166
- announcement: announcementPrefix = defaultAnnouncementIdPrefix
167
- } = {},
168
- announcements = defaultAnnouncements,
169
- screenReaderInstructions = defaultScreenReaderInstructions,
170
- debounce: debounceMs = 500
171
- } = options != null ? options : {};
172
- const descriptionId = id ? `${descriptionPrefix}-${id}` : generateUniqueId(descriptionPrefix);
173
- const announcementId = id ? `${announcementPrefix}-${id}` : generateUniqueId(announcementPrefix);
174
- let hiddenTextElement;
175
- let liveRegionElement;
176
- let liveRegionTextNode;
177
- let latestAnnouncement;
178
- const updateAnnouncement = (value = latestAnnouncement) => {
179
- if (!liveRegionTextNode || !value) return;
180
- if ((liveRegionTextNode == null ? void 0 : liveRegionTextNode.nodeValue) !== value) {
181
- liveRegionTextNode.nodeValue = value;
182
- }
183
- };
184
- const scheduleUpdateAnnouncement = () => scheduler.schedule(updateAnnouncement);
185
- const debouncedUpdateAnnouncement = debounce(
186
- scheduleUpdateAnnouncement,
187
- debounceMs
188
- );
189
- const eventListeners = Object.entries(announcements).map(
190
- ([eventName, getAnnouncement]) => {
191
- return this.manager.monitor.addEventListener(
192
- eventName,
193
- (event, manager2) => {
194
- const element = liveRegionTextNode;
195
- if (!element) return;
196
- const announcement = getAnnouncement == null ? void 0 : getAnnouncement(event, manager2);
197
- if (announcement && element.nodeValue !== announcement) {
198
- latestAnnouncement = announcement;
199
- if (debouncedEvents.includes(eventName)) {
200
- debouncedUpdateAnnouncement();
201
- } else {
202
- scheduleUpdateAnnouncement();
203
- debouncedUpdateAnnouncement.cancel();
204
- }
205
- }
206
- }
207
- );
208
- }
209
- );
210
- const initialize = () => {
211
- let elements = [];
212
- if (!(hiddenTextElement == null ? void 0 : hiddenTextElement.isConnected)) {
213
- hiddenTextElement = createHiddenText(
214
- descriptionId,
215
- screenReaderInstructions.draggable
216
- );
217
- elements.push(hiddenTextElement);
218
- }
219
- if (!(liveRegionElement == null ? void 0 : liveRegionElement.isConnected)) {
220
- liveRegionElement = createLiveRegion(announcementId);
221
- liveRegionTextNode = document.createTextNode("");
222
- liveRegionElement.appendChild(liveRegionTextNode);
223
- elements.push(liveRegionElement);
224
- }
225
- if (elements.length > 0) {
226
- document.body.append(...elements);
227
- }
228
- };
229
- const mutations = /* @__PURE__ */ new Set();
230
- function executeMutations() {
231
- for (const operation of mutations) {
232
- operation();
233
- }
234
- }
235
- this.registerEffect(() => {
236
- var _a4;
237
- mutations.clear();
238
- for (const draggable of this.manager.registry.draggables.value) {
239
- const activator = (_a4 = draggable.handle) != null ? _a4 : draggable.element;
240
- if (activator) {
241
- if (!hiddenTextElement || !liveRegionElement) {
242
- mutations.add(initialize);
243
- }
244
- if ((!isFocusable(activator) || isSafari()) && !activator.hasAttribute("tabindex")) {
245
- mutations.add(() => activator.setAttribute("tabindex", "0"));
246
- }
247
- if (!activator.hasAttribute("role") && !(activator.tagName.toLowerCase() === "button")) {
248
- mutations.add(
249
- () => activator.setAttribute("role", defaultAttributes.role)
250
- );
251
- }
252
- if (!activator.hasAttribute("aria-roledescription")) {
253
- mutations.add(
254
- () => activator.setAttribute(
255
- "aria-roledescription",
256
- defaultAttributes.roleDescription
257
- )
258
- );
259
- }
260
- if (!activator.hasAttribute("aria-describedby")) {
261
- mutations.add(
262
- () => activator.setAttribute("aria-describedby", descriptionId)
263
- );
264
- }
265
- for (const key of ["aria-pressed", "aria-grabbed"]) {
266
- const value = String(draggable.isDragging);
267
- if (activator.getAttribute(key) !== value) {
268
- mutations.add(() => activator.setAttribute(key, value));
269
- }
270
- }
271
- const disabled = String(draggable.disabled);
272
- if (activator.getAttribute("aria-disabled") !== disabled) {
273
- mutations.add(
274
- () => activator.setAttribute("aria-disabled", disabled)
275
- );
276
- }
277
- }
278
- }
279
- if (mutations.size > 0) {
280
- scheduler.schedule(executeMutations);
281
- }
282
- });
283
- this.destroy = () => {
284
- super.destroy();
285
- hiddenTextElement == null ? void 0 : hiddenTextElement.remove();
286
- liveRegionElement == null ? void 0 : liveRegionElement.remove();
287
- eventListeners.forEach((unsubscribe) => unsubscribe());
288
- };
289
- }
290
- };
291
- function debounce(fn, wait) {
292
- let timeout;
293
- const debounced = () => {
294
- clearTimeout(timeout);
295
- timeout = setTimeout(fn, wait);
296
- };
297
- debounced.cancel = () => clearTimeout(timeout);
298
- return debounced;
299
- }
300
- var Cursor = class extends Plugin {
301
- constructor(manager, options) {
302
- super(manager, options);
303
- this.manager = manager;
304
- const doc = computed(
305
- () => {
306
- var _a4;
307
- return getDocument((_a4 = this.manager.dragOperation.source) == null ? void 0 : _a4.element);
308
- }
309
- );
310
- this.destroy = E(() => {
311
- var _a4;
312
- const { dragOperation } = this.manager;
313
- const { cursor = "grabbing", nonce } = (_a4 = this.options) != null ? _a4 : {};
314
- if (dragOperation.status.initialized) {
315
- const document2 = doc.value;
316
- const style = document2.createElement("style");
317
- if (nonce) {
318
- style.setAttribute("nonce", nonce);
319
- }
320
- style.textContent = `* { cursor: ${cursor} !important; }`;
321
- document2.head.appendChild(style);
322
- return () => style.remove();
323
- }
324
- });
325
- }
326
- };
327
-
328
- // src/core/plugins/feedback/constants.ts
329
- var ATTR_PREFIX = "data-dnd-";
330
- var DROPPING_ATTRIBUTE = `${ATTR_PREFIX}dropping`;
331
- var CSS_PREFIX = "--dnd-";
332
- var ATTRIBUTE = `${ATTR_PREFIX}dragging`;
333
- var PLACEHOLDER_ATTRIBUTE = `${ATTR_PREFIX}placeholder`;
334
- var IGNORED_ATTRIBUTES = [
335
- ATTRIBUTE,
336
- PLACEHOLDER_ATTRIBUTE,
337
- "popover",
338
- "aria-pressed",
339
- "aria-grabbing"
340
- ];
341
- var IGNORED_STYLES = ["view-transition-name"];
342
- var CSS_RULES = `
343
- :root [${ATTRIBUTE}] {
344
- position: fixed !important;
345
- pointer-events: none !important;
346
- touch-action: none;
347
- z-index: calc(infinity);
348
- will-change: translate;
349
- top: var(${CSS_PREFIX}top, 0px) !important;
350
- left: var(${CSS_PREFIX}left, 0px) !important;
351
- right: unset !important;
352
- bottom: unset !important;
353
- width: var(${CSS_PREFIX}width, auto);
354
- max-width: var(${CSS_PREFIX}width, auto);
355
- height: var(${CSS_PREFIX}height, auto);
356
- max-height: var(${CSS_PREFIX}height, auto);
357
- transition: var(${CSS_PREFIX}transition) !important;
358
- }
359
-
360
- :root [${PLACEHOLDER_ATTRIBUTE}] {
361
- transition: none;
362
- }
363
-
364
- :root [${PLACEHOLDER_ATTRIBUTE}='hidden'] {
365
- visibility: hidden;
366
- }
367
-
368
- [${ATTRIBUTE}] * {
369
- pointer-events: none !important;
370
- }
371
-
372
- [${ATTRIBUTE}]:not([${DROPPING_ATTRIBUTE}]) {
373
- translate: var(${CSS_PREFIX}translate) !important;
374
- }
375
-
376
- [${ATTRIBUTE}][style*='${CSS_PREFIX}scale'] {
377
- scale: var(${CSS_PREFIX}scale) !important;
378
- transform-origin: var(${CSS_PREFIX}transform-origin) !important;
379
- }
380
-
381
- @layer {
382
- :where([${ATTRIBUTE}][popover]) {
383
- overflow: visible;
384
- background: unset;
385
- border: unset;
386
- margin: unset;
387
- padding: unset;
388
- color: inherit;
389
-
390
- &:is(input, button) {
391
- border: revert;
392
- background: revert;
393
- }
394
- }
395
- }
396
- [${ATTRIBUTE}]::backdrop, [${ATTR_PREFIX}overlay]:not([${ATTRIBUTE}]) {
397
- display: none;
398
- visibility: hidden;
399
- }
400
- `.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
401
- function createPlaceholder(source, type = "hidden") {
402
- return h(() => {
403
- const { element, manager } = source;
404
- if (!element || !manager) return;
405
- const containedDroppables = findContainedDroppables(
406
- element,
407
- manager.registry.droppables
408
- );
409
- const cleanup = [];
410
- const placeholder = cloneElement(element);
411
- const { remove } = placeholder;
412
- proxyDroppableElements(containedDroppables, placeholder, cleanup);
413
- configurePlaceholder(placeholder, type);
414
- placeholder.remove = () => {
415
- cleanup.forEach((fn) => fn());
416
- remove.call(placeholder);
417
- };
418
- return placeholder;
419
- });
420
- }
421
- function findContainedDroppables(element, droppables) {
422
- const containedDroppables = /* @__PURE__ */ new Map();
423
- for (const droppable of droppables) {
424
- if (!droppable.element) continue;
425
- if (element === droppable.element || element.contains(droppable.element)) {
426
- const identifierAttribute = `${ATTR_PREFIX}${generateUniqueId("dom-id")}`;
427
- droppable.element.setAttribute(identifierAttribute, "");
428
- containedDroppables.set(droppable, identifierAttribute);
429
- }
430
- }
431
- return containedDroppables;
432
- }
433
- function proxyDroppableElements(containedDroppables, placeholder, cleanup) {
434
- for (const [droppable, identifierAttribute] of containedDroppables) {
435
- if (!droppable.element) continue;
436
- const selector = `[${identifierAttribute}]`;
437
- const clonedElement = placeholder.matches(selector) ? placeholder : placeholder.querySelector(selector);
438
- droppable.element.removeAttribute(identifierAttribute);
439
- if (!clonedElement) continue;
440
- const originalElement = droppable.element;
441
- droppable.proxy = clonedElement;
442
- clonedElement.removeAttribute(identifierAttribute);
443
- ProxiedElements.set(originalElement, clonedElement);
444
- cleanup.push(() => {
445
- ProxiedElements.delete(originalElement);
446
- droppable.proxy = void 0;
447
- });
448
- }
449
- }
450
- function configurePlaceholder(placeholder, type = "hidden") {
451
- placeholder.setAttribute("inert", "true");
452
- placeholder.setAttribute("tab-index", "-1");
453
- placeholder.setAttribute("aria-hidden", "true");
454
- placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, type);
455
- }
456
- function isSameFrame(element, target) {
457
- if (element === target) return true;
458
- return getFrameElement(element) === getFrameElement(target);
459
- }
460
- function preventPopoverClose(event) {
461
- const { target } = event;
462
- if ("newState" in event && event.newState === "closed" && isElement(target) && target.hasAttribute("popover")) {
463
- requestAnimationFrame(() => showPopover(target));
464
- }
465
- }
466
- function isTableRow(element) {
467
- return element.tagName === "TR";
468
- }
469
-
470
- // src/core/plugins/feedback/Feedback.ts
471
- var styleSheetRegistry = /* @__PURE__ */ new Map();
472
- var _overlay_dec, _a, _init, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
473
- var _Feedback = class _Feedback extends (_a = Plugin, _overlay_dec = [reactive], _a) {
474
- constructor(manager, options) {
475
- super(manager, options);
476
- __privateAdd(this, _Feedback_instances);
477
- __privateAdd(this, _overlay, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
478
- this.state = {
479
- initial: {},
480
- current: {}
481
- };
482
- this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
483
- this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
484
- }
485
- destroy() {
486
- super.destroy();
487
- for (const [doc, registration] of styleSheetRegistry.entries()) {
488
- if (registration.instances.has(this)) {
489
- registration.instances.delete(this);
490
- if (registration.instances.size === 0) {
491
- registration.cleanup();
492
- styleSheetRegistry.delete(doc);
493
- }
494
- }
495
- }
496
- }
497
- };
498
- _init = __decoratorStart(_a);
499
- _overlay = new WeakMap();
500
- _Feedback_instances = new WeakSet();
501
- render_fn = function() {
502
- var _a4, _b2, _c3;
503
- const { state, manager, options } = this;
504
- const { dragOperation } = manager;
505
- const { position, source, status } = dragOperation;
506
- if (status.idle) {
507
- state.current = {};
508
- state.initial = {};
509
- return;
510
- }
511
- if (!source) return;
512
- const { element, feedback } = source;
513
- if (!element || feedback === "none" || !status.initialized || status.initializing) {
514
- return;
515
- }
516
- const { initial } = state;
517
- const feedbackElement = (_a4 = this.overlay) != null ? _a4 : element;
518
- const frameTransform = getFrameTransform(feedbackElement);
519
- const elementFrameTransform = getFrameTransform(element);
520
- const crossFrame = !isSameFrame(element, feedbackElement);
521
- const shape = new DOMRectangle(element, {
522
- frameTransform: crossFrame ? elementFrameTransform : null,
523
- ignoreTransforms: !crossFrame
524
- });
525
- const scaleDelta = {
526
- x: elementFrameTransform.scaleX / frameTransform.scaleX,
527
- y: elementFrameTransform.scaleY / frameTransform.scaleY
528
- };
529
- let { width, height, top, left } = shape;
530
- if (crossFrame) {
531
- width = width / scaleDelta.x;
532
- height = height / scaleDelta.y;
533
- }
534
- let elementMutationObserver;
535
- let documentMutationObserver;
536
- const styles = new Styles(feedbackElement);
537
- const {
538
- transition,
539
- translate,
540
- boxSizing,
541
- paddingBlockStart,
542
- paddingBlockEnd,
543
- paddingInlineStart,
544
- paddingInlineEnd,
545
- borderInlineStartWidth,
546
- borderInlineEndWidth,
547
- borderBlockStartWidth,
548
- borderBlockEndWidth
549
- } = getComputedStyles(element);
550
- const clone = feedback === "clone";
551
- const contentBox = boxSizing === "content-box";
552
- const widthOffset = contentBox ? parseInt(paddingInlineStart) + parseInt(paddingInlineEnd) + parseInt(borderInlineStartWidth) + parseInt(borderInlineEndWidth) : 0;
553
- const heightOffset = contentBox ? parseInt(paddingBlockStart) + parseInt(paddingBlockEnd) + parseInt(borderBlockStartWidth) + parseInt(borderBlockEndWidth) : 0;
554
- const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source, clone ? "clone" : "hidden") : null;
555
- const isKeyboardOperation = h(
556
- () => isKeyboardEvent(manager.dragOperation.activatorEvent)
557
- );
558
- if (translate !== "none") {
559
- const parsedTranslate = parseTranslate(translate);
560
- if (parsedTranslate && !initial.translate) {
561
- initial.translate = parsedTranslate;
562
- }
563
- }
564
- if (!initial.transformOrigin) {
565
- const current = h(() => position.current);
566
- initial.transformOrigin = {
567
- x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
568
- y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
569
- };
570
- }
571
- const { transformOrigin } = initial;
572
- const relativeTop = top * frameTransform.scaleY + frameTransform.y;
573
- const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
574
- if (!initial.coordinates) {
575
- initial.coordinates = {
576
- x: relativeLeft,
577
- y: relativeTop
578
- };
579
- if (scaleDelta.x !== 1 || scaleDelta.y !== 1) {
580
- const { scaleX, scaleY } = elementFrameTransform;
581
- const { x: tX2, y: tY2 } = transformOrigin;
582
- initial.coordinates.x += (width * scaleX - width) * tX2;
583
- initial.coordinates.y += (height * scaleY - height) * tY2;
584
- }
585
- }
586
- if (!initial.dimensions) {
587
- initial.dimensions = { width, height };
588
- }
589
- if (!initial.frameTransform) {
590
- initial.frameTransform = frameTransform;
591
- }
592
- const coordinatesDelta = {
593
- x: initial.coordinates.x - relativeLeft,
594
- y: initial.coordinates.y - relativeTop
595
- };
596
- const sizeDelta = {
597
- width: (initial.dimensions.width * initial.frameTransform.scaleX - width * frameTransform.scaleX) * transformOrigin.x,
598
- height: (initial.dimensions.height * initial.frameTransform.scaleY - height * frameTransform.scaleY) * transformOrigin.y
599
- };
600
- const delta = {
601
- x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
602
- y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
603
- };
604
- const projected = {
605
- left: left + delta.x,
606
- top: top + delta.y
607
- };
608
- feedbackElement.setAttribute(ATTRIBUTE, "true");
609
- const transform = h(() => dragOperation.transform);
610
- const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
611
- const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
612
- const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
613
- const translateString = `${tX}px ${tY}px 0`;
614
- const transitionString = transition ? `${transition}, translate 0ms linear` : "";
615
- styles.set(
616
- {
617
- width: width - widthOffset,
618
- height: height - heightOffset,
619
- top: projected.top,
620
- left: projected.left,
621
- translate: translateString,
622
- transition: transitionString,
623
- scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
624
- "transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
625
- },
626
- CSS_PREFIX
627
- );
628
- if (placeholder) {
629
- element.insertAdjacentElement("afterend", placeholder);
630
- if (options == null ? void 0 : options.rootElement) {
631
- const root = typeof options.rootElement === "function" ? options.rootElement(source) : options.rootElement;
632
- root.appendChild(element);
633
- }
634
- }
635
- if (supportsPopover(feedbackElement)) {
636
- if (!feedbackElement.hasAttribute("popover")) {
637
- feedbackElement.setAttribute("popover", "manual");
638
- }
639
- showPopover(feedbackElement);
640
- feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
641
- }
642
- const resizeObserver = new ResizeObserver(() => {
643
- if (!placeholder) return;
644
- const placeholderShape = new DOMRectangle(placeholder, {
645
- frameTransform,
646
- ignoreTransforms: true
647
- });
648
- const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
649
- const dX = (width - placeholderShape.width) * origin.x + delta.x;
650
- const dY = (height - placeholderShape.height) * origin.y + delta.y;
651
- styles.set(
652
- {
653
- width: placeholderShape.width - widthOffset,
654
- height: placeholderShape.height - heightOffset,
655
- top: top + dY,
656
- left: left + dX
657
- },
658
- CSS_PREFIX
659
- );
660
- elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
661
- if (isTableRow(element) && isTableRow(placeholder)) {
662
- const cells = Array.from(element.cells);
663
- const placeholderCells = Array.from(placeholder.cells);
664
- for (const [index, cell] of cells.entries()) {
665
- const placeholderCell = placeholderCells[index];
666
- cell.style.width = `${placeholderCell.offsetWidth}px`;
667
- }
668
- }
669
- dragOperation.shape = new DOMRectangle(feedbackElement);
670
- });
671
- const initialShape = new DOMRectangle(feedbackElement);
672
- h(() => dragOperation.shape = initialShape);
673
- const feedbackWindow = getWindow(feedbackElement);
674
- const handleWindowResize = (event) => {
675
- this.manager.actions.stop({ event });
676
- };
677
- if (isKeyboardOperation) {
678
- feedbackWindow.addEventListener("resize", handleWindowResize);
679
- }
680
- if (h(() => source.status) === "idle") {
681
- requestAnimationFrame(() => source.status = "dragging");
682
- }
683
- if (placeholder) {
684
- resizeObserver.observe(placeholder);
685
- elementMutationObserver = new MutationObserver((mutations) => {
686
- let hasChildrenMutations = false;
687
- for (const mutation of mutations) {
688
- if (mutation.target !== element) {
689
- hasChildrenMutations = true;
690
- continue;
691
- }
692
- if (mutation.type !== "attributes") {
693
- continue;
694
- }
695
- const attributeName = mutation.attributeName;
696
- if (attributeName.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attributeName)) {
697
- continue;
698
- }
699
- const attributeValue = element.getAttribute(attributeName);
700
- if (attributeName === "style") {
701
- if (supportsStyle(element) && supportsStyle(placeholder)) {
702
- const styles2 = element.style;
703
- for (const key of Array.from(placeholder.style)) {
704
- if (styles2.getPropertyValue(key) === "") {
705
- placeholder.style.removeProperty(key);
706
- }
707
- }
708
- for (const key of Array.from(styles2)) {
709
- if (IGNORED_STYLES.includes(key) || key.startsWith(CSS_PREFIX)) {
710
- continue;
711
- }
712
- const value = styles2.getPropertyValue(key);
713
- placeholder.style.setProperty(key, value);
714
- }
715
- }
716
- } else if (attributeValue !== null) {
717
- placeholder.setAttribute(attributeName, attributeValue);
718
- } else {
719
- placeholder.removeAttribute(attributeName);
720
- }
721
- }
722
- if (hasChildrenMutations && clone) {
723
- placeholder.innerHTML = element.innerHTML;
724
- }
725
- });
726
- elementMutationObserver.observe(element, {
727
- attributes: true,
728
- subtree: true,
729
- childList: true
730
- });
731
- documentMutationObserver = new MutationObserver((entries) => {
732
- for (const entry of entries) {
733
- if (entry.addedNodes.length === 0) continue;
734
- for (const node of Array.from(entry.addedNodes)) {
735
- if (node.contains(element) && element.nextElementSibling !== placeholder) {
736
- element.insertAdjacentElement("afterend", placeholder);
737
- showPopover(feedbackElement);
738
- return;
739
- }
740
- if (node.contains(placeholder) && placeholder.previousElementSibling !== element) {
741
- placeholder.insertAdjacentElement("beforebegin", element);
742
- showPopover(feedbackElement);
743
- return;
744
- }
745
- }
746
- }
747
- });
748
- documentMutationObserver.observe(element.ownerDocument.body, {
749
- childList: true,
750
- subtree: true
751
- });
752
- }
753
- const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
754
- const restoreFocus = () => {
755
- var _a5;
756
- if (!isKeyboardOperation || id == null) {
757
- return;
758
- }
759
- const draggable = manager.registry.draggables.get(id);
760
- const element2 = (_a5 = draggable == null ? void 0 : draggable.handle) != null ? _a5 : draggable == null ? void 0 : draggable.element;
761
- if (isHTMLElement(element2)) {
762
- element2.focus();
763
- }
764
- };
765
- const cleanup = () => {
766
- elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
767
- documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
768
- resizeObserver.disconnect();
769
- feedbackWindow.removeEventListener("resize", handleWindowResize);
770
- if (supportsPopover(feedbackElement)) {
771
- feedbackElement.removeEventListener(
772
- "beforetoggle",
773
- preventPopoverClose
774
- );
775
- feedbackElement.removeAttribute("popover");
776
- }
777
- feedbackElement.removeAttribute(ATTRIBUTE);
778
- styles.reset();
779
- source.status = "idle";
780
- const moved = state.current.translate != null;
781
- if (placeholder && (moved || placeholder.parentElement !== feedbackElement.parentElement) && feedbackElement.isConnected) {
782
- placeholder.replaceWith(feedbackElement);
783
- }
784
- placeholder == null ? void 0 : placeholder.remove();
785
- };
786
- const cleanupEffects = effects(
787
- // Update transform on move
788
- () => {
789
- var _a5;
790
- const { transform: transform2, status: status2 } = dragOperation;
791
- if (!transform2.x && !transform2.y && !state.current.translate) {
792
- return;
793
- }
794
- if (status2.dragging) {
795
- const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
796
- const translate2 = {
797
- x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
798
- y: transform2.y / frameTransform.scaleY + initialTranslate2.y
799
- };
800
- const previousTranslate = state.current.translate;
801
- const modifiers = h(() => dragOperation.modifiers);
802
- const currentShape = h(() => {
803
- var _a6;
804
- return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
805
- });
806
- const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
807
- styles.set(
808
- {
809
- transition: `${transition}, translate ${translateTransition}`,
810
- translate: `${translate2.x}px ${translate2.y}px 0`
811
- },
812
- CSS_PREFIX
813
- );
814
- elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
815
- if (currentShape && currentShape !== initialShape && previousTranslate && !modifiers.length) {
816
- const delta2 = Point.delta(translate2, previousTranslate);
817
- dragOperation.shape = Rectangle.from(
818
- currentShape.boundingRectangle
819
- ).translate(
820
- // Need to take into account frame transform when optimistically updating shape
821
- delta2.x * frameTransform.scaleX,
822
- delta2.y * frameTransform.scaleY
823
- );
824
- } else {
825
- dragOperation.shape = new DOMRectangle(feedbackElement);
826
- }
827
- state.current.translate = translate2;
828
- }
829
- },
830
- // Drop animation
831
- function() {
832
- if (dragOperation.status.dropped) {
833
- this.dispose();
834
- source.status = "dropping";
835
- let translate2 = state.current.translate;
836
- const moved = translate2 != null;
837
- if (!translate2 && element !== feedbackElement) {
838
- translate2 = {
839
- x: 0,
840
- y: 0
841
- };
842
- }
843
- if (!translate2) {
844
- cleanup();
845
- return;
846
- }
847
- const dropAnimation = () => {
848
- var _a5, _b3;
849
- {
850
- showPopover(feedbackElement);
851
- const [, animation] = (_a5 = getFinalKeyframe(
852
- feedbackElement,
853
- (keyframe) => "translate" in keyframe
854
- )) != null ? _a5 : [];
855
- animation == null ? void 0 : animation.pause();
856
- const target = placeholder != null ? placeholder : element;
857
- const options2 = {
858
- frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
859
- };
860
- const current = new DOMRectangle(feedbackElement, options2);
861
- const currentTranslate = (_b3 = parseTranslate(getComputedStyles(feedbackElement).translate)) != null ? _b3 : translate2;
862
- const final = new DOMRectangle(target, options2);
863
- const delta2 = Rectangle.delta(current, final, source.alignment);
864
- const finalTranslate = {
865
- x: currentTranslate.x - delta2.x,
866
- y: currentTranslate.y - delta2.y
867
- };
868
- const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
869
- minHeight: [
870
- `${current.intrinsicHeight}px`,
871
- `${final.intrinsicHeight}px`
872
- ],
873
- maxHeight: [
874
- `${current.intrinsicHeight}px`,
875
- `${final.intrinsicHeight}px`
876
- ]
877
- } : {};
878
- const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
879
- minWidth: [
880
- `${current.intrinsicWidth}px`,
881
- `${final.intrinsicWidth}px`
882
- ],
883
- maxWidth: [
884
- `${current.intrinsicWidth}px`,
885
- `${final.intrinsicWidth}px`
886
- ]
887
- } : {};
888
- styles.set({ transition }, CSS_PREFIX);
889
- feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
890
- elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
891
- animateTransform({
892
- element: feedbackElement,
893
- keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
894
- translate: [
895
- `${currentTranslate.x}px ${currentTranslate.y}px 0`,
896
- `${finalTranslate.x}px ${finalTranslate.y}px 0`
897
- ]
898
- }),
899
- options: {
900
- duration: moved || feedbackElement !== element ? 250 : 0,
901
- easing: "ease"
902
- }
903
- }).then(() => {
904
- feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
905
- animation == null ? void 0 : animation.finish();
906
- cleanup();
907
- requestAnimationFrame(restoreFocus);
908
- });
909
- }
910
- };
911
- manager.renderer.rendering.then(dropAnimation);
912
- }
913
- }
914
- );
915
- return () => {
916
- cleanup();
917
- cleanupEffects();
918
- };
919
- };
920
- injectStyles_fn = function() {
921
- var _a4, _b2, _c3;
922
- const { status, source, target } = this.manager.dragOperation;
923
- const { nonce } = (_a4 = this.options) != null ? _a4 : {};
924
- if (status.initializing) {
925
- const sourceDocument = getDocument((_b2 = source == null ? void 0 : source.element) != null ? _b2 : null);
926
- const targetDocument = getDocument((_c3 = target == null ? void 0 : target.element) != null ? _c3 : null);
927
- const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
928
- for (const doc of documents) {
929
- let registration = styleSheetRegistry.get(doc);
930
- if (!registration) {
931
- const style = document.createElement("style");
932
- style.textContent = CSS_RULES;
933
- if (nonce) {
934
- style.setAttribute("nonce", nonce);
935
- }
936
- doc.head.prepend(style);
937
- const mutationObserver = new MutationObserver((entries) => {
938
- for (const entry of entries) {
939
- if (entry.type === "childList") {
940
- const removedNodes = Array.from(entry.removedNodes);
941
- if (removedNodes.length > 0 && removedNodes.includes(style)) {
942
- doc.head.prepend(style);
943
- }
944
- }
945
- }
946
- });
947
- mutationObserver.observe(doc.head, { childList: true });
948
- registration = {
949
- cleanup: () => {
950
- mutationObserver.disconnect();
951
- style.remove();
952
- },
953
- instances: /* @__PURE__ */ new Set()
954
- };
955
- styleSheetRegistry.set(doc, registration);
956
- }
957
- registration.instances.add(this);
958
- }
959
- }
960
- };
961
- __decorateElement(_init, 4, "overlay", _overlay_dec, _Feedback, _overlay);
962
- __decoratorMetadata(_init, _Feedback);
963
- _Feedback.configure = configurator(_Feedback);
964
- var Feedback = _Feedback;
965
- var LOCKED = true;
966
- var UNLOCKED = false;
967
- var _dec, _a2, _dec2, _b, _init2, __b, __a;
968
- _b = (_dec2 = [reactive], ScrollDirection.Forward), _a2 = (_dec = [reactive], ScrollDirection.Reverse);
969
- var ScrollLock = class {
970
- constructor() {
971
- __privateAdd(this, __b, __runInitializers(_init2, 8, this, LOCKED)), __runInitializers(_init2, 11, this);
972
- __privateAdd(this, __a, __runInitializers(_init2, 12, this, LOCKED)), __runInitializers(_init2, 15, this);
973
- }
974
- isLocked(direction) {
975
- if (direction === ScrollDirection.Idle) {
976
- return false;
977
- }
978
- if (direction == null) {
979
- return this[ScrollDirection.Forward] === LOCKED && this[ScrollDirection.Reverse] === LOCKED;
980
- }
981
- return this[direction] === LOCKED;
982
- }
983
- unlock(direction) {
984
- if (direction === ScrollDirection.Idle) {
985
- return;
986
- }
987
- this[direction] = UNLOCKED;
988
- }
989
- };
990
- _init2 = __decoratorStart(null);
991
- __b = new WeakMap();
992
- __a = new WeakMap();
993
- __decorateElement(_init2, 4, _b, _dec2, ScrollLock, __b);
994
- __decorateElement(_init2, 4, _a2, _dec, ScrollLock, __a);
995
- __decoratorMetadata(_init2, ScrollLock);
996
-
997
- // src/core/plugins/scrolling/ScrollIntent.ts
998
- var DIRECTIONS = [ScrollDirection.Forward, ScrollDirection.Reverse];
999
- var ScrollIntent = class {
1000
- constructor() {
1001
- this.x = new ScrollLock();
1002
- this.y = new ScrollLock();
1003
- }
1004
- isLocked() {
1005
- return this.x.isLocked() && this.y.isLocked();
1006
- }
1007
- };
1008
- var ScrollIntentTracker = class extends Plugin {
1009
- constructor(manager) {
1010
- super(manager);
1011
- const scrollIntent = d(new ScrollIntent());
1012
- let previousDelta = null;
1013
- this.signal = scrollIntent;
1014
- E(() => {
1015
- const { status } = manager.dragOperation;
1016
- if (!status.initialized) {
1017
- previousDelta = null;
1018
- scrollIntent.value = new ScrollIntent();
1019
- return;
1020
- }
1021
- const { delta } = manager.dragOperation.position;
1022
- if (previousDelta) {
1023
- const directions = {
1024
- x: getDirection(delta.x, previousDelta.x),
1025
- y: getDirection(delta.y, previousDelta.y)
1026
- };
1027
- const intent = scrollIntent.peek();
1028
- o(() => {
1029
- for (const axis of Axes) {
1030
- for (const direction of DIRECTIONS) {
1031
- if (directions[axis] === direction) {
1032
- intent[axis].unlock(direction);
1033
- }
1034
- }
1035
- }
1036
- scrollIntent.value = intent;
1037
- });
1038
- }
1039
- previousDelta = delta;
1040
- });
1041
- }
1042
- get current() {
1043
- return this.signal.peek();
1044
- }
1045
- };
1046
- function getDirection(a, b) {
1047
- return Math.sign(a - b);
1048
- }
1049
-
1050
- // src/core/plugins/scrolling/Scroller.ts
1051
- var _autoScrolling_dec, _a3, _init3, _autoScrolling, _meta, _scroll;
1052
- var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive], _a3) {
1053
- constructor(manager) {
1054
- super(manager);
1055
- __privateAdd(this, _autoScrolling, __runInitializers(_init3, 8, this, false)), __runInitializers(_init3, 11, this);
1056
- __privateAdd(this, _meta);
1057
- __privateAdd(this, _scroll, () => {
1058
- if (!__privateGet(this, _meta)) {
1059
- return;
1060
- }
1061
- const { element, by } = __privateGet(this, _meta);
1062
- if (by.y) element.scrollTop += by.y;
1063
- if (by.x) element.scrollLeft += by.x;
1064
- });
1065
- this.scroll = (options) => {
1066
- var _a4;
1067
- if (this.disabled) {
1068
- return false;
1069
- }
1070
- const elements = this.getScrollableElements();
1071
- if (!elements) {
1072
- __privateSet(this, _meta, void 0);
1073
- return false;
1074
- }
1075
- const { position } = this.manager.dragOperation;
1076
- const currentPosition = position == null ? void 0 : position.current;
1077
- if (currentPosition) {
1078
- const { by } = options != null ? options : {};
1079
- const intent = by ? {
1080
- x: getScrollIntent(by.x),
1081
- y: getScrollIntent(by.y)
1082
- } : void 0;
1083
- const scrollIntent = intent ? void 0 : this.scrollIntentTracker.current;
1084
- if (scrollIntent == null ? void 0 : scrollIntent.isLocked()) {
1085
- return false;
1086
- }
1087
- for (const scrollableElement of elements) {
1088
- const elementCanScroll = canScroll(scrollableElement, by);
1089
- if (elementCanScroll.x || elementCanScroll.y) {
1090
- const { speed, direction } = detectScrollIntent(
1091
- scrollableElement,
1092
- currentPosition,
1093
- intent
1094
- );
1095
- if (scrollIntent) {
1096
- for (const axis of Axes) {
1097
- if (scrollIntent[axis].isLocked(direction[axis])) {
1098
- speed[axis] = 0;
1099
- direction[axis] = 0;
1100
- }
1101
- }
1102
- }
1103
- if (direction.x || direction.y) {
1104
- const { x, y } = by != null ? by : direction;
1105
- const scrollLeftBy = x * speed.x;
1106
- const scrollTopBy = y * speed.y;
1107
- if (scrollLeftBy || scrollTopBy) {
1108
- const previousScrollBy = (_a4 = __privateGet(this, _meta)) == null ? void 0 : _a4.by;
1109
- if (this.autoScrolling && previousScrollBy) {
1110
- const scrollIntentMismatch = previousScrollBy.x && !scrollLeftBy || previousScrollBy.y && !scrollTopBy;
1111
- if (scrollIntentMismatch) continue;
1112
- }
1113
- __privateSet(this, _meta, {
1114
- element: scrollableElement,
1115
- by: {
1116
- x: scrollLeftBy,
1117
- y: scrollTopBy
1118
- }
1119
- });
1120
- scheduler.schedule(__privateGet(this, _scroll));
1121
- return true;
1122
- }
1123
- }
1124
- }
1125
- }
1126
- }
1127
- __privateSet(this, _meta, void 0);
1128
- return false;
1129
- };
1130
- let previousElementFromPoint = null;
1131
- let previousScrollableElements = null;
1132
- const elementFromPoint = computed(() => {
1133
- const { position, source } = manager.dragOperation;
1134
- if (!position) {
1135
- return null;
1136
- }
1137
- const element = getElementFromPoint(
1138
- getDocument(source == null ? void 0 : source.element),
1139
- position.current
1140
- );
1141
- if (element) {
1142
- previousElementFromPoint = element;
1143
- }
1144
- return element != null ? element : previousElementFromPoint;
1145
- });
1146
- const scrollableElements = computed(() => {
1147
- const element = elementFromPoint.value;
1148
- const { documentElement } = getDocument(element);
1149
- if (!element || element === documentElement) {
1150
- const { target } = manager.dragOperation;
1151
- const targetElement = target == null ? void 0 : target.element;
1152
- if (targetElement) {
1153
- const elements = getScrollableAncestors(targetElement, {
1154
- excludeElement: false
1155
- });
1156
- previousScrollableElements = elements;
1157
- return elements;
1158
- }
1159
- }
1160
- if (element) {
1161
- const elements = getScrollableAncestors(element, {
1162
- excludeElement: false
1163
- });
1164
- if (this.autoScrolling && previousScrollableElements && elements.size < (previousScrollableElements == null ? void 0 : previousScrollableElements.size)) {
1165
- return previousScrollableElements;
1166
- }
1167
- previousScrollableElements = elements;
1168
- return elements;
1169
- }
1170
- previousScrollableElements = null;
1171
- return null;
1172
- }, deepEqual);
1173
- this.getScrollableElements = () => {
1174
- return scrollableElements.value;
1175
- };
1176
- this.scrollIntentTracker = new ScrollIntentTracker(manager);
1177
- this.destroy = manager.monitor.addEventListener("dragmove", (event) => {
1178
- if (this.disabled || event.defaultPrevented || !isKeyboardEvent(manager.dragOperation.activatorEvent) || !event.by) {
1179
- return;
1180
- }
1181
- if (this.scroll({ by: event.by })) {
1182
- event.preventDefault();
1183
- }
1184
- });
1185
- }
1186
- };
1187
- _init3 = __decoratorStart(_a3);
1188
- _autoScrolling = new WeakMap();
1189
- _meta = new WeakMap();
1190
- _scroll = new WeakMap();
1191
- __decorateElement(_init3, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
1192
- __decoratorMetadata(_init3, Scroller);
1193
- function getScrollIntent(value) {
1194
- if (value > 0) {
1195
- return ScrollDirection.Forward;
1196
- }
1197
- if (value < 0) {
1198
- return ScrollDirection.Reverse;
1199
- }
1200
- return ScrollDirection.Idle;
1201
- }
1202
-
1203
- // src/utilities/scheduling/scheduler.ts
1204
- var Scheduler = class {
1205
- constructor(scheduler5) {
1206
- this.scheduler = scheduler5;
1207
- this.pending = false;
1208
- this.tasks = /* @__PURE__ */ new Set();
1209
- this.resolvers = /* @__PURE__ */ new Set();
1210
- this.flush = () => {
1211
- const { tasks, resolvers } = this;
1212
- this.pending = false;
1213
- this.tasks = /* @__PURE__ */ new Set();
1214
- this.resolvers = /* @__PURE__ */ new Set();
1215
- for (const task of tasks) {
1216
- task();
1217
- }
1218
- for (const resolve of resolvers) {
1219
- resolve();
1220
- }
1221
- };
1222
- }
1223
- schedule(task) {
1224
- this.tasks.add(task);
1225
- if (!this.pending) {
1226
- this.pending = true;
1227
- this.scheduler(this.flush);
1228
- }
1229
- return new Promise((resolve) => this.resolvers.add(resolve));
1230
- }
1231
- };
1232
- var scheduler3 = new Scheduler((callback) => {
1233
- if (typeof requestAnimationFrame === "function") {
1234
- requestAnimationFrame(callback);
1235
- } else {
1236
- callback();
1237
- }
1238
- });
1239
-
1240
- // src/core/plugins/scrolling/AutoScroller.ts
1241
- var AUTOSCROLL_INTERVAL = 10;
1242
- var AutoScroller = class extends Plugin {
1243
- constructor(manager, _options) {
1244
- super(manager);
1245
- const scroller = manager.registry.plugins.get(Scroller);
1246
- if (!scroller) {
1247
- throw new Error("AutoScroller plugin depends on Scroller plugin");
1248
- }
1249
- this.destroy = E(() => {
1250
- if (this.disabled) {
1251
- return;
1252
- }
1253
- const { position: _, status } = manager.dragOperation;
1254
- if (status.dragging) {
1255
- const canScroll2 = scroller.scroll();
1256
- if (canScroll2) {
1257
- scroller.autoScrolling = true;
1258
- const interval = setInterval(
1259
- () => scheduler3.schedule(scroller.scroll),
1260
- AUTOSCROLL_INTERVAL
1261
- );
1262
- return () => {
1263
- clearInterval(interval);
1264
- };
1265
- } else {
1266
- scroller.autoScrolling = false;
1267
- }
1268
- }
1269
- });
1270
- }
1271
- };
1272
- var listenerOptions = {
1273
- capture: true,
1274
- passive: true
1275
- };
1276
- var _timeout;
1277
- var ScrollListener = class extends CorePlugin {
1278
- constructor(manager) {
1279
- super(manager);
1280
- __privateAdd(this, _timeout);
1281
- this.handleScroll = () => {
1282
- if (__privateGet(this, _timeout) == null) {
1283
- __privateSet(this, _timeout, setTimeout(() => {
1284
- this.manager.collisionObserver.forceUpdate(false);
1285
- __privateSet(this, _timeout, void 0);
1286
- }, 50));
1287
- }
1288
- };
1289
- const { dragOperation } = this.manager;
1290
- this.destroy = E(() => {
1291
- var _a4, _b2, _c3;
1292
- const enabled = dragOperation.status.dragging;
1293
- if (enabled) {
1294
- const root = (_c3 = (_b2 = (_a4 = dragOperation.source) == null ? void 0 : _a4.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
1295
- root.addEventListener("scroll", this.handleScroll, listenerOptions);
1296
- return () => {
1297
- root.removeEventListener(
1298
- "scroll",
1299
- this.handleScroll,
1300
- listenerOptions
1301
- );
1302
- };
1303
- }
1304
- });
1305
- }
1306
- };
1307
- _timeout = new WeakMap();
1308
- var PreventSelection = class extends Plugin {
1309
- constructor(manager, options) {
1310
- super(manager, options);
1311
- this.manager = manager;
1312
- this.destroy = E(() => {
1313
- var _a4;
1314
- const { dragOperation } = this.manager;
1315
- const { nonce } = (_a4 = this.options) != null ? _a4 : {};
1316
- if (dragOperation.status.initialized) {
1317
- const style = document.createElement("style");
1318
- if (nonce) {
1319
- style.setAttribute("nonce", nonce);
1320
- }
1321
- style.textContent = `* { user-select: none !important; -webkit-user-select: none !important; }`;
1322
- document.head.appendChild(style);
1323
- removeSelection();
1324
- document.addEventListener("selectionchange", removeSelection, {
1325
- capture: true
1326
- });
1327
- return () => {
1328
- document.removeEventListener("selectionchange", removeSelection, {
1329
- capture: true
1330
- });
1331
- style.remove();
1332
- };
1333
- }
1334
- });
1335
- }
1336
- };
1337
- function removeSelection() {
1338
- var _a4;
1339
- (_a4 = document.getSelection()) == null ? void 0 : _a4.removeAllRanges();
1340
- }
1341
- var defaults = Object.freeze({
1342
- offset: 10,
1343
- keyboardCodes: {
1344
- start: ["Space", "Enter"],
1345
- cancel: ["Escape"],
1346
- end: ["Space", "Enter", "Tab"],
1347
- up: ["ArrowUp"],
1348
- down: ["ArrowDown"],
1349
- left: ["ArrowLeft"],
1350
- right: ["ArrowRight"]
1351
- },
1352
- shouldActivate(args) {
1353
- var _a4;
1354
- const { event, source } = args;
1355
- const target = (_a4 = source.handle) != null ? _a4 : source.element;
1356
- return event.target === target;
1357
- }
1358
- });
1359
- var _cleanupFunctions;
1360
- var _KeyboardSensor = class _KeyboardSensor extends Sensor {
1361
- constructor(manager, options) {
1362
- super(manager);
1363
- this.manager = manager;
1364
- this.options = options;
1365
- __privateAdd(this, _cleanupFunctions, []);
1366
- this.listeners = new Listeners();
1367
- this.handleSourceKeyDown = (event, source, options) => {
1368
- if (this.disabled || event.defaultPrevented) {
1369
- return;
1370
- }
1371
- if (!isElement(event.target)) {
1372
- return;
1373
- }
1374
- if (source.disabled) {
1375
- return;
1376
- }
1377
- const {
1378
- keyboardCodes = defaults.keyboardCodes,
1379
- shouldActivate = defaults.shouldActivate
1380
- } = options != null ? options : {};
1381
- if (!keyboardCodes.start.includes(event.code)) {
1382
- return;
1383
- }
1384
- if (!this.manager.dragOperation.status.idle) {
1385
- return;
1386
- }
1387
- if (shouldActivate({ event, source, manager: this.manager })) {
1388
- this.handleStart(event, source, options);
1389
- }
1390
- };
1391
- }
1392
- bind(source, options = this.options) {
1393
- const unbind = E(() => {
1394
- var _a4;
1395
- const target = (_a4 = source.handle) != null ? _a4 : source.element;
1396
- const listener = (event) => {
1397
- if (isKeyboardEvent(event)) {
1398
- this.handleSourceKeyDown(event, source, options);
1399
- }
1400
- };
1401
- if (target) {
1402
- target.addEventListener("keydown", listener);
1403
- return () => {
1404
- target.removeEventListener("keydown", listener);
1405
- };
1406
- }
1407
- });
1408
- return unbind;
1409
- }
1410
- handleStart(event, source, options) {
1411
- const { element } = source;
1412
- if (!element) {
1413
- throw new Error("Source draggable does not have an associated element");
1414
- }
1415
- event.preventDefault();
1416
- event.stopImmediatePropagation();
1417
- scrollIntoViewIfNeeded(element);
1418
- const { center } = new DOMRectangle(element);
1419
- const controller = this.manager.actions.start({
1420
- event,
1421
- coordinates: {
1422
- x: center.x,
1423
- y: center.y
1424
- },
1425
- source
1426
- });
1427
- if (controller.signal.aborted) return this.cleanup();
1428
- this.sideEffects();
1429
- const sourceDocument = getDocument(element);
1430
- const listeners = [
1431
- this.listeners.bind(sourceDocument, [
1432
- {
1433
- type: "keydown",
1434
- listener: (event2) => this.handleKeyDown(event2, source, options),
1435
- options: { capture: true }
1436
- }
1437
- ])
1438
- ];
1439
- __privateGet(this, _cleanupFunctions).push(...listeners);
1440
- }
1441
- handleKeyDown(event, _source, options) {
1442
- const { keyboardCodes = defaults.keyboardCodes } = options != null ? options : {};
1443
- if (isKeycode(event, [...keyboardCodes.end, ...keyboardCodes.cancel])) {
1444
- event.preventDefault();
1445
- const canceled = isKeycode(event, keyboardCodes.cancel);
1446
- this.handleEnd(event, canceled);
1447
- return;
1448
- }
1449
- if (isKeycode(event, keyboardCodes.up)) {
1450
- this.handleMove("up", event);
1451
- } else if (isKeycode(event, keyboardCodes.down)) {
1452
- this.handleMove("down", event);
1453
- }
1454
- if (isKeycode(event, keyboardCodes.left)) {
1455
- this.handleMove("left", event);
1456
- } else if (isKeycode(event, keyboardCodes.right)) {
1457
- this.handleMove("right", event);
1458
- }
1459
- }
1460
- handleEnd(event, canceled) {
1461
- this.manager.actions.stop({
1462
- event,
1463
- canceled
1464
- });
1465
- this.cleanup();
1466
- }
1467
- handleMove(direction, event) {
1468
- var _a4, _b2;
1469
- const { shape } = this.manager.dragOperation;
1470
- const factor = event.shiftKey ? 5 : 1;
1471
- let by = {
1472
- x: 0,
1473
- y: 0
1474
- };
1475
- let offset = (_b2 = (_a4 = this.options) == null ? void 0 : _a4.offset) != null ? _b2 : defaults.offset;
1476
- if (typeof offset === "number") {
1477
- offset = { x: offset, y: offset };
1478
- }
1479
- if (!shape) {
1480
- return;
1481
- }
1482
- switch (direction) {
1483
- case "up":
1484
- by = { x: 0, y: -offset.y * factor };
1485
- break;
1486
- case "down":
1487
- by = { x: 0, y: offset.y * factor };
1488
- break;
1489
- case "left":
1490
- by = { x: -offset.x * factor, y: 0 };
1491
- break;
1492
- case "right":
1493
- by = { x: offset.x * factor, y: 0 };
1494
- break;
1495
- }
1496
- if (by.x || by.y) {
1497
- event.preventDefault();
1498
- this.manager.actions.move({
1499
- event,
1500
- by
1501
- });
1502
- }
1503
- }
1504
- sideEffects() {
1505
- const autoScroller = this.manager.registry.plugins.get(AutoScroller);
1506
- if ((autoScroller == null ? void 0 : autoScroller.disabled) === false) {
1507
- autoScroller.disable();
1508
- __privateGet(this, _cleanupFunctions).push(() => {
1509
- autoScroller.enable();
1510
- });
1511
- }
1512
- }
1513
- cleanup() {
1514
- __privateGet(this, _cleanupFunctions).forEach((cleanup) => cleanup());
1515
- __privateSet(this, _cleanupFunctions, []);
1516
- }
1517
- destroy() {
1518
- this.cleanup();
1519
- this.listeners.clear();
1520
- }
1521
- };
1522
- _cleanupFunctions = new WeakMap();
1523
- _KeyboardSensor.configure = configurator(_KeyboardSensor);
1524
- _KeyboardSensor.defaults = defaults;
1525
- var KeyboardSensor = _KeyboardSensor;
1526
- function isKeycode(event, codes) {
1527
- return codes.includes(event.code);
1528
- }
1529
- var defaults2 = Object.freeze({
1530
- activationConstraints(event, source) {
1531
- var _a4;
1532
- const { pointerType, target } = event;
1533
- if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
1534
- return void 0;
1535
- }
1536
- if (pointerType === "touch") {
1537
- return {
1538
- delay: { value: 250, tolerance: 5 }
1539
- };
1540
- }
1541
- if (isTextInput(target) && !event.defaultPrevented) {
1542
- return {
1543
- delay: { value: 200, tolerance: 0 }
1544
- };
1545
- }
1546
- return {
1547
- delay: { value: 200, tolerance: 10 },
1548
- distance: { value: 5 }
1549
- };
1550
- }
1551
- });
1552
- var _cleanup, _clearTimeout;
1553
- var _PointerSensor = class _PointerSensor extends Sensor {
1554
- constructor(manager, options) {
1555
- super(manager);
1556
- this.manager = manager;
1557
- this.options = options;
1558
- __privateAdd(this, _cleanup, /* @__PURE__ */ new Set());
1559
- __privateAdd(this, _clearTimeout);
1560
- this.listeners = new Listeners();
1561
- this.latest = {
1562
- event: void 0,
1563
- coordinates: void 0
1564
- };
1565
- this.handleMove = () => {
1566
- const { event, coordinates: to } = this.latest;
1567
- if (!event || !to) {
1568
- return;
1569
- }
1570
- this.manager.actions.move({ event, to });
1571
- };
1572
- this.handleCancel = this.handleCancel.bind(this);
1573
- this.handlePointerUp = this.handlePointerUp.bind(this);
1574
- this.handleKeyDown = this.handleKeyDown.bind(this);
1575
- }
1576
- activationConstraints(event, source) {
1577
- var _a4;
1578
- const { activationConstraints = defaults2.activationConstraints } = (_a4 = this.options) != null ? _a4 : {};
1579
- const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
1580
- return constraints;
1581
- }
1582
- bind(source, options = this.options) {
1583
- const unbind = E(() => {
1584
- var _a4;
1585
- const controller = new AbortController();
1586
- const { signal: signal3 } = controller;
1587
- const listener = (event) => {
1588
- if (isPointerEvent(event)) {
1589
- this.handlePointerDown(event, source, options);
1590
- }
1591
- };
1592
- let targets = [(_a4 = source.handle) != null ? _a4 : source.element];
1593
- if (options == null ? void 0 : options.activatorElements) {
1594
- if (Array.isArray(options.activatorElements)) {
1595
- targets = options.activatorElements;
1596
- } else {
1597
- targets = options.activatorElements(source);
1598
- }
1599
- }
1600
- for (const target of targets) {
1601
- if (!target) continue;
1602
- patchWindow(target.ownerDocument.defaultView);
1603
- target.addEventListener("pointerdown", listener, { signal: signal3 });
1604
- }
1605
- return () => controller.abort();
1606
- });
1607
- return unbind;
1608
- }
1609
- handlePointerDown(event, source, options = {}) {
1610
- if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event) || !this.manager.dragOperation.status.idle) {
1611
- return;
1612
- }
1613
- const { target } = event;
1614
- const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
1615
- const offset = getFrameTransform(source.element);
1616
- this.initialCoordinates = {
1617
- x: event.clientX * offset.scaleX + offset.x,
1618
- y: event.clientY * offset.scaleY + offset.y
1619
- };
1620
- const constraints = this.activationConstraints(event, source);
1621
- event.sensor = this;
1622
- if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
1623
- this.handleStart(source, event);
1624
- } else {
1625
- const { delay } = constraints;
1626
- if (delay) {
1627
- const timeout = setTimeout(
1628
- () => this.handleStart(source, event),
1629
- delay.value
1630
- );
1631
- __privateSet(this, _clearTimeout, () => {
1632
- clearTimeout(timeout);
1633
- __privateSet(this, _clearTimeout, void 0);
1634
- });
1635
- }
1636
- }
1637
- const ownerDocument = getDocument(event.target);
1638
- const unbindListeners = this.listeners.bind(ownerDocument, [
1639
- {
1640
- type: "pointermove",
1641
- listener: (event2) => this.handlePointerMove(event2, source)
1642
- },
1643
- {
1644
- type: "pointerup",
1645
- listener: this.handlePointerUp,
1646
- options: {
1647
- capture: true
1648
- }
1649
- },
1650
- {
1651
- // Cancel activation if there is a competing Drag and Drop interaction
1652
- type: "dragstart",
1653
- listener: isNativeDraggable ? this.handleCancel : preventDefault,
1654
- options: {
1655
- capture: true
1656
- }
1657
- }
1658
- ]);
1659
- const cleanup = () => {
1660
- var _a4;
1661
- unbindListeners();
1662
- (_a4 = __privateGet(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
1663
- this.initialCoordinates = void 0;
1664
- };
1665
- __privateGet(this, _cleanup).add(cleanup);
1666
- }
1667
- handlePointerMove(event, source) {
1668
- const coordinates = {
1669
- x: event.clientX,
1670
- y: event.clientY
1671
- };
1672
- const offset = getFrameTransform(source.element);
1673
- coordinates.x = coordinates.x * offset.scaleX + offset.x;
1674
- coordinates.y = coordinates.y * offset.scaleY + offset.y;
1675
- if (this.manager.dragOperation.status.dragging) {
1676
- event.preventDefault();
1677
- event.stopPropagation();
1678
- this.latest.event = event;
1679
- this.latest.coordinates = coordinates;
1680
- scheduler.schedule(this.handleMove);
1681
- return;
1682
- }
1683
- if (!this.initialCoordinates) {
1684
- return;
1685
- }
1686
- const delta = {
1687
- x: coordinates.x - this.initialCoordinates.x,
1688
- y: coordinates.y - this.initialCoordinates.y
1689
- };
1690
- const constraints = this.activationConstraints(event, source);
1691
- const { distance, delay } = constraints != null ? constraints : {};
1692
- if (distance) {
1693
- if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
1694
- return this.handleCancel(event);
1695
- }
1696
- if (exceedsDistance(delta, distance.value)) {
1697
- return this.handleStart(source, event);
1698
- }
1699
- }
1700
- if (delay) {
1701
- if (exceedsDistance(delta, delay.tolerance)) {
1702
- return this.handleCancel(event);
1703
- }
1704
- }
1705
- }
1706
- handlePointerUp(event) {
1707
- const { status } = this.manager.dragOperation;
1708
- if (!status.idle) {
1709
- event.preventDefault();
1710
- event.stopPropagation();
1711
- const canceled = !status.initialized;
1712
- this.manager.actions.stop({ event, canceled });
1713
- }
1714
- this.cleanup();
1715
- }
1716
- handleKeyDown(event) {
1717
- if (event.key === "Escape") {
1718
- event.preventDefault();
1719
- this.handleCancel(event);
1720
- }
1721
- }
1722
- handleStart(source, event) {
1723
- var _a4;
1724
- const { manager, initialCoordinates } = this;
1725
- (_a4 = __privateGet(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
1726
- if (!initialCoordinates || !manager.dragOperation.status.idle) {
1727
- return;
1728
- }
1729
- if (event.defaultPrevented) {
1730
- return;
1731
- }
1732
- const controller = manager.actions.start({
1733
- coordinates: initialCoordinates,
1734
- event,
1735
- source
1736
- });
1737
- if (controller.signal.aborted) return this.cleanup();
1738
- event.preventDefault();
1739
- const ownerDocument = getDocument(event.target);
1740
- const pointerCaptureTarget = ownerDocument.body;
1741
- pointerCaptureTarget.setPointerCapture(event.pointerId);
1742
- const unbind = this.listeners.bind(ownerDocument, [
1743
- {
1744
- // Prevent scrolling on touch devices
1745
- type: "touchmove",
1746
- listener: preventDefault,
1747
- options: {
1748
- passive: false
1749
- }
1750
- },
1751
- {
1752
- // Prevent click events
1753
- type: "click",
1754
- listener: preventDefault
1755
- },
1756
- {
1757
- type: "contextmenu",
1758
- listener: preventDefault
1759
- },
1760
- {
1761
- type: "keydown",
1762
- listener: this.handleKeyDown
1763
- },
1764
- {
1765
- type: "lostpointercapture",
1766
- listener: (event2) => {
1767
- if (event2.target !== pointerCaptureTarget) return;
1768
- this.handlePointerUp(event2);
1769
- }
1770
- }
1771
- ]);
1772
- __privateGet(this, _cleanup).add(unbind);
1773
- }
1774
- handleCancel(event) {
1775
- const { dragOperation } = this.manager;
1776
- if (dragOperation.status.initialized) {
1777
- this.manager.actions.stop({ event, canceled: true });
1778
- }
1779
- this.cleanup();
1780
- }
1781
- cleanup() {
1782
- this.latest = {
1783
- event: void 0,
1784
- coordinates: void 0
1785
- };
1786
- __privateGet(this, _cleanup).forEach((cleanup) => cleanup());
1787
- __privateGet(this, _cleanup).clear();
1788
- }
1789
- destroy() {
1790
- this.cleanup();
1791
- this.listeners.clear();
1792
- }
1793
- };
1794
- _cleanup = new WeakMap();
1795
- _clearTimeout = new WeakMap();
1796
- _PointerSensor.configure = configurator(_PointerSensor);
1797
- _PointerSensor.defaults = defaults2;
1798
- var PointerSensor = _PointerSensor;
1799
- function isCapturedBySensor(event) {
1800
- return "sensor" in event;
1801
- }
1802
- function preventDefault(event) {
1803
- event.preventDefault();
1804
- }
1805
- function noop() {
1806
- }
1807
- var windows = /* @__PURE__ */ new WeakSet();
1808
- function patchWindow(window) {
1809
- if (!window || windows.has(window)) {
1810
- return;
1811
- }
1812
- window.addEventListener("touchmove", noop, {
1813
- capture: false,
1814
- passive: false
1815
- });
1816
- windows.add(window);
1817
- }
1818
-
1819
- // src/core/manager/manager.ts
1820
- var defaultPreset = {
1821
- modifiers: [],
1822
- plugins: [Accessibility, AutoScroller, Cursor, Feedback, PreventSelection],
1823
- sensors: [PointerSensor, KeyboardSensor]
1824
- };
1825
- var DragDropManager = class extends DragDropManager$1 {
1826
- constructor(input = {}) {
1827
- const {
1828
- plugins = defaultPreset.plugins,
1829
- sensors = defaultPreset.sensors,
1830
- modifiers = []
1831
- } = input;
1832
- super(__spreadProps(__spreadValues({}, input), {
1833
- plugins: [ScrollListener, Scroller, ...plugins],
1834
- sensors,
1835
- modifiers
1836
- }));
1837
- }
1838
- };
1839
- var _feedback_dec, _element_dec, _handle_dec, _c, _init4, _handle, _element, _feedback;
1840
- var Draggable = class extends (_c = Draggable$1, _handle_dec = [reactive], _element_dec = [reactive], _feedback_dec = [reactive], _c) {
1841
- constructor(_a4, manager) {
1842
- var _b2 = _a4, {
1843
- element,
1844
- effects: effects2 = () => [],
1845
- handle,
1846
- feedback = "default"
1847
- } = _b2, input = __objRest(_b2, [
1848
- "element",
1849
- "effects",
1850
- "handle",
1851
- "feedback"
1852
- ]);
1853
- super(
1854
- __spreadValues({
1855
- effects: () => [
1856
- ...effects2(),
1857
- () => {
1858
- var _a5, _b3;
1859
- const { manager: manager2 } = this;
1860
- if (!manager2) return;
1861
- const sensors = (_b3 = (_a5 = this.sensors) == null ? void 0 : _a5.map(descriptor)) != null ? _b3 : [
1862
- ...manager2.sensors
1863
- ];
1864
- const unbindFunctions = sensors.map((entry) => {
1865
- const sensorInstance = entry instanceof Sensor ? entry : manager2.registry.register(entry.plugin);
1866
- const options = entry instanceof Sensor ? void 0 : entry.options;
1867
- const unbind = sensorInstance.bind(this, options);
1868
- return unbind;
1869
- });
1870
- return function cleanup() {
1871
- unbindFunctions.forEach((unbind) => unbind());
1872
- };
1873
- }
1874
- ]
1875
- }, input),
1876
- manager
1877
- );
1878
- __privateAdd(this, _handle, __runInitializers(_init4, 8, this)), __runInitializers(_init4, 11, this);
1879
- __privateAdd(this, _element, __runInitializers(_init4, 12, this)), __runInitializers(_init4, 15, this);
1880
- __privateAdd(this, _feedback, __runInitializers(_init4, 16, this)), __runInitializers(_init4, 19, this);
1881
- this.element = element;
1882
- this.handle = handle;
1883
- this.feedback = feedback;
1884
- }
1885
- };
1886
- _init4 = __decoratorStart(_c);
1887
- _handle = new WeakMap();
1888
- _element = new WeakMap();
1889
- _feedback = new WeakMap();
1890
- __decorateElement(_init4, 4, "handle", _handle_dec, Draggable, _handle);
1891
- __decorateElement(_init4, 4, "element", _element_dec, Draggable, _element);
1892
- __decorateElement(_init4, 4, "feedback", _feedback_dec, Draggable, _feedback);
1893
- __decoratorMetadata(_init4, Draggable);
1894
- var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
1895
- var Droppable = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
1896
- constructor(_a4, manager) {
1897
- var _b2 = _a4, { element, effects: effects2 = () => [] } = _b2, input = __objRest(_b2, ["element", "effects"]);
1898
- const { collisionDetector = defaultCollisionDetection } = input;
1899
- const updateShape = (boundingClientRect) => {
1900
- const { manager: manager2, element: element2 } = this;
1901
- if (!element2 || boundingClientRect === null) {
1902
- this.shape = void 0;
1903
- return void 0;
1904
- }
1905
- if (!manager2) return;
1906
- const updatedShape = new DOMRectangle(element2);
1907
- const shape = h(() => this.shape);
1908
- if (updatedShape && (shape == null ? void 0 : shape.equals(updatedShape))) {
1909
- return shape;
1910
- }
1911
- this.shape = updatedShape;
1912
- return updatedShape;
1913
- };
1914
- const observePosition = d(false);
1915
- super(
1916
- __spreadProps(__spreadValues({}, input), {
1917
- collisionDetector,
1918
- effects: () => [
1919
- ...effects2(),
1920
- () => {
1921
- const { element: element2, manager: manager2 } = this;
1922
- if (!manager2) return;
1923
- const { dragOperation } = manager2;
1924
- const { source } = dragOperation;
1925
- observePosition.value = Boolean(
1926
- source && dragOperation.status.initialized && element2 && !this.disabled && this.accepts(source)
1927
- );
1928
- },
1929
- () => {
1930
- const { element: element2 } = this;
1931
- if (observePosition.value && element2) {
1932
- const positionObserver = new FrameObserver(
1933
- element2,
1934
- updateShape
1935
- );
1936
- return () => {
1937
- positionObserver.disconnect();
1938
- this.shape = void 0;
1939
- };
1940
- }
1941
- },
1942
- () => {
1943
- var _a5;
1944
- if ((_a5 = this.manager) == null ? void 0 : _a5.dragOperation.status.initialized) {
1945
- return () => {
1946
- this.shape = void 0;
1947
- };
1948
- }
1949
- }
1950
- ]
1951
- }),
1952
- manager
1953
- );
1954
- __privateAdd(this, _Droppable_instances);
1955
- __privateAdd(this, _element2, __runInitializers(_init5, 8, this)), __runInitializers(_init5, 11, this);
1956
- __privateAdd(this, _proxy, __runInitializers(_init5, 12, this)), __runInitializers(_init5, 15, this);
1957
- this.element = element;
1958
- this.refreshShape = () => updateShape();
1959
- }
1960
- set element(element) {
1961
- __privateSet(this, _Droppable_instances, element, element_set);
1962
- }
1963
- get element() {
1964
- var _a4;
1965
- return (_a4 = this.proxy) != null ? _a4 : __privateGet(this, _Droppable_instances, element_get);
1966
- }
1967
- };
1968
- _init5 = __decoratorStart(_c2);
1969
- _element2 = new WeakMap();
1970
- _Droppable_instances = new WeakSet();
1971
- _proxy = new WeakMap();
1972
- _d = __decorateElement(_init5, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
1973
- __decorateElement(_init5, 4, "proxy", _proxy_dec, Droppable, _proxy);
1974
- __decoratorMetadata(_init5, Droppable);
1975
-
1976
- export { Accessibility, AutoScroller, Cursor, DragDropManager, Draggable, Droppable, Feedback, KeyboardSensor, PointerSensor, PreventSelection, ScrollListener, Scroller, defaultPreset };
1977
- //# sourceMappingURL=index.js.map