publ-echo-test 0.0.201 → 0.0.203

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