@atlaskit/pragmatic-drag-and-drop 1.0.0 → 1.0.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 (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/combine/package.json +1 -1
  3. package/dist/cjs/adapter/element-adapter.js +7 -0
  4. package/dist/cjs/adapter/external-adapter.js +8 -0
  5. package/dist/cjs/adapter/text-selection-adapter.js +9 -1
  6. package/dist/cjs/entry-point/types.js +1 -5
  7. package/dist/cjs/internal-types.js +1 -5
  8. package/dist/es2019/adapter/element-adapter.js +15 -0
  9. package/dist/es2019/adapter/external-adapter.js +16 -0
  10. package/dist/es2019/adapter/text-selection-adapter.js +17 -1
  11. package/dist/es2019/entry-point/types.js +0 -1
  12. package/dist/es2019/internal-types.js +0 -1
  13. package/dist/esm/adapter/element-adapter.js +7 -0
  14. package/dist/esm/adapter/external-adapter.js +8 -0
  15. package/dist/esm/adapter/text-selection-adapter.js +9 -1
  16. package/dist/esm/entry-point/types.js +0 -1
  17. package/dist/esm/internal-types.js +0 -1
  18. package/element/adapter/package.json +1 -1
  19. package/element/center-under-pointer/package.json +1 -1
  20. package/element/disable-native-drag-preview/package.json +1 -1
  21. package/element/format-urls-for-external/package.json +1 -1
  22. package/element/pointer-outside-of-preview/package.json +1 -1
  23. package/element/preserve-offset-on-source/package.json +1 -1
  24. package/element/scroll-just-enough-into-view/package.json +1 -1
  25. package/element/set-custom-native-drag-preview/package.json +1 -1
  26. package/external/adapter/package.json +1 -1
  27. package/external/file/package.json +1 -1
  28. package/external/html/package.json +1 -1
  29. package/external/some/package.json +1 -1
  30. package/external/text/package.json +1 -1
  31. package/external/url/package.json +1 -1
  32. package/once/package.json +1 -1
  33. package/package.json +3 -3
  34. package/prevent-unhandled/package.json +1 -1
  35. package/reorder/package.json +1 -1
  36. package/text-selection/adapter/package.json +1 -1
  37. package/types/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/pragmatic-drag-and-drop
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#76476](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76476) [`35148e092790`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35148e092790) - Adding warning for test environments to let people know if DragEvents have not been setup correctly.
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/combine.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/entry-point/combine.d.ts"
12
12
  ]
