react-dialogger 1.1.142 → 1.1.145

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.
@@ -164,7 +164,7 @@ var DialogContent = function (props) {
164
164
  (0, react_1.useEffect)(function () {
165
165
  var _a, _b;
166
166
  dialogOptions.scale = zoom;
167
- if (((_a = dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) && ((_b = dialogOptions.base) === null || _b === void 0 ? void 0 : _b.id)) {
167
+ if (((_a = dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) && ((_b = dialogOptions.base) === null || _b === void 0 ? void 0 : _b.id) && bounds) {
168
168
  // const gb = getDialogBounds(dialogOptions.base.id)
169
169
  (0, _helpers_1.setDialogBounds)(dialogOptions.base.id, __assign(__assign({}, bounds), { scale: zoom }), dialogRef);
170
170
  }
@@ -20,19 +20,14 @@ declare class Resizeable {
20
20
  private _startVisualHeight;
21
21
  private _startCssLeft;
22
22
  private _startCssTop;
23
+ private _anchorRight;
24
+ private _anchorBottom;
25
+ private _translateX;
26
+ private _translateY;
23
27
  constructor();
24
28
  setContainer: (container: React.RefObject<HTMLDivElement>, options: DialogOptionsType) => void;
25
- /**
26
- * Read the Draggable component's current CSS transform translation.
27
- * react-draggable applies transform: translate(x, y) to the element.
28
- * We need this to correctly compute absolute CSS position from visual position.
29
- */
30
29
  private getDraggableTranslate;
31
30
  private resizeHandleMouseUp;
32
- /**
33
- * Returns a mousedown handler for the given resize direction.
34
- * Captures start position and visual bounds so mousemove can compute deltas.
35
- */
36
31
  resizeHandleMouseDown: (direction: ResizeDirection) => (e: React.MouseEvent) => void;
37
32
  resizeHandleMouseMove: (e: MouseEvent) => void;
38
33
  init: () => void;
@@ -20,7 +20,6 @@ var Resizeable = /** @class */ (function () {
20
20
  this.onResizeListener = function (callbackFn) {
21
21
  _this._onResizeListener = callbackFn;
22
22
  };
23
- // Multi-direction resize state
24
23
  this._direction = 'se';
25
24
  this._startMouseX = 0;
26
25
  this._startMouseY = 0;
@@ -28,15 +27,14 @@ var Resizeable = /** @class */ (function () {
28
27
  this._startVisualHeight = 0;
29
28
  this._startCssLeft = 0;
30
29
  this._startCssTop = 0;
30
+ this._anchorRight = 0;
31
+ this._anchorBottom = 0;
32
+ this._translateX = 0;
33
+ this._translateY = 0;
31
34
  this.setContainer = function (container, options) {
32
35
  _this._container = container;
33
36
  _this._dialogOptions = options;
34
37
  };
35
- /**
36
- * Read the Draggable component's current CSS transform translation.
37
- * react-draggable applies transform: translate(x, y) to the element.
38
- * We need this to correctly compute absolute CSS position from visual position.
39
- */
40
38
  this.getDraggableTranslate = function () {
41
39
  var _a;
42
40
  var el = (_a = _this._container) === null || _a === void 0 ? void 0 : _a.current;
@@ -56,10 +54,6 @@ var Resizeable = /** @class */ (function () {
56
54
  (0, appLogger_1.appLog)('resizeHandleMouseUp', container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON());
57
55
  (0, _helpers_1.setDialogBounds)(_this._dialogOptions.base.id, __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { fullscreen: false }), _this._container);
58
56
  };
59
- /**
60
- * Returns a mousedown handler for the given resize direction.
61
- * Captures start position and visual bounds so mousemove can compute deltas.
62
- */
63
57
  this.resizeHandleMouseDown = function (direction) { return function (e) {
64
58
  e.preventDefault();
65
59
  e.stopPropagation();
@@ -67,17 +61,19 @@ var Resizeable = /** @class */ (function () {
67
61
  _this._isResizing = true;
68
62
  _this._startMouseX = e.clientX;
69
63
  _this._startMouseY = e.clientY;
70
- var rect = _this._container.current.getBoundingClientRect();
64
+ var container = _this._container.current;
65
+ var rect = container.getBoundingClientRect();
71
66
  var translate = _this.getDraggableTranslate();
72
- // Visual dimensions from getBoundingClientRect (screen pixels, zoom accounted)
73
67
  _this._startVisualWidth = rect.width;
74
68
  _this._startVisualHeight = rect.height;
75
- // CSS position = visual position minus Draggable's transform offset
69
+ _this._translateX = translate.x;
70
+ _this._translateY = translate.y;
76
71
  _this._startCssLeft = rect.left - translate.x;
77
72
  _this._startCssTop = rect.top - translate.y;
78
- // Pin absolute position immediately so justify-self / margin centering
79
- // cannot shift the left/top edge while we resize from the right or bottom.
80
- var container = _this._container.current;
73
+ _this._anchorRight = rect.right - translate.x;
74
+ _this._anchorBottom = rect.bottom - translate.y;
75
+ // Pin position so justify-self / margin centering cannot shift
76
+ // the left/top edge while resizing from the right or bottom.
81
77
  container.style.position = 'absolute';
82
78
  container.style.left = _this._startCssLeft + 'px';
83
79
  container.style.top = _this._startCssTop + 'px';
@@ -93,43 +89,35 @@ var Resizeable = /** @class */ (function () {
93
89
  var dx = e.clientX - _this._startMouseX;
94
90
  var dy = e.clientY - _this._startMouseY;
95
91
  var dir = _this._direction;
96
- var MIN_SIZE = 100; // screen pixels
92
+ var MIN_SIZE = 100;
97
93
  var newVisualWidth = _this._startVisualWidth;
98
94
  var newVisualHeight = _this._startVisualHeight;
99
95
  var newCssLeft = _this._startCssLeft;
100
96
  var newCssTop = _this._startCssTop;
101
- // East — grow/shrink from the right edge
102
- if (dir.includes('e')) {
97
+ if (dir.includes('e'))
103
98
  newVisualWidth = Math.max(MIN_SIZE, _this._startVisualWidth + dx);
104
- }
105
- // West — grow/shrink from the left edge, compensate position
106
- if (dir.includes('w')) {
107
- newVisualWidth = Math.max(MIN_SIZE, _this._startVisualWidth - dx);
108
- // left edge moves by the amount width actually changed
109
- newCssLeft = _this._startCssLeft + (_this._startVisualWidth - newVisualWidth);
110
- }
111
- // South — grow/shrink from the bottom edge
112
- if (dir.includes('s')) {
99
+ if (dir.includes('s'))
113
100
  newVisualHeight = Math.max(MIN_SIZE, _this._startVisualHeight + dy);
101
+ if (dir.includes('w')) {
102
+ newCssLeft = e.clientX - _this._translateX;
103
+ newVisualWidth = Math.max(MIN_SIZE, _this._anchorRight - newCssLeft);
104
+ newCssLeft = _this._anchorRight - newVisualWidth;
114
105
  }
115
- // North — grow/shrink from the top edge, compensate position
116
106
  if (dir.includes('n')) {
117
- newVisualHeight = Math.max(MIN_SIZE, _this._startVisualHeight - dy);
118
- // top edge moves by the amount height actually changed, clamped to 0
119
- newCssTop = Math.max(0, _this._startCssTop + (_this._startVisualHeight - newVisualHeight));
107
+ newCssTop = e.clientY - _this._translateY;
108
+ newVisualHeight = Math.max(MIN_SIZE, _this._anchorBottom - newCssTop);
109
+ newCssTop = _this._anchorBottom - newVisualHeight;
120
110
  }
121
- // Apply size (divide by scale to get CSS pixels from visual pixels)
122
111
  container.style.width = (newVisualWidth / scale) + 'px';
123
112
  container.style.height = (newVisualHeight / scale) + 'px';
124
- // Apply position for n/w directions
125
113
  if (dir.includes('w') || dir.includes('n')) {
126
114
  container.style.position = 'absolute';
127
115
  container.style.left = newCssLeft + 'px';
128
- container.style.top = Math.max(0, newCssTop) + 'px';
116
+ container.style.top = newCssTop + 'px';
129
117
  }
130
118
  _this._width = newVisualWidth / scale;
131
119
  _this._height = newVisualHeight / scale;
132
- if (typeof _this._onResizeListener === "function") {
120
+ if (typeof _this._onResizeListener === 'function') {
133
121
  _this._onResizeListener(_this._width, _this._height, container.getBoundingClientRect());
134
122
  }
135
123
  };
@@ -153,26 +141,18 @@ var Resizeable = /** @class */ (function () {
153
141
  this._isResizing = false;
154
142
  }
155
143
  Object.defineProperty(Resizeable.prototype, "width", {
156
- get: function () {
157
- return this._width;
158
- },
144
+ get: function () { return this._width; },
159
145
  enumerable: false,
160
146
  configurable: true
161
147
  });
162
148
  Object.defineProperty(Resizeable.prototype, "height", {
163
- get: function () {
164
- return this._height;
165
- },
149
+ get: function () { return this._height; },
166
150
  enumerable: false,
167
151
  configurable: true
168
152
  });
169
153
  Object.defineProperty(Resizeable.prototype, "isResizing", {
170
- get: function () {
171
- return this._isResizing;
172
- },
173
- set: function (value) {
174
- this._isResizing = value;
175
- },
154
+ get: function () { return this._isResizing; },
155
+ set: function (value) { this._isResizing = value; },
176
156
  enumerable: false,
177
157
  configurable: true
178
158
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-dialogger",
3
- "version": "1.1.142",
3
+ "version": "1.1.145",
4
4
  "description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
5
5
  "main": "index.js",
6
6
  "author": "Sueleyman Topaloglu",
package/styles/dialog.css CHANGED
@@ -327,7 +327,7 @@
327
327
  inset: 0;
328
328
  pointer-events: none;
329
329
  z-index: 500;
330
- animation: resizeHintFade 3.2s ease-in-out forwards;
330
+ animation: resizeHintFade 5s ease-in-out forwards;
331
331
  }
332
332
  .dialog-main .rh {
333
333
  position: absolute;