publ-echo-test 0.0.200 → 0.0.202

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.
@@ -53,64 +53,71 @@ var GridItem = function (_a) {
53
53
  var prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
54
54
  // MutationObserver 콜백 함수
55
55
  var callback = function (mutationsList) {
56
- for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
57
- var mutation = mutationsList_1[_i];
58
- var oldClass = mutation.oldValue || '';
59
- var newClass = mutation.target.getAttribute('class') || '';
60
- // hover로 인해 "hovered" 클래스가 추가된 경우
61
- if (!oldClass.includes('hovered') && newClass.includes('hovered')) {
62
- console.log('Hover 상태로 변경됨');
63
- return;
64
- }
65
- // hover에서 벗어난 경우
66
- if (oldClass.includes('hovered') && !newClass.includes('hovered')) {
67
- console.log('Hover 상태 해제됨');
68
- return;
69
- }
70
- var isCharacterChanged = mutation.type === 'characterData';
71
- var keepWidth = true;
72
- var hasPaddingChanged = false;
73
- var height = isCharacterChanged
74
- ? mutation.target.parentNode.clientHeight
75
- : mutation.target.clientHeight;
76
- var width = targetNode.clientWidth;
77
- if (!isCharacterChanged && mutation.target instanceof Element) {
78
- var styles = getComputedStyle(mutation.target);
79
- var minWidth = parseFloat(styles.minWidth);
80
- if (minWidth > width) {
81
- keepWidth = false;
56
+ var _a, _b;
57
+ try {
58
+ for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
59
+ var mutation = mutationsList_1[_i];
60
+ console.log('mutation:', mutation);
61
+ var oldClass = mutation.oldValue || '';
62
+ var newClass = (_b = (_a = mutation.target) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) !== null && _b !== void 0 ? _b : '';
63
+ // hover로 인해 "hovered" 클래스가 추가된 경우
64
+ if (!oldClass.includes('hovered') && newClass.includes('hovered')) {
65
+ console.log('Hover 상태로 변경됨');
66
+ return;
82
67
  }
83
- // NOTE: POC
84
- var paddingL = parseFloat(styles.paddingLeft);
85
- var paddingR = parseFloat(styles.paddingRight);
86
- var paddingT = parseFloat(styles.paddingTop);
87
- var paddingB = parseFloat(styles.paddingBottom);
88
- if (prevPaddingL !== paddingL ||
89
- prevPaddingR !== paddingR ||
90
- prevPaddingT !== paddingT ||
91
- prevPaddingB !== paddingB) {
92
- hasPaddingChanged = true;
93
- keepWidth = false;
68
+ // hover에서 벗어난 경우
69
+ if (oldClass.includes('hovered') && !newClass.includes('hovered')) {
70
+ console.log('Hover 상태 해제됨');
71
+ return;
94
72
  }
73
+ var isCharacterChanged = mutation.type === 'characterData';
74
+ var keepWidth = true;
75
+ var hasPaddingChanged = false;
76
+ var height = isCharacterChanged
77
+ ? mutation.target.parentNode.clientHeight
78
+ : mutation.target.clientHeight;
79
+ var width = targetNode.clientWidth;
80
+ if (!isCharacterChanged && mutation.target instanceof Element) {
81
+ var styles = getComputedStyle(mutation.target);
82
+ var minWidth = parseFloat(styles.minWidth);
83
+ if (minWidth > width) {
84
+ keepWidth = false;
85
+ }
86
+ // NOTE: POC
87
+ var paddingL = parseFloat(styles.paddingLeft);
88
+ var paddingR = parseFloat(styles.paddingRight);
89
+ var paddingT = parseFloat(styles.paddingTop);
90
+ var paddingB = parseFloat(styles.paddingBottom);
91
+ if (prevPaddingL !== paddingL ||
92
+ prevPaddingR !== paddingR ||
93
+ prevPaddingT !== paddingT ||
94
+ prevPaddingB !== paddingB) {
95
+ hasPaddingChanged = true;
96
+ keepWidth = false;
97
+ }
98
+ }
99
+ var prevW = props.w;
100
+ var prevH = props.h;
101
+ var _c = calcWH(getPositionParams(), {
102
+ width: width,
103
+ height: height,
104
+ }, x, y, 'e', props.w, props.h, false), w_1 = _c.w, h_1 = _c.h;
105
+ if (keepWidth) {
106
+ w_1 = prevW;
107
+ }
108
+ if (prevH > h_1) {
109
+ h_1 = prevH;
110
+ }
111
+ var _d = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _d.newX, newY = _d.newY;
112
+ if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
113
+ return;
114
+ }
115
+ props.onFitToContent &&
116
+ props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
95
117
  }
96
- var prevW = props.w;
97
- var prevH = props.h;
98
- var _a = calcWH(getPositionParams(), {
99
- width: width,
100
- height: height,
101
- }, x, y, 'e', props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
102
- if (keepWidth) {
103
- w_1 = prevW;
104
- }
105
- if (prevH > h_1) {
106
- h_1 = prevH;
107
- }
108
- var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
109
- if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
110
- return;
111
- }
112
- props.onFitToContent &&
113
- props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
118
+ }
119
+ catch (e) {
120
+ console.error(e);
114
121
  }
115
122
  };
116
123
  // MutationObserver 인스턴스 생성
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.200",
3
+ "version": "0.0.202",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",