easy-layout 5.0.102 → 5.0.107

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.
package/lib/index.js CHANGED
@@ -2,12 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "options", {
6
- enumerable: true,
7
- get: function() {
8
- return _options.default;
9
- }
10
- });
11
5
  Object.defineProperty(exports, "RowDiv", {
12
6
  enumerable: true,
13
7
  get: function() {
@@ -44,6 +38,12 @@ Object.defineProperty(exports, "SizeableDiv", {
44
38
  return _sizeable.default;
45
39
  }
46
40
  });
41
+ Object.defineProperty(exports, "SizeableSection", {
42
+ enumerable: true,
43
+ get: function() {
44
+ return _sizeable1.default;
45
+ }
46
+ });
47
47
  Object.defineProperty(exports, "VerticalSplitterDiv", {
48
48
  enumerable: true,
49
49
  get: function() {
@@ -56,13 +56,13 @@ Object.defineProperty(exports, "HorizontalSplitterDiv", {
56
56
  return _horizontal.default;
57
57
  }
58
58
  });
59
- var _options = _interopRequireDefault(require("./options"));
60
59
  var _row = _interopRequireDefault(require("./div/row"));
61
60
  var _rows = _interopRequireDefault(require("./div/rows"));
62
61
  var _column = _interopRequireDefault(require("./div/column"));
63
62
  var _columns = _interopRequireDefault(require("./div/columns"));
64
63
  var _splitter = _interopRequireDefault(require("./div/splitter"));
65
64
  var _sizeable = _interopRequireDefault(require("./div/sizeable"));
65
+ var _sizeable1 = _interopRequireDefault(require("./section/sizeable"));
66
66
  var _vertical = _interopRequireDefault(require("./div/splitter/vertical"));
67
67
  var _horizontal = _interopRequireDefault(require("./div/splitter/horizontal"));
68
68
  function _interopRequireDefault(obj) {
@@ -71,4 +71,4 @@ function _interopRequireDefault(obj) {
71
71
  };
72
72
  }
73
73
 
74
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29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JBQXlCO2lEQUN2QiwyQkFBMkIifQ==
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = void 0;
6
+ var _easyWithStyle = _interopRequireDefault(require("easy-with-style"));
7
+ var _easy = require("easy");
8
+ function _assertThisInitialized(self) {
9
+ if (self === void 0) {
10
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11
+ }
12
+ return self;
13
+ }
14
+ function _classCallCheck(instance, Constructor) {
15
+ if (!(instance instanceof Constructor)) {
16
+ throw new TypeError("Cannot call a class as a function");
17
+ }
18
+ }
19
+ function isNativeReflectConstruct() {
20
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
21
+ if (Reflect.construct.sham) return false;
22
+ if (typeof Proxy === "function") return true;
23
+ try {
24
+ Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
25
+ return true;
26
+ } catch (e) {
27
+ return false;
28
+ }
29
+ }
30
+ function _construct(Parent, args, Class) {
31
+ if (isNativeReflectConstruct()) {
32
+ _construct = Reflect.construct;
33
+ } else {
34
+ _construct = function _construct(Parent, args, Class) {
35
+ var a = [
36
+ null
37
+ ];
38
+ a.push.apply(a, args);
39
+ var Constructor = Function.bind.apply(Parent, a);
40
+ var instance = new Constructor();
41
+ if (Class) _setPrototypeOf(instance, Class.prototype);
42
+ return instance;
43
+ };
44
+ }
45
+ return _construct.apply(null, arguments);
46
+ }
47
+ function _defineProperty(obj, key, value) {
48
+ if (key in obj) {
49
+ Object.defineProperty(obj, key, {
50
+ value: value,
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true
54
+ });
55
+ } else {
56
+ obj[key] = value;
57
+ }
58
+ return obj;
59
+ }
60
+ function _getPrototypeOf(o) {
61
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
62
+ return o.__proto__ || Object.getPrototypeOf(o);
63
+ };
64
+ return _getPrototypeOf(o);
65
+ }
66
+ function _inherits(subClass, superClass) {
67
+ if (typeof superClass !== "function" && superClass !== null) {
68
+ throw new TypeError("Super expression must either be null or a function");
69
+ }
70
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
71
+ constructor: {
72
+ value: subClass,
73
+ writable: true,
74
+ configurable: true
75
+ }
76
+ });
77
+ if (superClass) _setPrototypeOf(subClass, superClass);
78
+ }
79
+ function _interopRequireDefault(obj) {
80
+ return obj && obj.__esModule ? obj : {
81
+ default: obj
82
+ };
83
+ }
84
+ function _isNativeFunction(fn) {
85
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
86
+ }
87
+ function _possibleConstructorReturn(self, call) {
88
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
89
+ return call;
90
+ }
91
+ return _assertThisInitialized(self);
92
+ }
93
+ function _setPrototypeOf(o, p) {
94
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
95
+ o.__proto__ = p;
96
+ return o;
97
+ };
98
+ return _setPrototypeOf(o, p);
99
+ }
100
+ function _taggedTemplateLiteral(strings, raw) {
101
+ if (!raw) {
102
+ raw = strings.slice(0);
103
+ }
104
+ return Object.freeze(Object.defineProperties(strings, {
105
+ raw: {
106
+ value: Object.freeze(raw)
107
+ }
108
+ }));
109
+ }
110
+ var _typeof = function(obj) {
111
+ "@swc/helpers - typeof";
112
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
113
+ };
114
+ function _wrapNativeSuper(Class) {
115
+ var _cache = typeof Map === "function" ? new Map() : undefined;
116
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
117
+ if (Class === null || !_isNativeFunction(Class)) return Class;
118
+ if (typeof Class !== "function") {
119
+ throw new TypeError("Super expression must either be null or a function");
120
+ }
121
+ if (typeof _cache !== "undefined") {
122
+ if (_cache.has(Class)) return _cache.get(Class);
123
+ _cache.set(Class, Wrapper);
124
+ }
125
+ function Wrapper() {
126
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
127
+ }
128
+ Wrapper.prototype = Object.create(Class.prototype, {
129
+ constructor: {
130
+ value: Wrapper,
131
+ enumerable: false,
132
+ writable: true,
133
+ configurable: true
134
+ }
135
+ });
136
+ return _setPrototypeOf(Wrapper, Class);
137
+ };
138
+ return _wrapNativeSuper(Class);
139
+ }
140
+ function _isNativeReflectConstruct() {
141
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
142
+ if (Reflect.construct.sham) return false;
143
+ if (typeof Proxy === "function") return true;
144
+ try {
145
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
146
+ return true;
147
+ } catch (e) {
148
+ return false;
149
+ }
150
+ }
151
+ function _createSuper(Derived) {
152
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
153
+ return function _createSuperInternal() {
154
+ var Super = _getPrototypeOf(Derived), result;
155
+ if (hasNativeReflectConstruct) {
156
+ var NewTarget = _getPrototypeOf(this).constructor;
157
+ result = Reflect.construct(Super, arguments, NewTarget);
158
+ } else {
159
+ result = Super.apply(this, arguments);
160
+ }
161
+ return _possibleConstructorReturn(this, result);
162
+ };
163
+ }
164
+ function _templateObject() {
165
+ var data = _taggedTemplateLiteral([
166
+ "\n\n display: flex;\n \n"
167
+ ]);
168
+ _templateObject = function _templateObject() {
169
+ return data;
170
+ };
171
+ return data;
172
+ }
173
+ var SizeableSection = /*#__PURE__*/ function(Element) {
174
+ _inherits(SizeableSection, Element);
175
+ var _super = _createSuper(SizeableSection);
176
+ function SizeableSection() {
177
+ _classCallCheck(this, SizeableSection);
178
+ return _super.apply(this, arguments);
179
+ }
180
+ return SizeableSection;
181
+ }(_wrapNativeSuper(_easy.Element));
182
+ _defineProperty(SizeableSection, "tagName", "section");
183
+ _defineProperty(SizeableSection, "defaultProperties", {
184
+ className: "sizeable"
185
+ });
186
+ var _default = (0, _easyWithStyle).default(SizeableSection)(_templateObject());
187
+ exports.default = _default;
188
+
189
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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ozs7QUFFOUIsSUFBQSxBQUFNQSxlQUFlLGlCQVFsQixBQVJIOzs7YUFBTUEsZUFBZTs7Ozs7Q0FNcEIsa0JBTjZCQyxLQUFPLFFBQUEsRUFNcEM7QUFMQyxnQkFESUQsZUFBZSxFQUNaRSxTQUFPLEVBQUcsU0FBUyxDQUFDO0FBRTNCLGdCQUhJRixlQUFlLEVBR1pHLG1CQUFpQixFQUFHO0lBQ3pCQyxTQUFTLEVBQUUsVUFBVTtDQUN0QixDQUFDO2VBR1dDLENBQUFBLEdBQUFBLGNBQVMsQUFBaUIsQ0FBQSxRQUFqQixDQUFDTCxlQUFlLENBQUMifQ==
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "easy-layout",
3
3
  "author": "James Smith",
