@shoper/phoenix_design_system 1.18.25-1 → 1.18.26
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/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js +104 -28
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.d.ts +4 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js +104 -28
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,14 +13,17 @@ var accordion_constants = require('./accordion_constants.js');
|
|
|
13
13
|
var transition_controller = require('../../controllers/transition_controller/transition_controller.js');
|
|
14
14
|
|
|
15
15
|
const RESIZE_DEBOUNCE_MS = 150;
|
|
16
|
+
const MUTATION_DEBOUNCE_MS = 100;
|
|
16
17
|
exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
20
|
this.transitionName = 'accordion-toggle';
|
|
20
|
-
this.
|
|
21
|
+
this.isDevAccordionOptimizationFlagEnabled = false;
|
|
21
22
|
this._resizeObserver = null;
|
|
22
23
|
this._isTransitioning = false;
|
|
23
24
|
this._resizeDebounceTimer = null;
|
|
25
|
+
this._mutationDebounceTimer = null;
|
|
26
|
+
this._mutationObserver = null;
|
|
24
27
|
this._handleResizeObserver = () => {
|
|
25
28
|
if (this._isTransitioning || this.hidden || this.style.height === '0px')
|
|
26
29
|
return;
|
|
@@ -59,27 +62,62 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
59
62
|
this._originalHeight = `${height}px`;
|
|
60
63
|
}
|
|
61
64
|
};
|
|
65
|
+
this._handleMutation = () => {
|
|
66
|
+
if (this._mutationDebounceTimer !== null) {
|
|
67
|
+
window.clearTimeout(this._mutationDebounceTimer);
|
|
68
|
+
}
|
|
69
|
+
this._mutationDebounceTimer = window.setTimeout(() => {
|
|
70
|
+
requestAnimationFrame(() => {
|
|
71
|
+
this.style.height = 'auto';
|
|
72
|
+
requestAnimationFrame(() => {
|
|
73
|
+
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
74
|
+
if (this.hidden) {
|
|
75
|
+
this.style.height = '0px';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.style.height = this._originalHeight;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}, MUTATION_DEBOUNCE_MS);
|
|
83
|
+
};
|
|
62
84
|
this._expand = () => {
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
86
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
87
|
+
this._isTransitioning = true;
|
|
88
|
+
}
|
|
89
|
+
this._setHeight(this._originalHeight);
|
|
65
90
|
};
|
|
66
91
|
this._handleTransitionEnd = (e) => {
|
|
67
92
|
if (e.propertyName !== 'height' || e.target !== this) {
|
|
68
93
|
return;
|
|
69
94
|
}
|
|
70
|
-
this.
|
|
95
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
96
|
+
this._isTransitioning = false;
|
|
97
|
+
}
|
|
71
98
|
if (!this.hidden && this.style.height !== '0px') {
|
|
72
99
|
this.style.height = 'auto';
|
|
73
100
|
}
|
|
74
101
|
};
|
|
75
102
|
this._collapse = () => {
|
|
76
|
-
this.
|
|
103
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
104
|
+
this._isTransitioning = true;
|
|
105
|
+
}
|
|
77
106
|
const currentHeight = this.getBoundingClientRect().height;
|
|
78
107
|
this._setHeight(`${currentHeight}px`);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
109
|
+
void this.offsetHeight;
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
this._setHeight('0px');
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
requestAnimationFrame(() => {
|
|
116
|
+
requestAnimationFrame(() => {
|
|
117
|
+
this._setHeight('0px');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
83
121
|
};
|
|
84
122
|
this.setAttribute('role', 'region');
|
|
85
123
|
this._boundHandleTransitionEnd = this._handleTransitionEnd.bind(this);
|
|
@@ -90,17 +128,25 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
90
128
|
this._contextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
91
129
|
this._transitionController = new transition_controller.TransitionController(this, this.transitionName);
|
|
92
130
|
this._subscribeObserver();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
131
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
132
|
+
this._resizeObserver = new ResizeObserver(this._handleResizeObserver);
|
|
133
|
+
this._resizeObserver.observe(this);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
window.addEventListener('resize', this._handleResize, { passive: true });
|
|
98
137
|
}
|
|
138
|
+
this.addEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
139
|
+
this._setupImageLoadListeners();
|
|
99
140
|
}
|
|
100
141
|
firstUpdated(props) {
|
|
101
142
|
super.firstUpdated(props);
|
|
102
|
-
this.
|
|
103
|
-
|
|
143
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
144
|
+
this._updateOriginalHeight();
|
|
145
|
+
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
this._setStylingOptions();
|
|
149
|
+
}
|
|
104
150
|
}
|
|
105
151
|
_setupImageLoadListeners() {
|
|
106
152
|
const images = this.querySelectorAll('img');
|
|
@@ -112,8 +158,24 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
112
158
|
});
|
|
113
159
|
}
|
|
114
160
|
_handleImageLoad() {
|
|
115
|
-
if (
|
|
116
|
-
|
|
161
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
162
|
+
if (!this._isTransitioning) {
|
|
163
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
requestAnimationFrame(() => {
|
|
168
|
+
this.style.height = 'auto';
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
|
+
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
171
|
+
if (this.hidden) {
|
|
172
|
+
this.style.height = '0px';
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
this.style.height = this._originalHeight;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
117
179
|
}
|
|
118
180
|
}
|
|
119
181
|
async _subscribeObserver() {
|
|
@@ -123,6 +185,10 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
123
185
|
accordionProps.opened ? this._transitionController.show(this._expand) : this._transitionController.hide(this._collapse);
|
|
124
186
|
});
|
|
125
187
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
188
|
+
if (!this.isDevAccordionOptimizationFlagEnabled) {
|
|
189
|
+
this._mutationObserver = new MutationObserver(this._handleMutation);
|
|
190
|
+
this._mutationObserver.observe(this, { childList: true, subtree: true });
|
|
191
|
+
}
|
|
126
192
|
}
|
|
127
193
|
_setHeight(height) {
|
|
128
194
|
this.style.height = height;
|
|
@@ -132,17 +198,27 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
132
198
|
this.setAttribute('labelledby', regionId);
|
|
133
199
|
}
|
|
134
200
|
disconnectedCallback() {
|
|
135
|
-
var _a, _b;
|
|
201
|
+
var _a, _b, _c;
|
|
136
202
|
super.disconnectedCallback();
|
|
137
203
|
(_a = this._accordionGroupProps) === null || _a === void 0 ? void 0 : _a.unsubscribe(this._accordionGroupPropsObserver);
|
|
138
|
-
(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
204
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
205
|
+
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
(_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
209
|
+
window.removeEventListener('resize', this._handleResize);
|
|
210
|
+
if (this._resizeDebounceTimer !== null) {
|
|
211
|
+
window.cancelAnimationFrame(this._resizeDebounceTimer);
|
|
212
|
+
}
|
|
213
|
+
if (this._mutationDebounceTimer !== null) {
|
|
214
|
+
window.clearTimeout(this._mutationDebounceTimer);
|
|
215
|
+
}
|
|
145
216
|
}
|
|
217
|
+
const images = this.querySelectorAll('img');
|
|
218
|
+
images.forEach((img) => {
|
|
219
|
+
img.removeEventListener('load', this._boundHandleImageLoad);
|
|
220
|
+
img.removeEventListener('error', this._boundHandleImageLoad);
|
|
221
|
+
});
|
|
146
222
|
window.removeEventListener('resize', this._handleResize);
|
|
147
223
|
this.removeEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
148
224
|
}
|
|
@@ -152,9 +228,9 @@ tslib_es6.__decorate([
|
|
|
152
228
|
tslib_es6.__metadata("design:type", Object)
|
|
153
229
|
], exports.HAccordionContent.prototype, "transitionName", void 0);
|
|
154
230
|
tslib_es6.__decorate([
|
|
155
|
-
decorators.property({ type: Boolean, attribute: '
|
|
231
|
+
decorators.property({ type: Boolean, attribute: 'is-dev-accordion-optimization-flag-enabled' }),
|
|
156
232
|
tslib_es6.__metadata("design:type", Boolean)
|
|
157
|
-
], exports.HAccordionContent.prototype, "
|
|
233
|
+
], exports.HAccordionContent.prototype, "isDevAccordionOptimizationFlagEnabled", void 0);
|
|
158
234
|
exports.HAccordionContent = tslib_es6.__decorate([
|
|
159
235
|
phoenix_custom_element.phoenixCustomElement('h-accordion-content'),
|
|
160
236
|
tslib_es6.__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -2,7 +2,7 @@ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/pho
|
|
|
2
2
|
import { PropertyValues } from 'lit';
|
|
3
3
|
export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
4
4
|
transitionName: string;
|
|
5
|
-
|
|
5
|
+
isDevAccordionOptimizationFlagEnabled: boolean;
|
|
6
6
|
private _transitionController;
|
|
7
7
|
private _contextConsumer;
|
|
8
8
|
private _accordionGroupProps;
|
|
@@ -11,6 +11,8 @@ export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
|
11
11
|
private _resizeObserver;
|
|
12
12
|
private _isTransitioning;
|
|
13
13
|
private _resizeDebounceTimer;
|
|
14
|
+
private _mutationDebounceTimer;
|
|
15
|
+
private _mutationObserver;
|
|
14
16
|
private _boundHandleTransitionEnd;
|
|
15
17
|
private _boundHandleImageLoad;
|
|
16
18
|
constructor();
|
|
@@ -21,6 +23,7 @@ export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
|
21
23
|
private _handleResize;
|
|
22
24
|
private _setStylingOptions;
|
|
23
25
|
private _setOriginalHeightValue;
|
|
26
|
+
private _handleMutation;
|
|
24
27
|
private _setupImageLoadListeners;
|
|
25
28
|
private _handleImageLoad;
|
|
26
29
|
private _subscribeObserver;
|
|
@@ -9,14 +9,17 @@ import { ACCORDION_CONTEXTS } from './accordion_constants.js';
|
|
|
9
9
|
import { TransitionController } from '../../controllers/transition_controller/transition_controller.js';
|
|
10
10
|
|
|
11
11
|
const RESIZE_DEBOUNCE_MS = 150;
|
|
12
|
+
const MUTATION_DEBOUNCE_MS = 100;
|
|
12
13
|
let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
13
14
|
constructor() {
|
|
14
15
|
super();
|
|
15
16
|
this.transitionName = 'accordion-toggle';
|
|
16
|
-
this.
|
|
17
|
+
this.isDevAccordionOptimizationFlagEnabled = false;
|
|
17
18
|
this._resizeObserver = null;
|
|
18
19
|
this._isTransitioning = false;
|
|
19
20
|
this._resizeDebounceTimer = null;
|
|
21
|
+
this._mutationDebounceTimer = null;
|
|
22
|
+
this._mutationObserver = null;
|
|
20
23
|
this._handleResizeObserver = () => {
|
|
21
24
|
if (this._isTransitioning || this.hidden || this.style.height === '0px')
|
|
22
25
|
return;
|
|
@@ -55,27 +58,62 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
55
58
|
this._originalHeight = `${height}px`;
|
|
56
59
|
}
|
|
57
60
|
};
|
|
61
|
+
this._handleMutation = () => {
|
|
62
|
+
if (this._mutationDebounceTimer !== null) {
|
|
63
|
+
window.clearTimeout(this._mutationDebounceTimer);
|
|
64
|
+
}
|
|
65
|
+
this._mutationDebounceTimer = window.setTimeout(() => {
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
this.style.height = 'auto';
|
|
68
|
+
requestAnimationFrame(() => {
|
|
69
|
+
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
70
|
+
if (this.hidden) {
|
|
71
|
+
this.style.height = '0px';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.style.height = this._originalHeight;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, MUTATION_DEBOUNCE_MS);
|
|
79
|
+
};
|
|
58
80
|
this._expand = () => {
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
82
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
83
|
+
this._isTransitioning = true;
|
|
84
|
+
}
|
|
85
|
+
this._setHeight(this._originalHeight);
|
|
61
86
|
};
|
|
62
87
|
this._handleTransitionEnd = (e) => {
|
|
63
88
|
if (e.propertyName !== 'height' || e.target !== this) {
|
|
64
89
|
return;
|
|
65
90
|
}
|
|
66
|
-
this.
|
|
91
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
92
|
+
this._isTransitioning = false;
|
|
93
|
+
}
|
|
67
94
|
if (!this.hidden && this.style.height !== '0px') {
|
|
68
95
|
this.style.height = 'auto';
|
|
69
96
|
}
|
|
70
97
|
};
|
|
71
98
|
this._collapse = () => {
|
|
72
|
-
this.
|
|
99
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
100
|
+
this._isTransitioning = true;
|
|
101
|
+
}
|
|
73
102
|
const currentHeight = this.getBoundingClientRect().height;
|
|
74
103
|
this._setHeight(`${currentHeight}px`);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
105
|
+
void this.offsetHeight;
|
|
106
|
+
requestAnimationFrame(() => {
|
|
107
|
+
this._setHeight('0px');
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
requestAnimationFrame(() => {
|
|
112
|
+
requestAnimationFrame(() => {
|
|
113
|
+
this._setHeight('0px');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
79
117
|
};
|
|
80
118
|
this.setAttribute('role', 'region');
|
|
81
119
|
this._boundHandleTransitionEnd = this._handleTransitionEnd.bind(this);
|
|
@@ -86,17 +124,25 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
86
124
|
this._contextConsumer = new ContextConsumerController(this);
|
|
87
125
|
this._transitionController = new TransitionController(this, this.transitionName);
|
|
88
126
|
this._subscribeObserver();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
127
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
128
|
+
this._resizeObserver = new ResizeObserver(this._handleResizeObserver);
|
|
129
|
+
this._resizeObserver.observe(this);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
window.addEventListener('resize', this._handleResize, { passive: true });
|
|
94
133
|
}
|
|
134
|
+
this.addEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
135
|
+
this._setupImageLoadListeners();
|
|
95
136
|
}
|
|
96
137
|
firstUpdated(props) {
|
|
97
138
|
super.firstUpdated(props);
|
|
98
|
-
this.
|
|
99
|
-
|
|
139
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
140
|
+
this._updateOriginalHeight();
|
|
141
|
+
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this._setStylingOptions();
|
|
145
|
+
}
|
|
100
146
|
}
|
|
101
147
|
_setupImageLoadListeners() {
|
|
102
148
|
const images = this.querySelectorAll('img');
|
|
@@ -108,8 +154,24 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
108
154
|
});
|
|
109
155
|
}
|
|
110
156
|
_handleImageLoad() {
|
|
111
|
-
if (
|
|
112
|
-
|
|
157
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
158
|
+
if (!this._isTransitioning) {
|
|
159
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
requestAnimationFrame(() => {
|
|
164
|
+
this.style.height = 'auto';
|
|
165
|
+
requestAnimationFrame(() => {
|
|
166
|
+
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
167
|
+
if (this.hidden) {
|
|
168
|
+
this.style.height = '0px';
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.style.height = this._originalHeight;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
113
175
|
}
|
|
114
176
|
}
|
|
115
177
|
async _subscribeObserver() {
|
|
@@ -119,6 +181,10 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
119
181
|
accordionProps.opened ? this._transitionController.show(this._expand) : this._transitionController.hide(this._collapse);
|
|
120
182
|
});
|
|
121
183
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
184
|
+
if (!this.isDevAccordionOptimizationFlagEnabled) {
|
|
185
|
+
this._mutationObserver = new MutationObserver(this._handleMutation);
|
|
186
|
+
this._mutationObserver.observe(this, { childList: true, subtree: true });
|
|
187
|
+
}
|
|
122
188
|
}
|
|
123
189
|
_setHeight(height) {
|
|
124
190
|
this.style.height = height;
|
|
@@ -128,17 +194,27 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
128
194
|
this.setAttribute('labelledby', regionId);
|
|
129
195
|
}
|
|
130
196
|
disconnectedCallback() {
|
|
131
|
-
var _a, _b;
|
|
197
|
+
var _a, _b, _c;
|
|
132
198
|
super.disconnectedCallback();
|
|
133
199
|
(_a = this._accordionGroupProps) === null || _a === void 0 ? void 0 : _a.unsubscribe(this._accordionGroupPropsObserver);
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
200
|
+
if (this.isDevAccordionOptimizationFlagEnabled) {
|
|
201
|
+
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
(_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
205
|
+
window.removeEventListener('resize', this._handleResize);
|
|
206
|
+
if (this._resizeDebounceTimer !== null) {
|
|
207
|
+
window.cancelAnimationFrame(this._resizeDebounceTimer);
|
|
208
|
+
}
|
|
209
|
+
if (this._mutationDebounceTimer !== null) {
|
|
210
|
+
window.clearTimeout(this._mutationDebounceTimer);
|
|
211
|
+
}
|
|
141
212
|
}
|
|
213
|
+
const images = this.querySelectorAll('img');
|
|
214
|
+
images.forEach((img) => {
|
|
215
|
+
img.removeEventListener('load', this._boundHandleImageLoad);
|
|
216
|
+
img.removeEventListener('error', this._boundHandleImageLoad);
|
|
217
|
+
});
|
|
142
218
|
window.removeEventListener('resize', this._handleResize);
|
|
143
219
|
this.removeEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
144
220
|
}
|
|
@@ -148,9 +224,9 @@ __decorate([
|
|
|
148
224
|
__metadata("design:type", Object)
|
|
149
225
|
], HAccordionContent.prototype, "transitionName", void 0);
|
|
150
226
|
__decorate([
|
|
151
|
-
property({ type: Boolean, attribute: '
|
|
227
|
+
property({ type: Boolean, attribute: 'is-dev-accordion-optimization-flag-enabled' }),
|
|
152
228
|
__metadata("design:type", Boolean)
|
|
153
|
-
], HAccordionContent.prototype, "
|
|
229
|
+
], HAccordionContent.prototype, "isDevAccordionOptimizationFlagEnabled", void 0);
|
|
154
230
|
HAccordionContent = __decorate([
|
|
155
231
|
phoenixCustomElement('h-accordion-content'),
|
|
156
232
|
__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|