@@ -51,6 +51,13 @@ var adapter = (0, _makeAdapter.makeAdapter)({
51
51
  // If there is not `dataTransfer`, we can assume something is wrong and not
52
52
  // start a drag
53
53
  if (!event.dataTransfer) {
54
+ // Including this code on "test" and "development" environments:
55
+ // - Browser tests commonly run against "development" builds
56
+ // - Unit tests commonly run in "test"
57
+ if (process.env.NODE_ENV !== 'production') {
58
+ // eslint-disable-next-line no-console
59
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
60
+ }
54
61
  return;
55
62
  }
56
63
 
@@ -74,6 +74,13 @@ var adapter = (0, _makeAdapter.makeAdapter)({
74
74
 
75
75
  // Something has gone wrong with our drag event
76
76
  if (!event.dataTransfer) {
77
+ // Including this code on "test" and "development" environments:
78
+ // - Browser tests commonly run against "development" builds
79
+ // - Unit tests commonly run in "test"
80
+ if (process.env.NODE_ENV !== 'production') {
81
+ // eslint-disable-next-line no-console
82
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
83
+ }
77
84
  return;
78
85
  }
79
86
  if (!api.canStart(event)) {
@@ -182,6 +189,7 @@ function monitorForExternal(args) {
182
189
  // independent of pdnd, we need to keep track of
183
190
  // all drag operations so that we can know if a drag operation
184
191
  // has started locally
192
+
185
193
  var idle = {
186
194
  type: 'idle'
187
195
  };
@@ -74,7 +74,14 @@ var adapter = (0, _makeAdapter.makeAdapter)({
74
74
  }
75
75
 
76
76
  // Something has gone wrong with our drag event
77
- if (event.dataTransfer == null) {
77
+ if (!event.dataTransfer) {
78
+ // Including this code on "test" and "development" environments:
79
+ // - Browser tests commonly run against "development" builds
80
+ // - Unit tests commonly run in "test"
81
+ if (process.env.NODE_ENV !== 'production') {
82
+ // eslint-disable-next-line no-console
83
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
84
+ }
78
85
  return;
79
86
  }
80
87
 
@@ -115,6 +122,7 @@ var adapter = (0, _makeAdapter.makeAdapter)({
115
122
 
116
123
  // The `onGenerateDragPreview` does not make sense to publish for text selection
117
124
  // as the browser is completely in control of the drag preview
125
+
118
126
  function dropTargetForTextSelection(args) {
119
127
  // note: not removing `onGenerateDragPreview`; just leaning on the type system
120
128
  return adapter.dropTarget(args);
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -42,6 +42,21 @@ const adapter = makeAdapter({
42
42
  // If there is not `dataTransfer`, we can assume something is wrong and not
43
43
  // start a drag
44
44
  if (!event.dataTransfer) {
45
+ // Including this code on "test" and "development" environments:
46
+ // - Browser tests commonly run against "development" builds
47
+ // - Unit tests commonly run in "test"
48
+ if (process.env.NODE_ENV !== 'production') {
49
+ // eslint-disable-next-line no-console
50
+ console.warn(`
51
+ It appears as though you have are not testing DragEvents correctly.
52
+
53
+ - If you are unit testing, ensure you have pollyfilled DragEvent.
54
+ - If you are browser testing, ensure you are dispatching drag events correctly.
55
+
56
+ Please see our testing guides for more information:
57
+ https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing
58
+ `.replace(/ {2}/g, ''));
59
+ }
45
60
  return;
46
61
  }
47
62
 
@@ -59,6 +59,21 @@ const adapter = makeAdapter({
59
59
 
60
60
  // Something has gone wrong with our drag event
61
61
  if (!event.dataTransfer) {
62
+ // Including this code on "test" and "development" environments:
63
+ // - Browser tests commonly run against "development" builds
64
+ // - Unit tests commonly run in "test"
65
+ if (process.env.NODE_ENV !== 'production') {
66
+ // eslint-disable-next-line no-console
67
+ console.warn(`
68
+ It appears as though you have are not testing DragEvents correctly.
69
+
70
+ - If you are unit testing, ensure you have pollyfilled DragEvent.
71
+ - If you are browser testing, ensure you are dispatching drag events correctly.
72
+
73
+ Please see our testing guides for more information:
74
+ https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing
75
+ `.replace(/ {2}/g, ''));
76
+ }
62
77
  return;
63
78
  }
64
79
  if (!api.canStart(event)) {
@@ -165,6 +180,7 @@ export function monitorForExternal(args) {
165
180
  // independent of pdnd, we need to keep track of
166
181
  // all drag operations so that we can know if a drag operation
167
182
  // has started locally
183
+
168
184
  const idle = {
169
185
  type: 'idle'
170
186
  };
@@ -65,7 +65,22 @@ const adapter = makeAdapter({
65
65
  }
66
66
 
67
67
  // Something has gone wrong with our drag event
68
- if (event.dataTransfer == null) {
68
+ if (!event.dataTransfer) {
69
+ // Including this code on "test" and "development" environments:
70
+ // - Browser tests commonly run against "development" builds
71
+ // - Unit tests commonly run in "test"
72
+ if (process.env.NODE_ENV !== 'production') {
73
+ // eslint-disable-next-line no-console
74
+ console.warn(`
75
+ It appears as though you have are not testing DragEvents correctly.
76
+
77
+ - If you are unit testing, ensure you have pollyfilled DragEvent.
78
+ - If you are browser testing, ensure you are dispatching drag events correctly.
79
+
80
+ Please see our testing guides for more information:
81
+ https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing
82
+ `.replace(/ {2}/g, ''));
83
+ }
69
84
  return;
70
85
  }
71
86
 
@@ -106,6 +121,7 @@ const adapter = makeAdapter({
106
121
 
107
122
  // The `onGenerateDragPreview` does not make sense to publish for text selection
108
123
  // as the browser is completely in control of the drag preview
124
+
109
125
  export function dropTargetForTextSelection(args) {
110
126
  // note: not removing `onGenerateDragPreview`; just leaning on the type system
111
127
  return adapter.dropTarget(args);
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -43,6 +43,13 @@ var adapter = makeAdapter({
43
43
  // If there is not `dataTransfer`, we can assume something is wrong and not
44
44
  // start a drag
45
45
  if (!event.dataTransfer) {
46
+ // Including this code on "test" and "development" environments:
47
+ // - Browser tests commonly run against "development" builds
48
+ // - Unit tests commonly run in "test"
49
+ if (process.env.NODE_ENV !== 'production') {
50
+ // eslint-disable-next-line no-console
51
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
52
+ }
46
53
  return;
47
54
  }
48
55
 
@@ -63,6 +63,13 @@ var adapter = makeAdapter({
63
63
 
64
64
  // Something has gone wrong with our drag event
65
65
  if (!event.dataTransfer) {
66
+ // Including this code on "test" and "development" environments:
67
+ // - Browser tests commonly run against "development" builds
68
+ // - Unit tests commonly run in "test"
69
+ if (process.env.NODE_ENV !== 'production') {
70
+ // eslint-disable-next-line no-console
71
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
72
+ }
66
73
  return;
67
74
  }
68
75
  if (!api.canStart(event)) {
@@ -171,6 +178,7 @@ export function monitorForExternal(args) {
171
178
  // independent of pdnd, we need to keep track of
172
179
  // all drag operations so that we can know if a drag operation
173
180
  // has started locally
181
+
174
182
  var idle = {
175
183
  type: 'idle'
176
184
  };
@@ -67,7 +67,14 @@ var adapter = makeAdapter({
67
67
  }
68
68
 
69
69
  // Something has gone wrong with our drag event
70
- if (event.dataTransfer == null) {
70
+ if (!event.dataTransfer) {
71
+ // Including this code on "test" and "development" environments:
72
+ // - Browser tests commonly run against "development" builds
73
+ // - Unit tests commonly run in "test"
74
+ if (process.env.NODE_ENV !== 'production') {
75
+ // eslint-disable-next-line no-console
76
+ console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have pollyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ''));
77
+ }
71
78
  return;
72
79
  }
73
80
 
@@ -108,6 +115,7 @@ var adapter = makeAdapter({
108
115
 
109
116
  // The `onGenerateDragPreview` does not make sense to publish for text selection
110
117
  // as the browser is completely in control of the drag preview
118
+
111
119
  export function dropTargetForTextSelection(args) {
112
120
  // note: not removing `onGenerateDragPreview`; just leaning on the type system
113
121
  return adapter.dropTarget(args);
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/adapter.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/adapter.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/center-under-pointer.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/center-under-pointer.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/disable-native-drag-preview.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/disable-native-drag-preview.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/format-urls-for-external.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/format-urls-for-external.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/pointer-outside-of-preview.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/pointer-outside-of-preview.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/preserve-offset-on-source.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/preserve-offset-on-source.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/scroll-just-enough-into-view.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/scroll-just-enough-into-view.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/element/set-custom-native-drag-preview.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/element/set-custom-native-drag-preview.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/adapter.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/adapter.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/file.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/file.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/html.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/html.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/some.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/some.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/text.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/text.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/external/url.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/external/url.d.ts"
12
12
  ]
package/once/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/once.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/entry-point/once.d.ts"
12
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Fast drag and drop for any experience on any tech stack",
5
5
  "repository": "https://github.com/atlassian/pragmatic-drag-and-drop",
6
6
  "author": "Atlassian Pty Ltd",
@@ -79,7 +79,7 @@
79
79
  "react": "^16.8.0",
80
80
  "react-dom": "^16.8.0",
81
81
  "tiny-invariant": "^1.2.0",
82
- "typescript": "~4.9.5",
82
+ "typescript": "~5.4.2",
83
83
  "wait-for-expect": "^1.2.0"
84
84
  },
85
85
  "techstack": {
@@ -107,4 +107,4 @@
107
107
  },
108
108
  "homepage": "https://atlassian.design/components/pragmatic-drag-and-drop/",
109
109
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
110
- }
110
+ }
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/prevent-unhandled.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/entry-point/prevent-unhandled.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/reorder.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/entry-point/reorder.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/text-selection/adapter.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../../dist/types-ts4.5/entry-point/text-selection/adapter.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/types.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <4.9": {
9
+ ">=4.5 <5.4": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/entry-point/types.d.ts"
12
12
  ]