@deephaven/golden-layout 0.19.2-beta.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/LayoutManager.d.ts +313 -0
  2. package/dist/LayoutManager.d.ts.map +1 -0
  3. package/dist/LayoutManager.js +468 -450
  4. package/dist/LayoutManager.js.map +1 -1
  5. package/dist/base.d.ts +16 -0
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/base.js +6 -6
  8. package/dist/base.js.map +1 -1
  9. package/dist/config/Config.d.ts +146 -0
  10. package/dist/config/Config.d.ts.map +1 -0
  11. package/dist/config/{defaultConfig.js → Config.js} +6 -6
  12. package/dist/config/Config.js.map +1 -0
  13. package/dist/config/ItemConfig.d.ts +66 -0
  14. package/dist/config/ItemConfig.d.ts.map +1 -0
  15. package/dist/config/ItemConfig.js +14 -0
  16. package/dist/config/ItemConfig.js.map +1 -0
  17. package/dist/config/index.d.ts +3 -0
  18. package/dist/config/index.d.ts.map +1 -0
  19. package/dist/config/index.js +2 -6
  20. package/dist/config/index.js.map +1 -1
  21. package/dist/container/ItemContainer.d.ts +91 -0
  22. package/dist/container/ItemContainer.d.ts.map +1 -0
  23. package/dist/container/ItemContainer.js +110 -85
  24. package/dist/container/ItemContainer.js.map +1 -1
  25. package/dist/container/index.d.ts +3 -0
  26. package/dist/container/index.d.ts.map +1 -0
  27. package/dist/container/index.js +2 -4
  28. package/dist/container/index.js.map +1 -1
  29. package/dist/controls/BrowserPopout.d.ts +83 -0
  30. package/dist/controls/BrowserPopout.d.ts.map +1 -0
  31. package/dist/controls/BrowserPopout.js +135 -101
  32. package/dist/controls/BrowserPopout.js.map +1 -1
  33. package/dist/controls/DragProxy.d.ts +67 -0
  34. package/dist/controls/DragProxy.d.ts.map +1 -0
  35. package/dist/controls/DragProxy.js +135 -110
  36. package/dist/controls/DragProxy.js.map +1 -1
  37. package/dist/controls/DragSource.d.ts +30 -0
  38. package/dist/controls/DragSource.d.ts.map +1 -0
  39. package/dist/controls/DragSource.js +37 -29
  40. package/dist/controls/DragSource.js.map +1 -1
  41. package/dist/controls/DragSourceFromEvent.d.ts +30 -0
  42. package/dist/controls/DragSourceFromEvent.d.ts.map +1 -0
  43. package/dist/controls/DragSourceFromEvent.js +49 -36
  44. package/dist/controls/DragSourceFromEvent.js.map +1 -1
  45. package/dist/controls/DropTargetIndicator.d.ts +14 -0
  46. package/dist/controls/DropTargetIndicator.d.ts.map +1 -0
  47. package/dist/controls/DropTargetIndicator.js +18 -14
  48. package/dist/controls/DropTargetIndicator.js.map +1 -1
  49. package/dist/controls/Header.d.ts +145 -0
  50. package/dist/controls/Header.d.ts.map +1 -0
  51. package/dist/controls/Header.js +414 -271
  52. package/dist/controls/Header.js.map +1 -1
  53. package/dist/controls/HeaderButton.d.ts +9 -0
  54. package/dist/controls/HeaderButton.d.ts.map +1 -0
  55. package/dist/controls/HeaderButton.js +19 -13
  56. package/dist/controls/HeaderButton.js.map +1 -1
  57. package/dist/controls/Splitter.d.ts +12 -0
  58. package/dist/controls/Splitter.d.ts.map +1 -0
  59. package/dist/controls/Splitter.js +36 -20
  60. package/dist/controls/Splitter.js.map +1 -1
  61. package/dist/controls/Tab.d.ts +91 -0
  62. package/dist/controls/Tab.d.ts.map +1 -0
  63. package/dist/controls/Tab.js +131 -119
  64. package/dist/controls/Tab.js.map +1 -1
  65. package/dist/controls/TransitionIndicator.d.ts +25 -0
  66. package/dist/controls/TransitionIndicator.d.ts.map +1 -0
  67. package/dist/controls/TransitionIndicator.js +53 -39
  68. package/dist/controls/TransitionIndicator.js.map +1 -1
  69. package/dist/controls/index.d.ts +11 -0
  70. package/dist/controls/index.d.ts.map +1 -0
  71. package/dist/controls/index.js +10 -22
  72. package/dist/controls/index.js.map +1 -1
  73. package/dist/errors/ConfigurationError.d.ts +6 -0
  74. package/dist/errors/ConfigurationError.d.ts.map +1 -0
  75. package/dist/errors/ConfigurationError.js +15 -8
  76. package/dist/errors/ConfigurationError.js.map +1 -1
  77. package/dist/errors/index.d.ts +2 -0
  78. package/dist/errors/index.d.ts.map +1 -0
  79. package/dist/errors/index.js +1 -4
  80. package/dist/errors/index.js.map +1 -1
  81. package/dist/index.d.ts +9 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +7 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/items/AbstractContentItem.d.ts +233 -0
  86. package/dist/items/AbstractContentItem.d.ts.map +1 -0
  87. package/dist/items/AbstractContentItem.js +284 -242
  88. package/dist/items/AbstractContentItem.js.map +1 -1
  89. package/dist/items/Component.d.ts +30 -0
  90. package/dist/items/Component.d.ts.map +1 -0
  91. package/dist/items/Component.js +61 -42
  92. package/dist/items/Component.js.map +1 -1
  93. package/dist/items/Root.d.ts +18 -0
  94. package/dist/items/Root.d.ts.map +1 -0
  95. package/dist/items/Root.js +68 -38
  96. package/dist/items/Root.js.map +1 -1
  97. package/dist/items/RowOrColumn.d.ts +157 -0
  98. package/dist/items/RowOrColumn.d.ts.map +1 -0
  99. package/dist/items/RowOrColumn.js +219 -187
  100. package/dist/items/RowOrColumn.js.map +1 -1
  101. package/dist/items/Stack.d.ts +108 -0
  102. package/dist/items/Stack.d.ts.map +1 -0
  103. package/dist/items/Stack.js +218 -151
  104. package/dist/items/Stack.js.map +1 -1
  105. package/dist/items/index.d.ts +8 -0
  106. package/dist/items/index.d.ts.map +1 -0
  107. package/dist/items/index.js +7 -12
  108. package/dist/items/index.js.map +1 -1
  109. package/dist/utils/BubblingEvent.d.ts +8 -0
  110. package/dist/utils/BubblingEvent.d.ts.map +1 -0
  111. package/dist/utils/BubblingEvent.js +18 -9
  112. package/dist/utils/BubblingEvent.js.map +1 -1
  113. package/dist/utils/ConfigMinifier.d.ts +21 -0
  114. package/dist/utils/ConfigMinifier.d.ts.map +1 -0
  115. package/dist/utils/ConfigMinifier.js +121 -121
  116. package/dist/utils/ConfigMinifier.js.map +1 -1
  117. package/dist/utils/DragListener.d.ts +34 -0
  118. package/dist/utils/DragListener.d.ts.map +1 -0
  119. package/dist/utils/DragListener.js +103 -70
  120. package/dist/utils/DragListener.js.map +1 -1
  121. package/dist/utils/EventEmitter.d.ts +59 -0
  122. package/dist/utils/EventEmitter.d.ts.map +1 -0
  123. package/dist/utils/EventEmitter.js +64 -70
  124. package/dist/utils/EventEmitter.js.map +1 -1
  125. package/dist/utils/EventHub.d.ts +55 -0
  126. package/dist/utils/EventHub.d.ts.map +1 -0
  127. package/dist/utils/EventHub.js +83 -105
  128. package/dist/utils/EventHub.js.map +1 -1
  129. package/dist/utils/ReactComponentHandler.d.ts +54 -0
  130. package/dist/utils/ReactComponentHandler.d.ts.map +1 -0
  131. package/dist/utils/ReactComponentHandler.js +58 -56
  132. package/dist/utils/ReactComponentHandler.js.map +1 -1
  133. package/dist/utils/index.d.ts +8 -0
  134. package/dist/utils/index.d.ts.map +1 -0
  135. package/dist/utils/index.js +7 -21
  136. package/dist/utils/index.js.map +1 -1
  137. package/dist/utils/utils.d.ts +25 -0
  138. package/dist/utils/utils.d.ts.map +1 -0
  139. package/dist/utils/utils.js +21 -145
  140. package/dist/utils/utils.js.map +1 -1
  141. package/package.json +9 -5
  142. package/dist/config/ItemDefaultConfig.js +0 -8
  143. package/dist/config/ItemDefaultConfig.js.map +0 -1
  144. package/dist/config/defaultConfig.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigMinifier.js","names":["utils","ConfigMinifier","_keys","length","Error","_values","copy","prototype","minifyConfig","config","min","_nextLevel","unminifyConfig","minifiedConfig","orig","from","to","translationFn","key","minKey","Array","parseInt","hasOwnProperty","_min","value","dictionary","index","indexOf","toString","_max","substr"],"sources":["../../src/utils/ConfigMinifier.js"],"sourcesContent":["import utils from './utils.js';\n\n/**\n * Minifies and unminifies configs by replacing frequent keys\n * and values with one letter substitutes. Config options must\n * retain array position/index, add new options at the end.\n *\n * @constructor\n */\nconst ConfigMinifier = function () {\n this._keys = [\n 'settings',\n 'hasHeaders',\n 'constrainDragToContainer',\n 'selectionEnabled',\n 'dimensions',\n 'borderWidth',\n 'minItemHeight',\n 'minItemWidth',\n 'headerHeight',\n 'dragProxyWidth',\n 'dragProxyHeight',\n 'labels',\n 'close',\n 'maximise',\n 'minimise',\n 'popout',\n 'content',\n 'componentName',\n 'componentState',\n 'id',\n 'width',\n 'type',\n 'height',\n 'isClosable',\n 'title',\n 'popoutWholeStack',\n 'openPopouts',\n 'parentId',\n 'activeItemIndex',\n 'reorderEnabled',\n 'borderGrabWidth',\n\n //Maximum 36 entries, do not cross this line!\n ];\n if (this._keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n\n this._values = [\n true,\n false,\n 'row',\n 'column',\n 'stack',\n 'component',\n 'close',\n 'maximise',\n 'minimise',\n 'open in new window',\n ];\n};\n\nutils.copy(ConfigMinifier.prototype, {\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter counterparts\n *\n * @param {Object} config A GoldenLayout config object\n *\n * @returns {Object} minified config\n */\n minifyConfig: function (config) {\n var min = {};\n this._nextLevel(config, min, '_min');\n return min;\n },\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n *\n * @param {Object} minifiedConfig\n *\n * @returns {Object} the original configuration\n */\n unminifyConfig: function (minifiedConfig) {\n var orig = {};\n this._nextLevel(minifiedConfig, orig, '_max');\n return orig;\n },\n\n /**\n * Recursive function, called for every level of the config structure\n *\n * @param {Array|Object} orig\n * @param {Array|Object} min\n * @param {String} translationFn\n *\n * @returns {void}\n */\n _nextLevel: function (from, to, translationFn) {\n var key, minKey;\n\n for (key in from) {\n /**\n * For in returns array indices as keys, so let's cast them to numbers\n */\n if (from instanceof Array) key = parseInt(key, 10);\n\n /**\n * In case something has extended Object prototypes\n */\n if (!from.hasOwnProperty(key)) continue;\n\n /**\n * Translate the key to a one letter substitute\n */\n minKey = this[translationFn](key, this._keys);\n\n /**\n * For Arrays and Objects, create a new Array/Object\n * on the minified object and recurse into it\n */\n if (typeof from[key] === 'object') {\n to[minKey] = from[key] instanceof Array ? [] : {};\n this._nextLevel(from[key], to[minKey], translationFn);\n\n /**\n * For primitive values (Strings, Numbers, Boolean etc.)\n * minify the value\n */\n } else {\n to[minKey] = this[translationFn](from[key], this._values);\n }\n }\n },\n\n /**\n * Minifies value based on a dictionary\n *\n * @param {String|Boolean} value\n * @param {Array<String|Boolean>} dictionary\n *\n * @returns {String} The minified version\n */\n _min: function (value, dictionary) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n\n var index = utils.indexOf(value, dictionary);\n\n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n\n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n },\n\n _max: function (value, dictionary) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (typeof value === 'string' && value.length === 1) {\n return dictionary[parseInt(value, 36)];\n }\n\n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (typeof value === 'string' && value.substr(0, 3) === '___') {\n return value[3];\n }\n /**\n * value was not minified\n */\n return value;\n },\n});\n\nexport default ConfigMinifier;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,YAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,GAAY;EACjC,KAAKC,KAAL,GAAa,CACX,UADW,EAEX,YAFW,EAGX,0BAHW,EAIX,kBAJW,EAKX,YALW,EAMX,aANW,EAOX,eAPW,EAQX,cARW,EASX,cATW,EAUX,gBAVW,EAWX,iBAXW,EAYX,QAZW,EAaX,OAbW,EAcX,UAdW,EAeX,UAfW,EAgBX,QAhBW,EAiBX,SAjBW,EAkBX,eAlBW,EAmBX,gBAnBW,EAoBX,IApBW,EAqBX,OAr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D,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACrB,MAAN,KAAiB,CAAlD,EAAqD;MACnD,OAAOsB,UAAU,CAACJ,QAAQ,CAACG,KAAD,EAAQ,EAAR,CAAT,CAAjB;IACD;IAED;AACJ;AACA;AACA;AACA;;;IACI,IAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACM,MAAN,CAAa,CAAb,EAAgB,CAAhB,MAAuB,KAAxD,EAA+D;MAC7D,OAAON,KAAK,CAAC,CAAD,CAAZ;IACD;IACD;AACJ;AACA;;;IACI,OAAOA,KAAP;EACD;AAlIkC,CAArC;AAqIA,eAAevB,cAAf"}
1
+ {"version":3,"file":"ConfigMinifier.js","names":["_keys","_values","minifyConfig","config","length","Error","min","_nextLevel","unminifyConfig","minifiedConfig","orig","from","to","translationFnName","translationFn","_min","_max","key","hasOwnProperty","fromItem","Array","isArray","Number","parseInt","toItem","minKey","value","dictionary","index","indexOf","toString","substr"],"sources":["../../src/utils/ConfigMinifier.ts"],"sourcesContent":["import type { Config } from '../config';\n\n/**\n * Minifies and unminifies configs by replacing frequent keys\n * and values with one letter substitutes. Config options must\n * retain array position/index, add new options at the end.\n */\n\nconst _keys = [\n 'settings',\n 'hasHeaders',\n 'constrainDragToContainer',\n 'selectionEnabled',\n 'dimensions',\n 'borderWidth',\n 'minItemHeight',\n 'minItemWidth',\n 'headerHeight',\n 'dragProxyWidth',\n 'dragProxyHeight',\n 'labels',\n 'close',\n 'maximise',\n 'minimise',\n 'popout',\n 'content',\n 'componentName',\n 'componentState',\n 'id',\n 'width',\n 'type',\n 'height',\n 'isClosable',\n 'title',\n 'popoutWholeStack',\n 'openPopouts',\n 'parentId',\n 'activeItemIndex',\n 'reorderEnabled',\n 'borderGrabWidth',\n\n //Maximum 36 entries, do not cross this line!\n];\n\nconst _values = [\n true,\n false,\n 'row',\n 'column',\n 'stack',\n 'component',\n 'close',\n 'maximise',\n 'minimise',\n 'open in new window',\n];\n\n/**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter counterparts\n *\n * @param config A GoldenLayout config object\n *\n * @returns minified config\n */\nexport function minifyConfig(config: Partial<Config>) {\n if (_keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n\n const min = {};\n _nextLevel(config, min, '_min');\n return min;\n}\n\n/**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n *\n * @param minifiedConfig\n *\n * @returns the original configuration\n */\nexport function unminifyConfig(\n minifiedConfig: Record<string, unknown>\n): Config {\n if (_keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n\n const orig = {};\n _nextLevel(minifiedConfig, orig, '_max');\n return orig as Config;\n}\n\n/**\n * Recursive function, called for every level of the config structure\n *\n * @param orig\n * @param min\n * @param translationFnName\n */\nfunction _nextLevel(\n from: unknown[] | Record<string, unknown>,\n to: unknown[] | Record<string, unknown>,\n translationFnName: '_min' | '_max'\n) {\n const translationFn = translationFnName === '_min' ? _min : _max;\n for (let key in from) {\n /**\n * In case something has extended Object prototypes\n */\n if (!from.hasOwnProperty(key)) continue;\n\n const fromItem = Array.isArray(from)\n ? from[Number.parseInt(key, 10)]\n : from[key];\n /**\n * For Arrays and Objects, create a new Array/Object\n * on the minified object and recurse into it\n */\n if (typeof fromItem === 'object' && fromItem != null) {\n const toItem = fromItem instanceof Array ? [] : {};\n\n if (Array.isArray(to)) {\n to[Number.parseInt(key, 10)] = toItem;\n } else {\n const minKey = translationFn(key, _keys);\n to[minKey] = toItem;\n }\n\n _nextLevel(\n fromItem as Record<string, unknown>,\n toItem,\n translationFnName\n );\n\n /**\n * For primitive values (Strings, Numbers, Boolean etc.)\n * minify the value\n */\n } else {\n const toItem = translationFn(fromItem, _values);\n\n if (Array.isArray(to)) {\n to[Number.parseInt(key, 10)] = toItem;\n } else {\n const minKey = translationFn(key, _keys);\n to[minKey] = toItem;\n }\n }\n }\n}\n\n/**\n * Minifies value based on a dictionary\n *\n * @param value\n * @param dictionary\n *\n * @returns The minified version\n */\nfunction _min<T>(value: T, dictionary: T[]): T | string {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n\n var index = dictionary.indexOf(value);\n\n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n\n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n}\n\nfunction _max<T>(value: T, dictionary: T[]): T | string {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (typeof value === 'string' && value.length === 1) {\n return dictionary[parseInt(value, 36)];\n }\n\n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (typeof value === 'string' && value.substr(0, 3) === '___') {\n return value[3];\n }\n /**\n * value was not minified\n */\n return value;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AAEA,IAAMA,KAAK,GAAG,CACZ,UADY,EAEZ,YAFY,EAGZ,0BAHY,EAIZ,kBAJY,EAKZ,YALY,EAMZ,aANY,EAOZ,eAPY,EAQZ,cARY,EASZ,cATY,EAUZ,gBAVY,EAWZ,iBAXY,EAYZ,QAZY,EAaZ,OAbY,EAcZ,UAdY,EAeZ,UAfY,EAgBZ,QAhBY,EAiBZ,SAjBY,EAkBZ,eAlBY,EAmBZ,gBAnBY,EAoBZ,IApBY,EAqBZ,OArBY,EAsBZ,MAtBY,EAuBZ,QAvBY,EAwBZ,YAxBY,EAyBZ,OAzBY,EA0BZ,kBA1BY,EA2BZ,aA3BY,EA4BZ,UA5BY,EA6BZ,iBA7BY,EA8BZ,gBA9BY,EA+BZ,iBA/BY,CAiCZ;AAjCY,CAAd;AAoCA,IAAMC,OAAO,GAAG,CACd,IADc,EAEd,KAFc,EAGd,KAHc,EAId,QAJc,EAKd,OALc,EAMd,WANc,EAOd,OAPc,EAQd,UARc,EASd,UATc,EAUd,oBAVc,C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EACD;AACF;;AAED,SAASd,IAAT,CAAiBU,KAAjB,EAA2BC,UAA3B,EAAwD;EACtD;AACF;AACA;AACA;EACE,IAAI,OAAOD,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACtB,MAAN,KAAiB,CAAlD,EAAqD;IACnD,OAAOuB,UAAU,CAACJ,QAAQ,CAACG,KAAD,EAAQ,EAAR,CAAT,CAAjB;EACD;EAED;AACF;AACA;AACA;AACA;;;EACE,IAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACK,MAAN,CAAa,CAAb,EAAgB,CAAhB,MAAuB,KAAxD,EAA+D;IAC7D,OAAOL,KAAK,CAAC,CAAD,CAAZ;EACD;EACD;AACF;AACA;;;EACE,OAAOA,KAAP;AACD"}
@@ -0,0 +1,34 @@
1
+ import EventEmitter from './EventEmitter';
2
+ declare class DragListener extends EventEmitter {
3
+ private _eElement;
4
+ private _oDocument;
5
+ private _eBody;
6
+ private _destroyAfterMouseUp;
7
+ /**
8
+ * The delay after which to start the drag in milliseconds
9
+ */
10
+ private _nDelay;
11
+ private _timeout;
12
+ timeout: number | undefined;
13
+ /**
14
+ * The distance the mouse needs to be moved to qualify as a drag
15
+ */
16
+ private _nDistance;
17
+ private _nX;
18
+ private _nY;
19
+ private _nOriginalX;
20
+ private _nOriginalY;
21
+ private _bDragging;
22
+ constructor(eElement: JQuery<HTMLElement>, destroyAfterMouseUp?: boolean);
23
+ destroy(): void;
24
+ onMouseDown(oEvent: JQuery.TriggeredEvent): void;
25
+ onMouseMove(oEvent: JQuery.TriggeredEvent): void;
26
+ onMouseUp(oEvent: JQuery.TriggeredEvent): void;
27
+ _startDrag(): void;
28
+ _getCoordinates(event: JQuery.TriggeredEvent): {
29
+ x: number | undefined;
30
+ y: number | undefined;
31
+ };
32
+ }
33
+ export default DragListener;
34
+ //# sourceMappingURL=DragListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragListener.d.ts","sourceRoot":"","sources":["../../src/utils/DragListener.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,YAAa,SAAQ,YAAY;IACrC,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,MAAM,CAAkC;IAEhD,OAAO,CAAC,oBAAoB,CAAU;IAEtC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAO;IAEtB,OAAO,CAAC,QAAQ,CAAqB;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,GAAG,CAAK;IAEhB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAK;IAExB,OAAO,CAAC,UAAU,CAAS;gBAEf,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,mBAAmB,UAAQ;IAkBtE,OAAO;IAYP,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAgBzC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAwBzC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAuBvC,UAAU;IASV,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc;;;;CAU7C;AAED,eAAe,YAAY,CAAC"}
@@ -1,75 +1,100 @@
1
- import $ from 'jquery';
2
- import utils from './utils.js';
3
- import EventEmitter from './EventEmitter.js';
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
2
 
5
- var DragListener = function DragListener(eElement, destroyAfterMouseUp) {
6
- EventEmitter.call(this);
7
- this._eElement = $(eElement);
8
- this._oDocument = $(document);
9
- this._eBody = $(document.body); // used by drag sources, to destroy listener at the right time
3
+ import $ from 'jquery';
4
+ import EventEmitter from "./EventEmitter.js";
10
5
 
11
- this._destroyAfterMouseUp = destroyAfterMouseUp || false;
6
+ class DragListener extends EventEmitter {
12
7
  /**
13
8
  * The delay after which to start the drag in milliseconds
14
9
  */
15
10
 
16
- this._nDelay = 400;
17
- this._timeout = null;
18
11
  /**
19
12
  * The distance the mouse needs to be moved to qualify as a drag
20
13
  */
14
+ //TODO - works better with delay only
15
+ constructor(eElement) {
16
+ var _this$_eElement;
17
+
18
+ var destroyAfterMouseUp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
19
+ super();
20
+
21
+ _defineProperty(this, "_eElement", void 0);
22
+
23
+ _defineProperty(this, "_oDocument", void 0);
24
+
25
+ _defineProperty(this, "_eBody", void 0);
26
+
27
+ _defineProperty(this, "_destroyAfterMouseUp", void 0);
28
+
29
+ _defineProperty(this, "_nDelay", 400);
30
+
31
+ _defineProperty(this, "_timeout", void 0);
32
+
33
+ _defineProperty(this, "timeout", void 0);
34
+
35
+ _defineProperty(this, "_nDistance", 10);
36
+
37
+ _defineProperty(this, "_nX", 0);
21
38
 
22
- this._nDistance = 10; //TODO - works better with delay only
39
+ _defineProperty(this, "_nY", 0);
23
40
 
24
- this._nX = 0;
25
- this._nY = 0;
26
- this._nOriginalX = 0;
27
- this._nOriginalY = 0;
28
- this._bDragging = false;
29
- this._fMove = utils.fnBind(this.onMouseMove, this);
30
- this._fUp = utils.fnBind(this.onMouseUp, this);
31
- this._fDown = utils.fnBind(this.onMouseDown, this);
41
+ _defineProperty(this, "_nOriginalX", 0);
32
42
 
33
- this._eElement.on('mousedown', this._fDown);
34
- };
43
+ _defineProperty(this, "_nOriginalY", 0);
35
44
 
36
- DragListener.timeout = null;
37
- utils.copy(DragListener.prototype, {
38
- destroy: function destroy() {
39
- this._eElement.unbind('mousedown', this._fDown);
45
+ _defineProperty(this, "_bDragging", false);
40
46
 
41
- this._oDocument.unbind('mouseup', this._fUp);
47
+ this._eElement = eElement;
48
+ this._oDocument = $(document);
49
+ this._eBody = $(document.body); // used by drag sources, to destroy listener at the right time
42
50
 
43
- this._eElement = null;
44
- this._oDocument = null;
45
- this._eBody = null;
51
+ this._destroyAfterMouseUp = destroyAfterMouseUp;
52
+ this.onMouseMove = this.onMouseMove.bind(this);
53
+ this.onMouseUp = this.onMouseUp.bind(this);
54
+ this.onMouseDown = this.onMouseDown.bind(this);
55
+ this._startDrag = this._startDrag.bind(this); // https://github.com/microsoft/TypeScript/issues/48546
56
+
57
+ (_this$_eElement = this._eElement) === null || _this$_eElement === void 0 ? void 0 : _this$_eElement.on('mousedown', this.onMouseDown);
58
+ }
59
+
60
+ destroy() {
61
+ var _this$_eElement2, _this$_oDocument;
62
+
63
+ (_this$_eElement2 = this._eElement) === null || _this$_eElement2 === void 0 ? void 0 : _this$_eElement2.unbind('mousedown', this.onMouseDown);
64
+ (_this$_oDocument = this._oDocument) === null || _this$_oDocument === void 0 ? void 0 : _this$_oDocument.unbind('mouseup', this.onMouseUp);
65
+ this._eElement = undefined;
66
+ this._oDocument = undefined;
67
+ this._eBody = undefined;
46
68
  clearTimeout(this._timeout);
47
- this._timeout = null;
48
- },
49
- onMouseDown: function onMouseDown(oEvent) {
69
+ this._timeout = undefined;
70
+ }
71
+
72
+ onMouseDown(oEvent) {
50
73
  oEvent.preventDefault();
51
74
 
52
75
  if (oEvent.button === 0) {
53
- var coordinates = this._getCoordinates(oEvent);
54
-
55
- this._nOriginalX = coordinates.x;
56
- this._nOriginalY = coordinates.y;
57
-
58
- this._oDocument.on('mousemove', this._fMove);
76
+ var _coordinates$x, _coordinates$y, _this$_oDocument2, _this$_oDocument3;
59
77
 
60
- this._oDocument.one('mouseup', this._fUp);
78
+ var coordinates = this._getCoordinates(oEvent);
61
79
 
62
- this._timeout = setTimeout(utils.fnBind(this._startDrag, this), this._nDelay);
80
+ this._nOriginalX = (_coordinates$x = coordinates.x) !== null && _coordinates$x !== void 0 ? _coordinates$x : 0;
81
+ this._nOriginalY = (_coordinates$y = coordinates.y) !== null && _coordinates$y !== void 0 ? _coordinates$y : 0;
82
+ (_this$_oDocument2 = this._oDocument) === null || _this$_oDocument2 === void 0 ? void 0 : _this$_oDocument2.on('mousemove', this.onMouseMove);
83
+ (_this$_oDocument3 = this._oDocument) === null || _this$_oDocument3 === void 0 ? void 0 : _this$_oDocument3.on('mouseup', this.onMouseUp);
84
+ this._timeout = window.setTimeout(this._startDrag, this._nDelay);
63
85
  }
64
- },
65
- onMouseMove: function onMouseMove(oEvent) {
86
+ }
87
+
88
+ onMouseMove(oEvent) {
66
89
  if (this._timeout != null) {
90
+ var _coordinates$x2, _coordinates$y2;
91
+
67
92
  oEvent.preventDefault();
68
93
 
69
94
  var coordinates = this._getCoordinates(oEvent);
70
95
 
71
- this._nX = coordinates.x - this._nOriginalX;
72
- this._nY = coordinates.y - this._nOriginalY;
96
+ this._nX = ((_coordinates$x2 = coordinates.x) !== null && _coordinates$x2 !== void 0 ? _coordinates$x2 : 0) - this._nOriginalX;
97
+ this._nY = ((_coordinates$y2 = coordinates.y) !== null && _coordinates$y2 !== void 0 ? _coordinates$y2 : 0) - this._nOriginalY;
73
98
 
74
99
  if (this._bDragging === false) {
75
100
  if (Math.abs(this._nX) > this._nDistance || Math.abs(this._nY) > this._nDistance) {
@@ -81,16 +106,16 @@ utils.copy(DragListener.prototype, {
81
106
  this.emit('drag', this._nX, this._nY, oEvent);
82
107
  }
83
108
  }
84
- },
85
- onMouseUp: function onMouseUp(oEvent) {
86
- if (this._timeout != null) {
87
- clearTimeout(this._timeout);
88
-
89
- this._oDocument.unbind('mousemove', this._fMove);
109
+ }
90
110
 
91
- this._oDocument.unbind('mouseup', this._fUp);
111
+ onMouseUp(oEvent) {
112
+ if (this._timeout != null) {
113
+ var _this$_oDocument4, _this$_oDocument5, _this$_oDocument6, _this$_oDocument6$fin, _this$_eBody;
92
114
 
93
- this._oDocument.find('iframe').css('pointer-events', '');
115
+ clearTimeout(this._timeout);
116
+ (_this$_oDocument4 = this._oDocument) === null || _this$_oDocument4 === void 0 ? void 0 : _this$_oDocument4.unbind('mousemove', this.onMouseMove);
117
+ (_this$_oDocument5 = this._oDocument) === null || _this$_oDocument5 === void 0 ? void 0 : _this$_oDocument5.unbind('mouseup', this.onMouseUp);
118
+ (_this$_oDocument6 = this._oDocument) === null || _this$_oDocument6 === void 0 ? void 0 : (_this$_oDocument6$fin = _this$_oDocument6.find('iframe')) === null || _this$_oDocument6$fin === void 0 ? void 0 : _this$_oDocument6$fin.css('pointer-events', '');
94
119
 
95
120
  if (this._bDragging === true) {
96
121
  this._bDragging = false;
@@ -99,30 +124,38 @@ utils.copy(DragListener.prototype, {
99
124
  // and any overflow: hidden remains applied during the calculations
100
125
 
101
126
 
102
- if (this._eBody) this._eBody.removeClass('lm_dragging');
103
- if (this._eElement) this._eElement.removeClass('lm_dragging');
104
- if (this._destroyAfterMouseUp) this.destroy();
105
- }
106
- },
107
- _startDrag: function _startDrag() {
108
- clearTimeout(this._timeout);
109
- this._bDragging = true;
127
+ (_this$_eBody = this._eBody) === null || _this$_eBody === void 0 ? void 0 : _this$_eBody.removeClass('lm_dragging');
128
+
129
+ if (!(this._eElement instanceof Window)) {
130
+ var _this$_eElement3;
110
131
 
111
- this._eBody.addClass('lm_dragging');
132
+ (_this$_eElement3 = this._eElement) === null || _this$_eElement3 === void 0 ? void 0 : _this$_eElement3.removeClass('lm_dragging');
133
+ }
112
134
 
113
- this._eElement.addClass('lm_dragging');
135
+ if (this._destroyAfterMouseUp) this.destroy();
136
+ }
137
+ }
114
138
 
115
- this._oDocument.find('iframe').css('pointer-events', 'none');
139
+ _startDrag() {
140
+ var _this$_eBody2, _this$_eElement4, _this$_oDocument7, _this$_oDocument7$fin;
116
141
 
142
+ window.clearTimeout(this._timeout);
143
+ this._bDragging = true;
144
+ (_this$_eBody2 = this._eBody) === null || _this$_eBody2 === void 0 ? void 0 : _this$_eBody2.addClass('lm_dragging');
145
+ (_this$_eElement4 = this._eElement) === null || _this$_eElement4 === void 0 ? void 0 : _this$_eElement4.addClass('lm_dragging');
146
+ (_this$_oDocument7 = this._oDocument) === null || _this$_oDocument7 === void 0 ? void 0 : (_this$_oDocument7$fin = _this$_oDocument7.find('iframe')) === null || _this$_oDocument7$fin === void 0 ? void 0 : _this$_oDocument7$fin.css('pointer-events', 'none');
117
147
  this.emit('dragStart', this._nOriginalX, this._nOriginalY);
118
- },
119
- _getCoordinates: function _getCoordinates(event) {
120
- event = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0] : event;
148
+ }
149
+
150
+ _getCoordinates(event) {
151
+ var baseEvent = event.originalEvent instanceof TouchEvent ? event.originalEvent.touches[0] : event;
121
152
  return {
122
- x: event.pageX,
123
- y: event.pageY
153
+ x: baseEvent.pageX,
154
+ y: baseEvent.pageY
124
155
  };
125
156
  }
126
- });
157
+
158
+ }
159
+
127
160
  export default DragListener;
128
161
  //# sourceMappingURL=DragListener.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragListener.js","names":["$","utils","EventEmitter","DragListener","eElement","destroyAfterMouseUp","call","_eElement","_oDocument","document","_eBody","body","_destroyAfterMouseUp","_nDelay","_timeout","_nDistance","_nX","_nY","_nOriginalX","_nOriginalY","_bDragging","_fMove","fnBind","onMouseMove","_fUp","onMouseUp","_fDown","onMouseDown","on","timeout","copy","prototype","destroy","unbind","clearTimeout","oEvent","preventDefault","button","coordinates","_getCoordinates","x","y","one","setTimeout","_startDrag","Math","abs","emit","find","css","removeClass","addClass","event","originalEvent","touches","pageX","pageY"],"sources":["../../src/utils/DragListener.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from './utils.js';\nimport EventEmitter from './EventEmitter.js';\n\nconst DragListener = function (eElement, destroyAfterMouseUp) {\n EventEmitter.call(this);\n\n this._eElement = $(eElement);\n this._oDocument = $(document);\n this._eBody = $(document.body);\n // used by drag sources, to destroy listener at the right time\n this._destroyAfterMouseUp = destroyAfterMouseUp || false;\n\n /**\n * The delay after which to start the drag in milliseconds\n */\n this._nDelay = 400;\n this._timeout = null;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n */\n this._nDistance = 10; //TODO - works better with delay only\n\n this._nX = 0;\n this._nY = 0;\n\n this._nOriginalX = 0;\n this._nOriginalY = 0;\n\n this._bDragging = false;\n\n this._fMove = utils.fnBind(this.onMouseMove, this);\n this._fUp = utils.fnBind(this.onMouseUp, this);\n this._fDown = utils.fnBind(this.onMouseDown, this);\n\n this._eElement.on('mousedown', this._fDown);\n};\n\nDragListener.timeout = null;\n\nutils.copy(DragListener.prototype, {\n destroy: function () {\n this._eElement.unbind('mousedown', this._fDown);\n this._oDocument.unbind('mouseup', this._fUp);\n\n this._eElement = null;\n this._oDocument = null;\n this._eBody = null;\n\n clearTimeout(this._timeout);\n this._timeout = null;\n },\n\n onMouseDown: function (oEvent) {\n oEvent.preventDefault();\n\n if (oEvent.button === 0) {\n var coordinates = this._getCoordinates(oEvent);\n\n this._nOriginalX = coordinates.x;\n this._nOriginalY = coordinates.y;\n\n this._oDocument.on('mousemove', this._fMove);\n this._oDocument.one('mouseup', this._fUp);\n\n this._timeout = setTimeout(\n utils.fnBind(this._startDrag, this),\n this._nDelay\n );\n }\n },\n\n onMouseMove: function (oEvent) {\n if (this._timeout != null) {\n oEvent.preventDefault();\n\n var coordinates = this._getCoordinates(oEvent);\n\n this._nX = coordinates.x - this._nOriginalX;\n this._nY = coordinates.y - this._nOriginalY;\n\n if (this._bDragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this._startDrag();\n }\n }\n\n if (this._bDragging) {\n this.emit('drag', this._nX, this._nY, oEvent);\n }\n }\n },\n\n onMouseUp: function (oEvent) {\n if (this._timeout != null) {\n clearTimeout(this._timeout);\n this._oDocument.unbind('mousemove', this._fMove);\n this._oDocument.unbind('mouseup', this._fUp);\n this._oDocument.find('iframe').css('pointer-events', '');\n\n if (this._bDragging === true) {\n this._bDragging = false;\n this.emit('dragStop', oEvent, this._nOriginalX + this._nX);\n }\n\n // after dragStop, so that .lm_dragging is removed after size is processed\n // and any overflow: hidden remains applied during the calculations\n if (this._eBody) this._eBody.removeClass('lm_dragging');\n if (this._eElement) this._eElement.removeClass('lm_dragging');\n\n if (this._destroyAfterMouseUp) this.destroy();\n }\n },\n\n _startDrag: function () {\n clearTimeout(this._timeout);\n this._bDragging = true;\n this._eBody.addClass('lm_dragging');\n this._eElement.addClass('lm_dragging');\n this._oDocument.find('iframe').css('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n },\n\n _getCoordinates: function (event) {\n event =\n event.originalEvent && event.originalEvent.touches\n ? event.originalEvent.touches[0]\n : event;\n return {\n x: event.pageX,\n y: event.pageY,\n };\n },\n});\n\nexport default DragListener;\n"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,YAAlB;AACA,OAAOC,YAAP,MAAyB,mBAAzB;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAAUC,QAAV,EAAoBC,mBAApB,EAAyC;EAC5DH,YAAY,CAACI,IAAb,CAAkB,IAAlB;EAEA,KAAKC,SAAL,GAAiBP,CAAC,CAACI,QAAD,CAAlB;EACA,KAAKI,UAAL,GAAkBR,CAAC,CAACS,QAAD,CAAnB;EACA,KAAKC,MAAL,GAAcV,CAAC,CAACS,QAAQ,CAACE,IAAV,CAAf,CAL4D,CAM5D;;EACA,KAAKC,oBAAL,GAA4BP,mBAAmB,IAAI,KAAnD;EAEA;AACF;AACA;;EACE,KAAKQ,OAAL,GAAe,GAAf;EACA,KAAKC,QAAL,GAAgB,IAAhB;EAEA;AACF;AACA;;EACE,KAAKC,UAAL,GAAkB,EAAlB,CAlB4D,CAkBtC;;EAEtB,KAAKC,GAAL,GAAW,CAAX;EACA,KAAKC,GAAL,GAAW,CAAX;EAEA,KAAKC,WAAL,GAAmB,CAAnB;EACA,KAAKC,WAAL,GAAmB,CAAnB;EAEA,KAAKC,UAAL,GAAkB,KAAlB;EAEA,KAAKC,MAAL,GAAcpB,K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IAAxB,EAA8B;QAC5B,KAAKA,UAAL,GAAkB,KAAlB;QACA,KAAK2B,IAAL,CAAU,UAAV,EAAsBZ,MAAtB,EAA8B,KAAKjB,WAAL,GAAmB,KAAKF,GAAtD;MACD,CATwB,CAWzB;MACA;;;MACA,IAAI,KAAKN,MAAT,EAAiB,KAAKA,MAAL,CAAYwC,WAAZ,CAAwB,aAAxB;MACjB,IAAI,KAAK3C,SAAT,EAAoB,KAAKA,SAAL,CAAe2C,WAAf,CAA2B,aAA3B;MAEpB,IAAI,KAAKtC,oBAAT,EAA+B,KAAKoB,OAAL;IAChC;EACF,CA3EgC;EA6EjCY,UAAU,EAAE,sBAAY;IACtBV,YAAY,CAAC,KAAKpB,QAAN,CAAZ;IACA,KAAKM,UAAL,GAAkB,IAAlB;;IACA,KAAKV,MAAL,CAAYyC,QAAZ,CAAqB,aAArB;;IACA,KAAK5C,SAAL,CAAe4C,QAAf,CAAwB,aAAxB;;IACA,KAAK3C,UAAL,CAAgBwC,IAAhB,CAAqB,QAArB,EAA+BC,GAA/B,CAAmC,gBAAnC,EAAqD,MAArD;;IACA,KAAKF,IAAL,CAAU,WAAV,EAAuB,KAAK7B,WAA5B,EAAyC,KAAKC,WAA9C;EACD,CApFgC;EAsFjCoB,eAAe,EAAE,yBAAUa,KAAV,EAAiB;IAChCA,KAAK,GACHA,KAAK,CAACC,aAAN,IAAuBD,KAAK,CAACC,aAAN,CAAoBC,OAA3C,GACIF,KAAK,CAACC,aAAN,CAAoBC,OAApB,CAA4B,CAA5B,CADJ,GAEIF,KAHN;IAIA,OAAO;MACLZ,CAAC,EAAEY,KAAK,CAACG,KADJ;MAELd,CAAC,EAAEW,KAAK,CAACI;IAFJ,CAAP;EAID;AA/FgC,CAAnC;AAkGA,eAAerD,YAAf"}
1
+ {"version":3,"file":"DragListener.js","names":["$","EventEmitter","DragListener","constructor","eElement","destroyAfterMouseUp","_eElement","_oDocument","document","_eBody","body","_destroyAfterMouseUp","onMouseMove","bind","onMouseUp","onMouseDown","_startDrag","on","destroy","unbind","undefined","clearTimeout","_timeout","oEvent","preventDefault","button","coordinates","_getCoordinates","_nOriginalX","x","_nOriginalY","y","window","setTimeout","_nDelay","_nX","_nY","_bDragging","Math","abs","_nDistance","emit","find","css","removeClass","Window","addClass","event","baseEvent","originalEvent","TouchEvent","touches","pageX","pageY"],"sources":["../../src/utils/DragListener.ts"],"sourcesContent":["import $ from 'jquery';\nimport EventEmitter from './EventEmitter';\n\nclass DragListener extends EventEmitter {\n private _eElement: JQuery<HTMLElement> | undefined;\n private _oDocument: JQuery<Document> | undefined;\n private _eBody: JQuery<HTMLElement> | undefined;\n\n private _destroyAfterMouseUp: boolean;\n\n /**\n * The delay after which to start the drag in milliseconds\n */\n private _nDelay = 400;\n\n private _timeout: number | undefined;\n public timeout: number | undefined;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n */\n private _nDistance = 10; //TODO - works better with delay only\n\n private _nX = 0;\n private _nY = 0;\n\n private _nOriginalX = 0;\n private _nOriginalY = 0;\n\n private _bDragging = false;\n\n constructor(eElement: JQuery<HTMLElement>, destroyAfterMouseUp = false) {\n super();\n\n this._eElement = eElement;\n this._oDocument = $(document);\n this._eBody = $(document.body);\n // used by drag sources, to destroy listener at the right time\n this._destroyAfterMouseUp = destroyAfterMouseUp;\n\n this.onMouseMove = this.onMouseMove.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this._startDrag = this._startDrag.bind(this);\n\n // https://github.com/microsoft/TypeScript/issues/48546\n this._eElement?.on('mousedown', this.onMouseDown);\n }\n\n destroy() {\n this._eElement?.unbind('mousedown', this.onMouseDown);\n this._oDocument?.unbind('mouseup', this.onMouseUp);\n\n this._eElement = undefined;\n this._oDocument = undefined;\n this._eBody = undefined;\n\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n onMouseDown(oEvent: JQuery.TriggeredEvent) {\n oEvent.preventDefault();\n\n if (oEvent.button === 0) {\n var coordinates = this._getCoordinates(oEvent);\n\n this._nOriginalX = coordinates.x ?? 0;\n this._nOriginalY = coordinates.y ?? 0;\n\n this._oDocument?.on('mousemove', this.onMouseMove);\n this._oDocument?.on('mouseup', this.onMouseUp);\n\n this._timeout = window.setTimeout(this._startDrag, this._nDelay);\n }\n }\n\n onMouseMove(oEvent: JQuery.TriggeredEvent) {\n if (this._timeout != null) {\n oEvent.preventDefault();\n\n var coordinates = this._getCoordinates(oEvent);\n\n this._nX = (coordinates.x ?? 0) - this._nOriginalX;\n this._nY = (coordinates.y ?? 0) - this._nOriginalY;\n\n if (this._bDragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this._startDrag();\n }\n }\n\n if (this._bDragging) {\n this.emit('drag', this._nX, this._nY, oEvent);\n }\n }\n }\n\n onMouseUp(oEvent: JQuery.TriggeredEvent) {\n if (this._timeout != null) {\n clearTimeout(this._timeout);\n this._oDocument?.unbind('mousemove', this.onMouseMove);\n this._oDocument?.unbind('mouseup', this.onMouseUp);\n this._oDocument?.find('iframe')?.css('pointer-events', '');\n\n if (this._bDragging === true) {\n this._bDragging = false;\n this.emit('dragStop', oEvent, this._nOriginalX + this._nX);\n }\n\n // after dragStop, so that .lm_dragging is removed after size is processed\n // and any overflow: hidden remains applied during the calculations\n this._eBody?.removeClass('lm_dragging');\n if (!(this._eElement instanceof Window)) {\n this._eElement?.removeClass('lm_dragging');\n }\n\n if (this._destroyAfterMouseUp) this.destroy();\n }\n }\n\n _startDrag() {\n window.clearTimeout(this._timeout);\n this._bDragging = true;\n this._eBody?.addClass('lm_dragging');\n this._eElement?.addClass('lm_dragging');\n this._oDocument?.find('iframe')?.css('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n }\n\n _getCoordinates(event: JQuery.TriggeredEvent) {\n const baseEvent =\n event.originalEvent instanceof TouchEvent\n ? event.originalEvent.touches[0]\n : event;\n return {\n x: baseEvent.pageX,\n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B;IACA,0BAAKvC,UAAL,iGAAiBmC,IAAjB,CAAsB,QAAtB,iFAAiCC,GAAjC,CAAqC,gBAArC,EAAuD,MAAvD;IACA,KAAKF,IAAL,CAAU,WAAV,EAAuB,KAAKb,WAA5B,EAAyC,KAAKE,WAA9C;EACD;;EAEDH,eAAe,CAACoB,KAAD,EAA+B;IAC5C,IAAMC,SAAS,GACbD,KAAK,CAACE,aAAN,YAA+BC,UAA/B,GACIH,KAAK,CAACE,aAAN,CAAoBE,OAApB,CAA4B,CAA5B,CADJ,GAEIJ,KAHN;IAIA,OAAO;MACLlB,CAAC,EAAEmB,SAAS,CAACI,KADR;MAELrB,CAAC,EAAEiB,SAAS,CAACK;IAFR,CAAP;EAID;;AA3IqC;;AA8IxC,eAAenD,YAAf"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A generic and very fast EventEmitter
3
+ * implementation. On top of emitting the
4
+ * actual event it emits an
5
+ *
6
+ * EventEmitter.ALL_EVENT
7
+ *
8
+ * event for every event triggered. This allows
9
+ * to hook into it and proxy events forwards
10
+ *
11
+ * @constructor
12
+ */
13
+ declare class EventEmitter {
14
+ /**
15
+ * The name of the event that's triggered for every other event
16
+ *
17
+ * usage
18
+ *
19
+ * myEmitter.on( EventEmitter.ALL_EVENT, function( eventName, argsArray ){
20
+ * //do stuff
21
+ * });
22
+ */
23
+ static ALL_EVENT: string;
24
+ private _mSubscriptions;
25
+ constructor();
26
+ /**
27
+ * Listen for events
28
+ *
29
+ * @param eventName The name of the event to listen to
30
+ * @param callback The callback to execute when the event occurs
31
+ * @param context The value of the this pointer within the callback function
32
+ */
33
+ on(eventName: string, callback: Function, context?: unknown): void;
34
+ /**
35
+ * Emit an event and notify listeners
36
+ *
37
+ * @param eventName The name of the event
38
+ * @param args additional arguments that will be passed to the listener
39
+ */
40
+ emit(eventName: string, ...args: unknown[]): void;
41
+ /**
42
+ * Removes a listener for an event, or all listeners if no callback and context is provided.
43
+ *
44
+ * @param eventName The name of the event
45
+ * @param callback The previously registered callback method (optional)
46
+ * @param context The previously registered context (optional)
47
+ */
48
+ unbind(eventName: string, callback?: Function, context?: unknown): void;
49
+ /**
50
+ * Alias for unbind
51
+ */
52
+ off: (eventName: string, callback?: Function | undefined, context?: unknown) => void;
53
+ /**
54
+ * Alias for emit
55
+ */
56
+ trigger: (eventName: string, ...args: unknown[]) => void;
57
+ }
58
+ export default EventEmitter;
59
+ //# sourceMappingURL=EventEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../src/utils/EventEmitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAM,YAAY;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,SAAW;IAE3B,OAAO,CAAC,eAAe,CAAoD;;IAO3E;;;;;;OAMG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAiBlE;;;;;OAKG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAoB1C;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO;IAsBhE;;OAEG;IACH,GAAG,cAzBe,MAAM,6CAAiC,OAAO,UAyB9C;IAElB;;OAEG;IACH,OAAO,cAzDS,MAAM,WAAW,OAAO,EAAE,UAyDtB;CACrB;AAED,eAAe,YAAY,CAAC"}