react-timelane 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/_virtual/bind-all.js +4 -0
  2. package/dist/_virtual/bind.js +4 -0
  3. package/dist/_virtual/index.js +5 -0
  4. package/dist/_virtual/index2.js +4 -0
  5. package/dist/_virtual/index3.js +5 -0
  6. package/dist/_virtual/index4.js +4 -0
  7. package/dist/_virtual/react-dom.development.js +4 -0
  8. package/dist/_virtual/react-dom.production.js +4 -0
  9. package/dist/components/Timelane/Timelane.css +1 -0
  10. package/dist/components/Timelane/Timelane.js +53 -0
  11. package/dist/components/TimelaneAllocation/TimelaneAllocation.js +49 -0
  12. package/dist/components/TimelaneAside/TimelaneAside.d.ts +6 -1
  13. package/dist/components/TimelaneAside/TimelaneAside.js +60 -0
  14. package/dist/components/TimelaneBackground/TimelaneBackground.js +46 -0
  15. package/dist/components/TimelaneBody/TimelaneBody.js +13 -0
  16. package/dist/components/TimelaneBody/TimelaneSelectionLayer.js +96 -0
  17. package/dist/components/TimelaneHeader/DaysHeader.js +30 -0
  18. package/dist/components/TimelaneHeader/MonthsHeader.js +38 -0
  19. package/dist/components/TimelaneHeader/TimelaneHeader.js +55 -0
  20. package/dist/components/TimelaneHeader/WeeksHeader.js +39 -0
  21. package/dist/components/TimelaneHeader/renderingUtils.js +26 -0
  22. package/dist/components/TimelaneItem/DragResizeComponent.js +125 -0
  23. package/dist/components/TimelaneItem/TimelaneItem.js +42 -0
  24. package/dist/components/TimelaneLane/DropPreview.js +25 -0
  25. package/dist/components/TimelaneLane/DropTarget.js +57 -0
  26. package/dist/components/TimelaneLane/OverlapIndicator.js +21 -0
  27. package/dist/components/TimelaneLane/TimelaneLane.js +164 -0
  28. package/dist/components/TimelaneLayout/TimelaneLayout.js +77 -0
  29. package/dist/components/TimelaneLayout/layout.css +1 -0
  30. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsContext.js +21 -0
  31. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.js +15 -0
  32. package/dist/components/utils.js +243 -0
  33. package/dist/hooks/useScroll.js +47 -0
  34. package/dist/hooks/useTimelaneContext.js +6 -0
  35. package/dist/index.js +36 -0
  36. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +4 -0
  37. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js +127 -0
  38. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +9 -0
  39. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +4 -0
  40. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +7 -0
  41. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js +226 -0
  42. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +107 -0
  43. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +195 -0
  44. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +21 -0
  45. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +43 -0
  46. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +253 -0
  47. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +121 -0
  48. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +12 -0
  49. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +17 -0
  50. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +9 -0
  51. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +8 -0
  52. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +57 -0
  53. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +9 -0
  54. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +13 -0
  55. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +47 -0
  56. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +17 -0
  57. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +7 -0
  58. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +10 -0
  59. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js +4 -0
  60. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +4 -0
  61. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js +4 -0
  62. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
  63. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +6 -0
  64. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
  65. package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  66. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
  67. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +21 -0
  68. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
  69. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
  70. package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +10 -0
  71. package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
  72. package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  73. package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  74. package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  75. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
  76. package/dist/node_modules/bind-event-listener/dist/bind-all.js +45 -0
  77. package/dist/node_modules/bind-event-listener/dist/bind.js +16 -0
  78. package/dist/node_modules/bind-event-listener/dist/index.js +20 -0
  79. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
  80. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  81. package/dist/node_modules/date-fns/_lib/format/formatters.js +583 -0
  82. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
  83. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
  84. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
  85. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  86. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
  87. package/dist/node_modules/date-fns/_lib/protectedTokens.js +20 -0
  88. package/dist/node_modules/date-fns/addDays.js +10 -0
  89. package/dist/node_modules/date-fns/addWeeks.js +8 -0
  90. package/dist/node_modules/date-fns/constants.js +6 -0
  91. package/dist/node_modules/date-fns/constructFrom.js +8 -0
  92. package/dist/node_modules/date-fns/differenceInCalendarDays.js +16 -0
  93. package/dist/node_modules/date-fns/eachDayOfInterval.js +17 -0
  94. package/dist/node_modules/date-fns/eachMonthOfInterval.js +17 -0
  95. package/dist/node_modules/date-fns/eachWeekOfInterval.js +22 -0
  96. package/dist/node_modules/date-fns/format.js +59 -0
  97. package/dist/node_modules/date-fns/getDay.js +8 -0
  98. package/dist/node_modules/date-fns/getDayOfYear.js +11 -0
  99. package/dist/node_modules/date-fns/getISOWeek.js +12 -0
  100. package/dist/node_modules/date-fns/getISOWeekYear.js +15 -0
  101. package/dist/node_modules/date-fns/getWeek.js +12 -0
  102. package/dist/node_modules/date-fns/getWeekYear.js +17 -0
  103. package/dist/node_modules/date-fns/isDate.js +7 -0
  104. package/dist/node_modules/date-fns/isSameDay.js +14 -0
  105. package/dist/node_modules/date-fns/isSunday.js +8 -0
  106. package/dist/node_modules/date-fns/isValid.js +9 -0
  107. package/dist/node_modules/date-fns/lastDayOfMonth.js +9 -0
  108. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  109. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
  110. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
  111. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
  112. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
  113. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
  114. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  115. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
  116. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
  117. package/dist/node_modules/date-fns/locale/en-US.js +21 -0
  118. package/dist/node_modules/date-fns/max.js +14 -0
  119. package/dist/node_modules/date-fns/min.js +14 -0
  120. package/dist/node_modules/date-fns/nextDay.js +10 -0
  121. package/dist/node_modules/date-fns/nextSunday.js +8 -0
  122. package/dist/node_modules/date-fns/setHours.js +9 -0
  123. package/dist/node_modules/date-fns/startOfDay.js +9 -0
  124. package/dist/node_modules/date-fns/startOfISOWeek.js +8 -0
  125. package/dist/node_modules/date-fns/startOfISOWeekYear.js +11 -0
  126. package/dist/node_modules/date-fns/startOfWeek.js +11 -0
  127. package/dist/node_modules/date-fns/startOfWeekYear.js +13 -0
  128. package/dist/node_modules/date-fns/startOfYear.js +9 -0
  129. package/dist/node_modules/date-fns/toDate.js +8 -0
  130. package/dist/node_modules/raf-schd/dist/raf-schd.esm.js +15 -0
  131. package/dist/node_modules/re-resizable/lib/index.js +424 -0
  132. package/dist/node_modules/re-resizable/lib/resizer.js +49 -0
  133. package/dist/node_modules/react-dom/cjs/react-dom.development.js +227 -0
  134. package/dist/node_modules/react-dom/cjs/react-dom.production.js +147 -0
  135. package/dist/node_modules/react-dom/index.js +23 -0
  136. package/dist/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +12 -0
  137. package/dist/types/Item.js +6 -0
  138. package/package.json +15 -6
  139. package/dist/react-timelane.css +0 -1
  140. package/dist/react-timelane.js +0 -4752