4
- "version": "5.0.102",
4
+ "version": "5.0.107",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/easy-layout",
7
7
  "description": "Layout elements that work with CSS flexbox.",
@@ -10,8 +10,9 @@
10
10
  "url": "https://github.com/djalbat/easy-layout"
11
11
  },
12
12
  "dependencies": {
13
- "easy": "^13.0.33",
14
- "easy-with-style": "^3.0.126"
13
+ "easy": "^13.0.41",
14
+ "easy-drag-and-drop": "^1.2.52",
15
+ "easy-with-style": "^3.0.128"
15
16
  },
16
17
  "devDependencies": {
17
18
  "@swc/core": "^1.2.50",
package/src/constants.js CHANGED
@@ -4,4 +4,3 @@ export const AUTO = "auto";
4
4
  export const CURSOR = "cursor";
5
5
  export const COL_RESIZE = "col-resize";
6
6
  export const ROW_RESIZE = "row-resize";
7
- export const ESCAPE_KEY_CODE = 27;
@@ -2,14 +2,10 @@
2
2
 
3
3
  import withStyle from "easy-with-style"; ///
4
4
 
5
- import { eventTypes } from "easy";
6
-
7
5
  import Splitter from "../splitter";
8
6
 
9
7
  import { rowResizeCursor } from "../../cursor";
10
8
 
11
- const { DRAG_EVENT_TYPE } = eventTypes;
12
-
13
9
  class HorizontalSplitter extends Splitter {
14
10
  mouseOverHandler(event, element) {
15
11
  const disabled = this.isDisabled();
@@ -19,93 +15,52 @@ class HorizontalSplitter extends Splitter {
19
15
  }
20
16
  }
21
17
 
22
- mouseMoveHandler(event, element) {
23
- const { pageY } = event,
24
- mouseTop = pageY, ///
25
- disabled = this.isDisabled();
18
+ startDragHandler(element) {
19
+ const disabled = this.isDisabled();
26
20
 
27
21
  if (!disabled) {
28
- const dragging = this.isDragging();
29
-
30
- if (dragging) {
31
- const direction = this.getDirection(),
32
- sizeableDiv = this.getSizeableDiv();
33
-
34
- const previousMouseTop = this.getPreviousMouseTop(),
35
- previousSizeableDivHeight = this.getPreviousSizeableDivHeight(),
36
- relativeMouseTop = mouseTop - previousMouseTop;
37
-
38
- let sizeableDivHeight = previousSizeableDivHeight - direction * relativeMouseTop;
22
+ const sizeableElement = this.getSizeableElement(),
23
+ sizeableElementHeight = sizeableElement.getHeight(),
24
+ previousSizeableElementHeight = sizeableElementHeight; ///
39
25
 
40
- const height = sizeableDivHeight, ///
41
- eventType = DRAG_EVENT_TYPE;
26
+ this.setPreviousSizeableElementHeight(previousSizeableElementHeight);
42
27
 
43
- sizeableDiv.setHeight(height);
44
-
45
- sizeableDivHeight = sizeableDiv.getHeight(); ///
46
-
47
- this.callHandlers(eventType, sizeableDivHeight);
48
- }
28
+ rowResizeCursor();
49
29
  }
50
30
  }
51
31
 
52
- mouseDownHandler(event, element) {
53
- const { pageY } = event,
54
- mouseTop = pageY, ///
55
- disabled = this.isDisabled();
32
+ dragHandler(relativeMouseTop, relativeMouseLeft) {
33
+ const disabled = this.isDisabled();
56
34
 
57
35
  if (!disabled) {
58
- const dragging = this.isDragging(),
59
- sizeableDiv = this.getSizeableDiv(),
60
- previousMouseTop = mouseTop, ///
61
- sizeableDivHeight = sizeableDiv.getHeight(),
62
- previousSizeableDivHeight = sizeableDivHeight; ///
63
-
64
- this.setPreviousMouseTop(previousMouseTop);
36
+ const direction = this.getDirection(),
37
+ sizeableElement = this.getSizeableElement(),
38
+ previousSizeableElementHeight = this.getPreviousSizeableElementHeight(),
39
+ sizeableElementHeight = previousSizeableElementHeight - direction * relativeMouseTop,
40
+ height = sizeableElementHeight; ///
65
41
 
66
- this.setPreviousSizeableDivHeight(previousSizeableDivHeight);
67
-
68
- rowResizeCursor();
69
-
70
- if (!dragging) {
71
- this.startDrag();
72
- }
42
+ sizeableElement.setHeight(height);
73
43
  }
74
44
  }
75
45
 
76
- getPreviousMouseTop() {
46
+ getPreviousSizeableElementHeight() {
77
47
  const state = this.getState(),
78
- { previousMouseTop } = state;
48
+ { previousSizeableElementHeight } = state;
79
49
 
80
- return previousMouseTop;
81
- }
82
-
83
- getPreviousSizeableDivHeight() {
84
- const state = this.getState(),
85
- { previousSizeableDivHeight } = state;
86
-
87
- return previousSizeableDivHeight;
88
- }
89
-
90
- setPreviousMouseTop(previousMouseTop) {
91
- this.updateState({
92
- previousMouseTop
93
- });
50
+ return previousSizeableElementHeight;
94
51
  }
95
52
 
96
- setPreviousSizeableDivHeight(previousSizeableDivHeight) {
53
+ setPreviousSizeableElementHeight(previousSizeableElementHeight) {
97
54
  this.updateState({
98
- previousSizeableDivHeight
55
+ previousSizeableElementHeight
99
56
  });
100
57
  }
101
58
 
102
59
  setInitialState() {
103
- const previousMouseTop = null,
104
- previousSizeableDivHeight = null;
60
+ const previousSizeableElementHeight = null;
105
61
 
106
62
  this.setState({
107
- previousMouseTop,
108
- previousSizeableDivHeight
63
+ previousSizeableElementHeight
109
64
  });
110
65
  }
111
66
 
@@ -2,14 +2,10 @@
2
2
 
3
3
  import withStyle from "easy-with-style"; ///
4
4
 
5
- import { eventTypes } from "easy";
6
-
7
5
  import Splitter from "../splitter";
8
6
 
9
7
  import { columnResizeCursor } from "../../cursor";
10
8
 
11
- const { DRAG_EVENT_TYPE } = eventTypes;
12
-
13
9
  class VerticalSplitter extends Splitter {
14
10
  mouseOverHandler(event, element) {
15
11
  const disabled = this.isDisabled();
@@ -19,93 +15,52 @@ class VerticalSplitter extends Splitter {
19
15
  }
20
16
  }
21
17
 
22
- mouseMoveHandler(event, element) {
23
- const { pageX } = event,
24
- mouseLeft = pageX, ///
25
- disabled = this.isDisabled();
18
+ startDragHandler(element) {
19
+ const disabled = this.isDisabled();
26
20
 
27
21
  if (!disabled) {
28
- const dragging = this.isDragging();
29
-
30
- if (dragging) {
31
- const direction = this.getDirection(),
32
- sizeableDiv = this.getSizeableDiv();
33
-
34
- const previousMouseLeft = this.getPreviousMouseLeft(),
35
- previousSizeableDivWidth = this.getPreviousSizeableDivWidth(),
36
- relativeMouseLeft = mouseLeft - previousMouseLeft;
37
-
38
- let sizeableDivWidth = previousSizeableDivWidth - direction * relativeMouseLeft;
22
+ const sizeableElement = this.getSizeableElement(),
23
+ sizeableElementWidth = sizeableElement.getWidth(),
24
+ previousSizeableElementWidth = sizeableElementWidth; ///
39
25
 
40
- const width = sizeableDivWidth, ///
41
- eventType = DRAG_EVENT_TYPE;
26
+ this.setPreviousSizeableElementWidth(previousSizeableElementWidth);
42
27
 
43
- sizeableDiv.setWidth(width);
44
-
45
- sizeableDivWidth = sizeableDiv.getWidth(); ///
46
-
47
- this.callHandlers(eventType, sizeableDivWidth);
48
- }
28
+ columnResizeCursor();
49
29
  }
50
30
  }
51
31
 
52
- mouseDownHandler(event, element) {
53
- const { pageX } = event,
54
- mouseLeft = pageX, ///
55
- disabled = this.isDisabled();
32
+ dragHandler(relativeMouseTop, relativeMouseLeft) {
33
+ const disabled = this.isDisabled();
56
34
 
57
35
  if (!disabled) {
58
- const dragging = this.isDragging(),
59
- sizeableDiv = this.getSizeableDiv(),
60
- previousMouseLeft = mouseLeft, ///
61
- sizeableDivWidth = sizeableDiv.getWidth(),
62
- previousSizeableDivWidth = sizeableDivWidth; ///
63
-
64
- this.setPreviousMouseLeft(previousMouseLeft);
36
+ const direction = this.getDirection(),
37
+ sizeableElement = this.getSizeableElement(),
38
+ previousSizeableElementWidth = this.getPreviousSizeableElementWidth(),
39
+ sizeableElementWidth = previousSizeableElementWidth - direction * relativeMouseLeft,
40
+ width = sizeableElementWidth; ///
65
41
 
66
- this.setPreviousSizeableDivWidth(previousSizeableDivWidth);
67
-
68
- columnResizeCursor();
69
-
70
- if (!dragging) {
71
- this.startDrag();
72
- }
42
+ sizeableElement.setWidth(width);
73
43
  }
74
44
  }
75
45
 
76
- getPreviousMouseLeft() {
46
+ getPreviousSizeableElementWidth() {
77
47
  const state = this.getState(),
78
- { previousMouseLeft } = state;
48
+ { previousSizeableElementWidth } = state;
79
49
 
80
- return previousMouseLeft;
81
- }
82
-
83
- getPreviousSizeableDivWidth() {
84
- const state = this.getState(),
85
- { previousSizeableDivWidth } = state;
86
-
87
- return previousSizeableDivWidth;
88
- }
89
-
90
- setPreviousMouseLeft(previousMouseLeft) {
91
- this.updateState({
92
- previousMouseLeft
93
- });
50
+ return previousSizeableElementWidth;
94
51
  }
95
52
 
96
- setPreviousSizeableDivWidth(previousSizeableDivWidth) {
53
+ setPreviousSizeableElementWidth(previousSizeableElementWidth) {
97
54
  this.updateState({
98
- previousSizeableDivWidth
55
+ previousSizeableElementWidth
99
56
  });
100
57
  }
101
58
 
102
59
  setInitialState() {
103
- const previousMouseLeft = null,
104
- previousSizeableDivWidth = null;
60
+ const previousSizeableElementWidth = null;
105
61
 
106
62
  this.setState({
107
- previousMouseLeft,
108
- previousSizeableDivWidth
63
+ previousSizeableElementWidth
109
64
  });
110
65
  }
111
66