@@ -0,0 +1,226 @@
1
+ import b from "../../../../../@babel/runtime/helpers/esm/defineProperty.js";
2
+ import { d as y } from "../../../../../../_virtual/index.js";
3
+ import { maxZIndex as h } from "../util/max-z-index.js";
4
+ import { honeyPotDataAttribute as w } from "./honey-pot-data-attribute.js";
5
+ function d(t, n) {
6
+ var e = Object.keys(t);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var r = Object.getOwnPropertySymbols(t);
9
+ n && (r = r.filter(function(o) {
10
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
11
+ })), e.push.apply(e, r);
12
+ }
13
+ return e;
14
+ }
15
+ function v(t) {
16
+ for (var n = 1; n < arguments.length; n++) {
17
+ var e = arguments[n] != null ? arguments[n] : {};
18
+ n % 2 ? d(Object(e), !0).forEach(function(r) {
19
+ b(t, r, e[r]);
20
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : d(Object(e)).forEach(function(r) {
21
+ Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(e, r));
22
+ });
23
+ }
24
+ return t;
25
+ }
26
+ var l = 2, m = l / 2;
27
+ function O(t) {
28
+ return {
29
+ x: Math.floor(t.x),
30
+ y: Math.floor(t.y)
31
+ };
32
+ }
33
+ function P(t) {
34
+ return {
35
+ x: t.x - m,
36
+ y: t.y - m
37
+ };
38
+ }
39
+ function j(t) {
40
+ return {
41
+ x: Math.max(t.x, 0),
42
+ y: Math.max(t.y, 0)
43
+ };
44
+ }
45
+ function R(t) {
46
+ return {
47
+ x: Math.min(t.x, window.innerWidth - l),
48
+ y: Math.min(t.y, window.innerHeight - l)
49
+ };
50
+ }
51
+ function x(t) {
52
+ var n = t.client, e = R(j(P(O(n))));
53
+ return DOMRect.fromRect({
54
+ x: e.x,
55
+ y: e.y,
56
+ width: l,
57
+ height: l
58
+ });
59
+ }
60
+ function g(t) {
61
+ var n = t.clientRect;
62
+ return {
63
+ left: "".concat(n.left, "px"),
64
+ top: "".concat(n.top, "px"),
65
+ width: "".concat(n.width, "px"),
66
+ height: "".concat(n.height, "px")
67
+ };
68
+ }
69
+ function D(t) {
70
+ var n = t.client, e = t.clientRect;
71
+ return (
72
+ // is within horizontal bounds
73
+ n.x >= e.x && n.x <= e.x + e.width && // is within vertical bounds
74
+ n.y >= e.y && n.y <= e.y + e.height
75
+ );
76
+ }
77
+ function S(t) {
78
+ var n = t.initial, e = document.createElement("div");
79
+ e.setAttribute(w, "true");
80
+ var r = x({
81
+ client: n
82
+ });
83
+ Object.assign(e.style, v(v({
84
+ // Setting a background color explicitly to avoid any inherited styles.
85
+ // Looks like this could be `opacity: 0`, but worried that _might_
86
+ // cause the element to be ignored on some platforms.
87
+ // When debugging, set backgroundColor to something like "red".
88
+ backgroundColor: "transparent",
89
+ position: "fixed",
90
+ // Being explicit to avoid inheriting styles
91
+ padding: 0,
92
+ margin: 0,
93
+ boxSizing: "border-box"
94
+ }, g({
95
+ clientRect: r
96
+ })), {}, {
97
+ // We want this element to absorb pointer events,
98
+ // it's kind of the whole point 😉
99
+ pointerEvents: "auto",
100
+ // Want to make sure the honey pot is top of everything else.
101
+ // Don't need to worry about native drag previews, as they will
102
+ // have been rendered (and removed) before the honey pot is rendered
103
+ zIndex: h
104
+ })), document.body.appendChild(e);
105
+ var o = y.bind(window, {
106
+ type: "pointermove",
107
+ listener: function(c) {
108
+ var a = {
109
+ x: c.clientX,
110
+ y: c.clientY
111
+ };
112
+ r = x({
113
+ client: a
114
+ }), Object.assign(e.style, g({
115
+ clientRect: r
116
+ }));
117
+ },
118
+ // using capture so we are less likely to be impacted by event stopping
119
+ options: {
120
+ capture: !0
121
+ }
122
+ });
123
+ return function(c) {
124
+ var a = c.current;
125
+ if (o(), D({
126
+ client: a,
127
+ clientRect: r
128
+ })) {
129
+ e.remove();
130
+ return;
131
+ }
132
+ function i() {
133
+ s(), e.remove();
134
+ }
135
+ var s = y.bindAll(window, [
136
+ {
137
+ type: "pointerdown",
138
+ listener: i
139
+ },
140
+ {
141
+ type: "pointermove",
142
+ listener: i
143
+ },
144
+ {
145
+ type: "focusin",
146
+ listener: i
147
+ },
148
+ {
149
+ type: "focusout",
150
+ listener: i
151
+ },
152
+ // a 'pointerdown' should happen before 'dragstart', but just being super safe
153
+ {
154
+ type: "dragstart",
155
+ listener: i
156
+ },
157
+ // if the user has dragged something out of the window
158
+ // and then is dragging something back into the window
159
+ // the first events we will see are "dragenter" (and then "dragover").
160
+ // So if we see any of these we need to clear the post drag fix.
161
+ {
162
+ type: "dragenter",
163
+ listener: i
164
+ },
165
+ {
166
+ type: "dragover",
167
+ listener: i
168
+ }
169
+ // Not adding a "wheel" event listener, as "wheel" by itself does not
170
+ // resolve the bug.
171
+ ], {
172
+ // Using `capture` so less likely to be impacted by other code stopping events
173
+ capture: !0
174
+ });
175
+ };
176
+ }
177
+ function z() {
178
+ var t = null;
179
+ function n() {
180
+ return t = null, y.bind(window, {
181
+ type: "pointermove",
182
+ listener: function(o) {
183
+ t = {
184
+ x: o.clientX,
185
+ y: o.clientY
186
+ };
187
+ },
188
+ // listening for pointer move in capture phase
189
+ // so we are less likely to be impacted by events being stopped.
190
+ options: {
191
+ capture: !0
192
+ }
193
+ });
194
+ }
195
+ function e() {
196
+ var r = null;
197
+ return function(u) {
198
+ var c = u.eventName, a = u.payload;
199
+ if (c === "onDragStart") {
200
+ var i = a.location.initial.input, s = t ?? {
201
+ x: i.clientX,
202
+ y: i.clientY
203
+ };
204
+ r = S({
205
+ initial: s
206
+ });
207
+ }
208
+ if (c === "onDrop") {
209
+ var p, f = a.location.current.input;
210
+ (p = r) === null || p === void 0 || p({
211
+ current: {
212
+ x: f.clientX,
213
+ y: f.clientY
214
+ }
215
+ }), r = null, t = null;
216
+ }
217
+ };
218
+ }
219
+ return {
220
+ bindEvents: n,
221
+ getOnPostDispatch: e
222
+ };
223
+ }
224
+ export {
225
+ z as makeHoneyPotFix
226
+ };
@@ -0,0 +1,107 @@
1
+ import p from "../../../../../raf-schd/dist/raf-schd.esm.js";
2
+ var s = p(function(a) {
3
+ return a();
4
+ }), d = /* @__PURE__ */ function() {
5
+ var a = null;
6
+ function n(l) {
7
+ var o = requestAnimationFrame(function() {
8
+ a = null, l();
9
+ });
10
+ a = {
11
+ frameId: o,
12
+ fn: l
13
+ };
14
+ }
15
+ function t() {
16
+ a && (cancelAnimationFrame(a.frameId), a.fn(), a = null);
17
+ }
18
+ return {
19
+ schedule: n,
20
+ flush: t
21
+ };
22
+ }();
23
+ function g(a) {
24
+ var n = a.source, t = a.initial, l = a.dispatchEvent, o = {
25
+ dropTargets: []
26
+ };
27
+ function u(c) {
28
+ l(c), o = {
29
+ dropTargets: c.payload.location.current.dropTargets
30
+ };
31
+ }
32
+ var v = {
33
+ start: function(r) {
34
+ var i = r.nativeSetDragImage, e = {
35
+ current: t,
36
+ previous: o,
37
+ initial: t
38
+ };
39
+ u({
40
+ eventName: "onGenerateDragPreview",
41
+ payload: {
42
+ source: n,
43
+ location: e,
44
+ nativeSetDragImage: i
45
+ }
46
+ }), d.schedule(function() {
47
+ u({
48
+ eventName: "onDragStart",
49
+ payload: {
50
+ source: n,
51
+ location: e
52
+ }
53
+ });
54
+ });
55
+ },
56
+ dragUpdate: function(r) {
57
+ var i = r.current;
58
+ d.flush(), s.cancel(), u({
59
+ eventName: "onDropTargetChange",
60
+ payload: {
61
+ source: n,
62
+ location: {
63
+ initial: t,
64
+ previous: o,
65
+ current: i
66
+ }
67
+ }
68
+ });
69
+ },
70
+ drag: function(r) {
71
+ var i = r.current;
72
+ s(function() {
73
+ d.flush();
74
+ var e = {
75
+ initial: t,
76
+ previous: o,
77
+ current: i
78
+ };
79
+ u({
80
+ eventName: "onDrag",
81
+ payload: {
82
+ source: n,
83
+ location: e
84
+ }
85
+ });
86
+ });
87
+ },
88
+ drop: function(r) {
89
+ var i = r.current, e = r.updatedSourcePayload;
90
+ d.flush(), s.cancel(), u({
91
+ eventName: "onDrop",
92
+ payload: {
93
+ source: e ?? n,
94
+ location: {
95
+ current: i,
96
+ previous: o,
97
+ initial: t
98
+ }
99
+ }
100
+ });
101
+ }
102
+ };
103
+ return v;
104
+ }
105
+ export {
106
+ g as makeDispatch
107
+ };
@@ -0,0 +1,195 @@
1
+ import E from "../../../../../@babel/runtime/helpers/esm/toConsumableArray.js";
2
+ import { d as x } from "../../../../../../_virtual/index.js";
3
+ import { getElementFromPointWithoutHoneypot as S } from "../honey-pot-fix/get-element-from-point-without-honey-pot.js";
4
+ import { isHoneyPotElement as A } from "../honey-pot-fix/is-honey-pot-element.js";
5
+ import { isLeavingWindow as O } from "../util/changing-window/is-leaving-window.js";
6
+ import { getBindingsForBrokenDrags as b } from "../util/detect-broken-drag.js";
7
+ import { getInput as d } from "../util/get-input.js";
8
+ import { makeDispatch as P } from "./dispatch-consumer-event.js";
9
+ var v = {
10
+ isActive: !1
11
+ };
12
+ function y() {
13
+ return !v.isActive;
14
+ }
15
+ function F(r) {
16
+ return r.dataTransfer ? r.dataTransfer.setDragImage.bind(r.dataTransfer) : null;
17
+ }
18
+ function I(r) {
19
+ var a = r.current, n = r.next;
20
+ if (a.length !== n.length)
21
+ return !0;
22
+ for (var i = 0; i < a.length; i++)
23
+ if (a[i].element !== n[i].element)
24
+ return !0;
25
+ return !1;
26
+ }
27
+ function w(r) {
28
+ var a = r.event, n = r.dragType, i = r.getDropTargetsOver, u = r.dispatchEvent;
29
+ if (!y())
30
+ return;
31
+ var p = C({
32
+ event: a,
33
+ dragType: n,
34
+ getDropTargetsOver: i
35
+ });
36
+ v.isActive = !0;
37
+ var e = {
38
+ current: p
39
+ };
40
+ f({
41
+ event: a,
42
+ current: p.dropTargets
43
+ });
44
+ var c = P({
45
+ source: n.payload,
46
+ dispatchEvent: u,
47
+ initial: p
48
+ });
49
+ function g(o) {
50
+ var t = I({
51
+ current: e.current.dropTargets,
52
+ next: o.dropTargets
53
+ });
54
+ e.current = o, t && c.dragUpdate({
55
+ current: e.current
56
+ });
57
+ }
58
+ function T(o) {
59
+ var t = d(o), D = A(o.target) ? S({
60
+ x: t.clientX,
61
+ y: t.clientY
62
+ }) : o.target, l = i({
63
+ target: D,
64
+ input: t,
65
+ source: n.payload,
66
+ current: e.current.dropTargets
67
+ });
68
+ l.length && (o.preventDefault(), f({
69
+ event: o,
70
+ current: l
71
+ })), g({
72
+ dropTargets: l,
73
+ input: t
74
+ });
75
+ }
76
+ function s() {
77
+ e.current.dropTargets.length && g({
78
+ dropTargets: [],
79
+ input: e.current.input
80
+ }), c.drop({
81
+ current: e.current,
82
+ updatedSourcePayload: null
83
+ }), m();
84
+ }
85
+ function m() {
86
+ v.isActive = !1, h();
87
+ }
88
+ var h = x.bindAll(
89
+ window,
90
+ [{
91
+ // 👋 Note: we are repurposing the `dragover` event as our `drag` event
92
+ // this is because firefox does not publish pointer coordinates during
93
+ // a `drag` event, but does for every other type of drag event
94
+ // `dragover` fires on all elements that are being dragged over
95
+ // Because we are binding to `window` - our `dragover` is effectively the same as a `drag`
96
+ // 🦊😤
97
+ type: "dragover",
98
+ listener: function(t) {
99
+ T(t), c.drag({
100
+ current: e.current
101
+ });
102
+ }
103
+ }, {
104
+ type: "dragenter",
105
+ listener: T
106
+ }, {
107
+ type: "dragleave",
108
+ listener: function(t) {
109
+ O({
110
+ dragLeave: t
111
+ }) && (g({
112
+ input: e.current.input,
113
+ dropTargets: []
114
+ }), n.startedFrom === "external" && s());
115
+ }
116
+ }, {
117
+ // A "drop" can only happen if the browser allowed the drop
118
+ type: "drop",
119
+ listener: function(t) {
120
+ if (e.current = {
121
+ dropTargets: e.current.dropTargets,
122
+ input: d(t)
123
+ }, !e.current.dropTargets.length) {
124
+ s();
125
+ return;
126
+ }
127
+ t.preventDefault(), f({
128
+ event: t,
129
+ current: e.current.dropTargets
130
+ }), c.drop({
131
+ current: e.current,
132
+ // When dropping something native, we need to extract the latest
133
+ // `.items` from the "drop" event as it is now accessible
134
+ updatedSourcePayload: n.type === "external" ? n.getDropPayload(t) : null
135
+ }), m();
136
+ }
137
+ }, {
138
+ // "dragend" fires when on the drag source (eg a draggable element)
139
+ // when the drag is finished.
140
+ // "dragend" will fire after "drop" (if there was a successful drop)
141
+ // "dragend" does not fire if the draggable source has been removed during the drag
142
+ // or for external drag sources (eg files)
143
+ // This "dragend" listener will not fire if there was a successful drop
144
+ // as we will have already removed the event listener
145
+ type: "dragend",
146
+ listener: function(t) {
147
+ e.current = {
148
+ dropTargets: e.current.dropTargets,
149
+ input: d(t)
150
+ }, s();
151
+ }
152
+ }].concat(E(b({
153
+ onDragEnd: s
154
+ }))),
155
+ // Once we have started a managed drag operation it is important that we see / own all drag events
156
+ // We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)
157
+ // all "drop" events in the bubble phase on the `document.body`.
158
+ // This meant that we never saw the "drop" event.
159
+ {
160
+ capture: !0
161
+ }
162
+ );
163
+ c.start({
164
+ nativeSetDragImage: F(a)
165
+ });
166
+ }
167
+ function f(r) {
168
+ var a, n = r.event, i = r.current, u = (a = i[0]) === null || a === void 0 ? void 0 : a.dropEffect;
169
+ u != null && n.dataTransfer && (n.dataTransfer.dropEffect = u);
170
+ }
171
+ function C(r) {
172
+ var a = r.event, n = r.dragType, i = r.getDropTargetsOver, u = d(a);
173
+ if (n.startedFrom === "external")
174
+ return {
175
+ input: u,
176
+ dropTargets: []
177
+ };
178
+ var p = i({
179
+ input: u,
180
+ source: n.payload,
181
+ target: a.target,
182
+ current: []
183
+ });
184
+ return {
185
+ input: u,
186
+ dropTargets: p
187
+ };
188
+ }
189
+ var X = {
190
+ canStart: y,
191
+ start: w
192
+ };
193
+ export {
194
+ X as lifecycle
195
+ };
@@ -0,0 +1,21 @@
1
+ var u = /* @__PURE__ */ new Map();
2
+ function a(t) {
3
+ var e = t.typeKey, r = t.mount, n = u.get(e);
4
+ if (n)
5
+ return n.usageCount++, n;
6
+ var o = {
7
+ typeKey: e,
8
+ unmount: r(),
9
+ usageCount: 1
10
+ };
11
+ return u.set(e, o), o;
12
+ }
13
+ function i(t) {
14
+ var e = a(t);
15
+ return function() {
16
+ e.usageCount--, !(e.usageCount > 0) && (e.unmount(), u.delete(t.typeKey));
17
+ };
18
+ }
19
+ export {
20
+ i as register
21
+ };
@@ -0,0 +1,43 @@
1
+ import { lifecycle as c } from "../ledger/lifecycle-manager.js";
2
+ import { register as g } from "../ledger/usage-ledger.js";
3
+ import { makeDropTarget as y } from "./make-drop-target.js";
4
+ import { makeMonitor as T } from "./make-monitor.js";
5
+ function A(e) {
6
+ var p = e.typeKey, s = e.mount, r = e.dispatchEventToSource, o = e.onPostDispatch, u = e.defaultDropEffect, i = T(), n = y({
7
+ typeKey: p,
8
+ defaultDropEffect: u
9
+ });
10
+ function m(t) {
11
+ r == null || r(t), n.dispatchEvent(t), i.dispatchEvent(t), o == null || o(t);
12
+ }
13
+ function d(t) {
14
+ var a = t.event, f = t.dragType;
15
+ c.start({
16
+ event: a,
17
+ dragType: f,
18
+ getDropTargetsOver: n.getIsOver,
19
+ dispatchEvent: m
20
+ });
21
+ }
22
+ function v() {
23
+ function t() {
24
+ var a = {
25
+ canStart: c.canStart,
26
+ start: d
27
+ };
28
+ return s(a);
29
+ }
30
+ return g({
31
+ typeKey: p,
32
+ mount: t
33
+ });
34
+ }
35
+ return {
36
+ registerUsage: v,
37
+ dropTarget: n.dropTargetForConsumers,
38
+ monitor: i.monitorForConsumers
39
+ };
40
+ }
41
+ export {
42
+ A as makeAdapter
43
+ };