@angular/cdk 17.3.5 → 17.3.6
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/drag-drop/index.d.ts +4 -8
- package/esm2022/a11y/key-manager/list-key-manager.mjs +2 -2
- package/esm2022/drag-drop/dom/root-node.mjs +21 -0
- package/esm2022/drag-drop/dom/styling.mjs +21 -1
- package/esm2022/drag-drop/drag-ref.mjs +11 -99
- package/esm2022/drag-drop/preview-ref.mjs +135 -0
- package/esm2022/version.mjs +1 -1
- package/fesm2022/a11y.mjs +1 -1
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +192 -123
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('17.3.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('17.3.6');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
|
package/fesm2022/drag-drop.mjs
CHANGED
|
@@ -71,34 +71,25 @@ function combineTransforms(transform, initialTransform) {
|
|
|
71
71
|
? transform + ' ' + initialTransform
|
|
72
72
|
: transform;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const computedStyle = getComputedStyle(element);
|
|
84
|
-
const transitionedProperties = parseCssPropertyValue(computedStyle, 'transition-property');
|
|
85
|
-
const property = transitionedProperties.find(prop => prop === 'transform' || prop === 'all');
|
|
86
|
-
// If there's no transition for `all` or `transform`, we shouldn't do anything.
|
|
87
|
-
if (!property) {
|
|
88
|
-
return 0;
|
|
89
|
-
}
|
|
90
|
-
// Get the index of the property that we're interested in and match
|
|
91
|
-
// it up to the same index in `transition-delay` and `transition-duration`.
|
|
92
|
-
const propertyIndex = transitionedProperties.indexOf(property);
|
|
93
|
-
const rawDurations = parseCssPropertyValue(computedStyle, 'transition-duration');
|
|
94
|
-
const rawDelays = parseCssPropertyValue(computedStyle, 'transition-delay');
|
|
95
|
-
return (parseCssTimeUnitsToMs(rawDurations[propertyIndex]) +
|
|
96
|
-
parseCssTimeUnitsToMs(rawDelays[propertyIndex]));
|
|
74
|
+
/**
|
|
75
|
+
* Matches the target element's size to the source's size.
|
|
76
|
+
* @param target Element that needs to be resized.
|
|
77
|
+
* @param sourceRect Dimensions of the source element.
|
|
78
|
+
*/
|
|
79
|
+
function matchElementSize(target, sourceRect) {
|
|
80
|
+
target.style.width = `${sourceRect.width}px`;
|
|
81
|
+
target.style.height = `${sourceRect.height}px`;
|
|
82
|
+
target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
|
97
83
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Gets a 3d `transform` that can be applied to an element.
|
|
86
|
+
* @param x Desired position of the element along the X axis.
|
|
87
|
+
* @param y Desired position of the element along the Y axis.
|
|
88
|
+
*/
|
|
89
|
+
function getTransform(x, y) {
|
|
90
|
+
// Round the transforms since some browsers will
|
|
91
|
+
// blur the elements for sub-pixel transforms.
|
|
92
|
+
return `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
|
|
102
93
|
}
|
|
103
94
|
|
|
104
95
|
/** Gets a mutable version of an element's bounding `DOMRect`. */
|
|
@@ -283,6 +274,173 @@ function transferCanvasData(source, clone) {
|
|
|
283
274
|
}
|
|
284
275
|
}
|
|
285
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Gets the root HTML element of an embedded view.
|
|
279
|
+
* If the root is not an HTML element it gets wrapped in one.
|
|
280
|
+
*/
|
|
281
|
+
function getRootNode(viewRef, _document) {
|
|
282
|
+
const rootNodes = viewRef.rootNodes;
|
|
283
|
+
if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
|
284
|
+
return rootNodes[0];
|
|
285
|
+
}
|
|
286
|
+
const wrapper = _document.createElement('div');
|
|
287
|
+
rootNodes.forEach(node => wrapper.appendChild(node));
|
|
288
|
+
return wrapper;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Parses a CSS time value to milliseconds. */
|
|
292
|
+
function parseCssTimeUnitsToMs(value) {
|
|
293
|
+
// Some browsers will return it in seconds, whereas others will return milliseconds.
|
|
294
|
+
const multiplier = value.toLowerCase().indexOf('ms') > -1 ? 1 : 1000;
|
|
295
|
+
return parseFloat(value) * multiplier;
|
|
296
|
+
}
|
|
297
|
+
/** Gets the transform transition duration, including the delay, of an element in milliseconds. */
|
|
298
|
+
function getTransformTransitionDurationInMs(element) {
|
|
299
|
+
const computedStyle = getComputedStyle(element);
|
|
300
|
+
const transitionedProperties = parseCssPropertyValue(computedStyle, 'transition-property');
|
|
301
|
+
const property = transitionedProperties.find(prop => prop === 'transform' || prop === 'all');
|
|
302
|
+
// If there's no transition for `all` or `transform`, we shouldn't do anything.
|
|
303
|
+
if (!property) {
|
|
304
|
+
return 0;
|
|
305
|
+
}
|
|
306
|
+
// Get the index of the property that we're interested in and match
|
|
307
|
+
// it up to the same index in `transition-delay` and `transition-duration`.
|
|
308
|
+
const propertyIndex = transitionedProperties.indexOf(property);
|
|
309
|
+
const rawDurations = parseCssPropertyValue(computedStyle, 'transition-duration');
|
|
310
|
+
const rawDelays = parseCssPropertyValue(computedStyle, 'transition-delay');
|
|
311
|
+
return (parseCssTimeUnitsToMs(rawDurations[propertyIndex]) +
|
|
312
|
+
parseCssTimeUnitsToMs(rawDelays[propertyIndex]));
|
|
313
|
+
}
|
|
314
|
+
/** Parses out multiple values from a computed style into an array. */
|
|
315
|
+
function parseCssPropertyValue(computedStyle, name) {
|
|
316
|
+
const value = computedStyle.getPropertyValue(name);
|
|
317
|
+
return value.split(',').map(part => part.trim());
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** Inline styles to be set as `!important` while dragging. */
|
|
321
|
+
const importantProperties = new Set([
|
|
322
|
+
// Needs to be important, because some `mat-table` sets `position: sticky !important`. See #22781.
|
|
323
|
+
'position',
|
|
324
|
+
]);
|
|
325
|
+
class PreviewRef {
|
|
326
|
+
constructor(_document, _rootElement, _direction, _initialDomRect, _previewTemplate, _previewClass, _pickupPositionOnPage, _initialTransform, _zIndex) {
|
|
327
|
+
this._document = _document;
|
|
328
|
+
this._rootElement = _rootElement;
|
|
329
|
+
this._direction = _direction;
|
|
330
|
+
this._initialDomRect = _initialDomRect;
|
|
331
|
+
this._previewTemplate = _previewTemplate;
|
|
332
|
+
this._previewClass = _previewClass;
|
|
333
|
+
this._pickupPositionOnPage = _pickupPositionOnPage;
|
|
334
|
+
this._initialTransform = _initialTransform;
|
|
335
|
+
this._zIndex = _zIndex;
|
|
336
|
+
}
|
|
337
|
+
attach(parent) {
|
|
338
|
+
this._wrapper = this._createWrapper();
|
|
339
|
+
this._preview = this._createPreview();
|
|
340
|
+
this._wrapper.appendChild(this._preview);
|
|
341
|
+
parent.appendChild(this._wrapper);
|
|
342
|
+
// The null check is necessary for browsers that don't support the popover API.
|
|
343
|
+
if (this._wrapper.showPopover) {
|
|
344
|
+
this._wrapper.showPopover();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
destroy() {
|
|
348
|
+
this._wrapper?.remove();
|
|
349
|
+
this._previewEmbeddedView?.destroy();
|
|
350
|
+
this._preview = this._wrapper = this._previewEmbeddedView = null;
|
|
351
|
+
}
|
|
352
|
+
setTransform(value) {
|
|
353
|
+
this._preview.style.transform = value;
|
|
354
|
+
}
|
|
355
|
+
getBoundingClientRect() {
|
|
356
|
+
return this._preview.getBoundingClientRect();
|
|
357
|
+
}
|
|
358
|
+
addClass(className) {
|
|
359
|
+
this._preview.classList.add(className);
|
|
360
|
+
}
|
|
361
|
+
getTransitionDuration() {
|
|
362
|
+
return getTransformTransitionDurationInMs(this._preview);
|
|
363
|
+
}
|
|
364
|
+
addEventListener(name, handler) {
|
|
365
|
+
this._preview.addEventListener(name, handler);
|
|
366
|
+
}
|
|
367
|
+
removeEventListener(name, handler) {
|
|
368
|
+
this._preview.removeEventListener(name, handler);
|
|
369
|
+
}
|
|
370
|
+
_createWrapper() {
|
|
371
|
+
const wrapper = this._document.createElement('div');
|
|
372
|
+
wrapper.setAttribute('popover', 'manual');
|
|
373
|
+
wrapper.setAttribute('dir', this._direction);
|
|
374
|
+
wrapper.classList.add('cdk-drag-preview-container');
|
|
375
|
+
extendStyles(wrapper.style, {
|
|
376
|
+
// This is redundant, but we need it for browsers that don't support the popover API.
|
|
377
|
+
'position': 'fixed',
|
|
378
|
+
'top': '0',
|
|
379
|
+
'left': '0',
|
|
380
|
+
'width': '100%',
|
|
381
|
+
'height': '100%',
|
|
382
|
+
'z-index': this._zIndex + '',
|
|
383
|
+
// Reset the user agent styles.
|
|
384
|
+
'background': 'none',
|
|
385
|
+
'border': 'none',
|
|
386
|
+
'pointer-events': 'none',
|
|
387
|
+
'margin': '0',
|
|
388
|
+
'padding': '0',
|
|
389
|
+
});
|
|
390
|
+
toggleNativeDragInteractions(wrapper, false);
|
|
391
|
+
return wrapper;
|
|
392
|
+
}
|
|
393
|
+
_createPreview() {
|
|
394
|
+
const previewConfig = this._previewTemplate;
|
|
395
|
+
const previewClass = this._previewClass;
|
|
396
|
+
const previewTemplate = previewConfig ? previewConfig.template : null;
|
|
397
|
+
let preview;
|
|
398
|
+
if (previewTemplate && previewConfig) {
|
|
399
|
+
// Measure the element before we've inserted the preview
|
|
400
|
+
// since the insertion could throw off the measurement.
|
|
401
|
+
const rootRect = previewConfig.matchSize ? this._initialDomRect : null;
|
|
402
|
+
const viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
|
403
|
+
viewRef.detectChanges();
|
|
404
|
+
preview = getRootNode(viewRef, this._document);
|
|
405
|
+
this._previewEmbeddedView = viewRef;
|
|
406
|
+
if (previewConfig.matchSize) {
|
|
407
|
+
matchElementSize(preview, rootRect);
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
preview.style.transform = getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
preview = deepCloneNode(this._rootElement);
|
|
415
|
+
matchElementSize(preview, this._initialDomRect);
|
|
416
|
+
if (this._initialTransform) {
|
|
417
|
+
preview.style.transform = this._initialTransform;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
extendStyles(preview.style, {
|
|
421
|
+
// It's important that we disable the pointer events on the preview, because
|
|
422
|
+
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
|
423
|
+
'pointer-events': 'none',
|
|
424
|
+
// We have to reset the margin, because it can throw off positioning relative to the viewport.
|
|
425
|
+
'margin': '0',
|
|
426
|
+
'position': 'absolute',
|
|
427
|
+
'top': '0',
|
|
428
|
+
'left': '0',
|
|
429
|
+
}, importantProperties);
|
|
430
|
+
toggleNativeDragInteractions(preview, false);
|
|
431
|
+
preview.classList.add('cdk-drag-preview');
|
|
432
|
+
if (previewClass) {
|
|
433
|
+
if (Array.isArray(previewClass)) {
|
|
434
|
+
previewClass.forEach(className => preview.classList.add(className));
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
preview.classList.add(previewClass);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return preview;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
286
444
|
/** Options that can be used to bind a passive event listener. */
|
|
287
445
|
const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
288
446
|
/** Options that can be used to bind an active event listener. */
|
|
@@ -704,9 +862,8 @@ class DragRef {
|
|
|
704
862
|
}
|
|
705
863
|
/** Destroys the preview element and its ViewRef. */
|
|
706
864
|
_destroyPreview() {
|
|
707
|
-
this._preview?.
|
|
708
|
-
this.
|
|
709
|
-
this._preview = this._previewRef = null;
|
|
865
|
+
this._preview?.destroy();
|
|
866
|
+
this._preview = null;
|
|
710
867
|
}
|
|
711
868
|
/** Destroys the placeholder element and its ViewRef. */
|
|
712
869
|
_destroyPlaceholder() {
|
|
@@ -793,13 +950,13 @@ class DragRef {
|
|
|
793
950
|
this._initialTransform = element.style.transform || '';
|
|
794
951
|
// Create the preview after the initial transform has
|
|
795
952
|
// been cached, because it can be affected by the transform.
|
|
796
|
-
this._preview = this.
|
|
953
|
+
this._preview = new PreviewRef(this._document, this._rootElement, this._direction, this._initialDomRect, this._previewTemplate || null, this.previewClass || null, this._pickupPositionOnPage, this._initialTransform, this._config.zIndex || 1000);
|
|
954
|
+
this._preview.attach(this._getPreviewInsertionPoint(parent, shadowRoot));
|
|
797
955
|
// We move the element out at the end of the body and we make it hidden, because keeping it in
|
|
798
956
|
// place will throw off the consumer's `:last-child` selectors. We can't remove the element
|
|
799
957
|
// from the DOM completely, because iOS will stop firing all subsequent events in the chain.
|
|
800
958
|
toggleVisibility(element, false, dragImportantProperties);
|
|
801
959
|
this._document.body.appendChild(parent.replaceChild(placeholder, element));
|
|
802
|
-
this._getPreviewInsertionPoint(parent, shadowRoot).appendChild(this._preview);
|
|
803
960
|
this.started.next({ source: this, event }); // Emit before notifying the container.
|
|
804
961
|
dropContainer.start();
|
|
805
962
|
this._initialContainer = dropContainer;
|
|
@@ -972,61 +1129,6 @@ class DragRef {
|
|
|
972
1129
|
}
|
|
973
1130
|
}
|
|
974
1131
|
}
|
|
975
|
-
/**
|
|
976
|
-
* Creates the element that will be rendered next to the user's pointer
|
|
977
|
-
* and will be used as a preview of the element that is being dragged.
|
|
978
|
-
*/
|
|
979
|
-
_createPreviewElement() {
|
|
980
|
-
const previewConfig = this._previewTemplate;
|
|
981
|
-
const previewClass = this.previewClass;
|
|
982
|
-
const previewTemplate = previewConfig ? previewConfig.template : null;
|
|
983
|
-
let preview;
|
|
984
|
-
if (previewTemplate && previewConfig) {
|
|
985
|
-
// Measure the element before we've inserted the preview
|
|
986
|
-
// since the insertion could throw off the measurement.
|
|
987
|
-
const rootRect = previewConfig.matchSize ? this._initialDomRect : null;
|
|
988
|
-
const viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
|
989
|
-
viewRef.detectChanges();
|
|
990
|
-
preview = getRootNode(viewRef, this._document);
|
|
991
|
-
this._previewRef = viewRef;
|
|
992
|
-
if (previewConfig.matchSize) {
|
|
993
|
-
matchElementSize(preview, rootRect);
|
|
994
|
-
}
|
|
995
|
-
else {
|
|
996
|
-
preview.style.transform = getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
else {
|
|
1000
|
-
preview = deepCloneNode(this._rootElement);
|
|
1001
|
-
matchElementSize(preview, this._initialDomRect);
|
|
1002
|
-
if (this._initialTransform) {
|
|
1003
|
-
preview.style.transform = this._initialTransform;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
extendStyles(preview.style, {
|
|
1007
|
-
// It's important that we disable the pointer events on the preview, because
|
|
1008
|
-
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
|
1009
|
-
'pointer-events': 'none',
|
|
1010
|
-
// We have to reset the margin, because it can throw off positioning relative to the viewport.
|
|
1011
|
-
'margin': '0',
|
|
1012
|
-
'position': 'fixed',
|
|
1013
|
-
'top': '0',
|
|
1014
|
-
'left': '0',
|
|
1015
|
-
'z-index': `${this._config.zIndex || 1000}`,
|
|
1016
|
-
}, dragImportantProperties);
|
|
1017
|
-
toggleNativeDragInteractions(preview, false);
|
|
1018
|
-
preview.classList.add('cdk-drag-preview');
|
|
1019
|
-
preview.setAttribute('dir', this._direction);
|
|
1020
|
-
if (previewClass) {
|
|
1021
|
-
if (Array.isArray(previewClass)) {
|
|
1022
|
-
previewClass.forEach(className => preview.classList.add(className));
|
|
1023
|
-
}
|
|
1024
|
-
else {
|
|
1025
|
-
preview.classList.add(previewClass);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
return preview;
|
|
1029
|
-
}
|
|
1030
1132
|
/**
|
|
1031
1133
|
* Animates the preview element from its current position to the location of the drop placeholder.
|
|
1032
1134
|
* @returns Promise that resolves when the animation completes.
|
|
@@ -1038,14 +1140,14 @@ class DragRef {
|
|
|
1038
1140
|
}
|
|
1039
1141
|
const placeholderRect = this._placeholder.getBoundingClientRect();
|
|
1040
1142
|
// Apply the class that adds a transition to the preview.
|
|
1041
|
-
this._preview.
|
|
1143
|
+
this._preview.addClass('cdk-drag-animating');
|
|
1042
1144
|
// Move the preview to the placeholder position.
|
|
1043
1145
|
this._applyPreviewTransform(placeholderRect.left, placeholderRect.top);
|
|
1044
1146
|
// If the element doesn't have a `transition`, the `transitionend` event won't fire. Since
|
|
1045
1147
|
// we need to trigger a style recalculation in order for the `cdk-drag-animating` class to
|
|
1046
1148
|
// apply its style, we take advantage of the available info to figure out whether we need to
|
|
1047
1149
|
// bind the event in the first place.
|
|
1048
|
-
const duration =
|
|
1150
|
+
const duration = this._preview.getTransitionDuration();
|
|
1049
1151
|
if (duration === 0) {
|
|
1050
1152
|
return Promise.resolve();
|
|
1051
1153
|
}
|
|
@@ -1233,7 +1335,7 @@ class DragRef {
|
|
|
1233
1335
|
// it could be completely different and the transform might not make sense anymore.
|
|
1234
1336
|
const initialTransform = this._previewTemplate?.template ? undefined : this._initialTransform;
|
|
1235
1337
|
const transform = getTransform(x, y);
|
|
1236
|
-
this._preview.
|
|
1338
|
+
this._preview.setTransform(combineTransforms(transform, initialTransform));
|
|
1237
1339
|
}
|
|
1238
1340
|
/**
|
|
1239
1341
|
* Gets the distance that the user has dragged during the current drag sequence.
|
|
@@ -1392,16 +1494,6 @@ class DragRef {
|
|
|
1392
1494
|
});
|
|
1393
1495
|
}
|
|
1394
1496
|
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Gets a 3d `transform` that can be applied to an element.
|
|
1397
|
-
* @param x Desired position of the element along the X axis.
|
|
1398
|
-
* @param y Desired position of the element along the Y axis.
|
|
1399
|
-
*/
|
|
1400
|
-
function getTransform(x, y) {
|
|
1401
|
-
// Round the transforms since some browsers will
|
|
1402
|
-
// blur the elements for sub-pixel transforms.
|
|
1403
|
-
return `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
|
|
1404
|
-
}
|
|
1405
1497
|
/** Clamps a value between a minimum and a maximum. */
|
|
1406
1498
|
function clamp$1(value, min, max) {
|
|
1407
1499
|
return Math.max(min, Math.min(max, value));
|
|
@@ -1413,29 +1505,6 @@ function isTouchEvent(event) {
|
|
|
1413
1505
|
// that if the event's name starts with `t`, it's a touch event.
|
|
1414
1506
|
return event.type[0] === 't';
|
|
1415
1507
|
}
|
|
1416
|
-
/**
|
|
1417
|
-
* Gets the root HTML element of an embedded view.
|
|
1418
|
-
* If the root is not an HTML element it gets wrapped in one.
|
|
1419
|
-
*/
|
|
1420
|
-
function getRootNode(viewRef, _document) {
|
|
1421
|
-
const rootNodes = viewRef.rootNodes;
|
|
1422
|
-
if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
|
1423
|
-
return rootNodes[0];
|
|
1424
|
-
}
|
|
1425
|
-
const wrapper = _document.createElement('div');
|
|
1426
|
-
rootNodes.forEach(node => wrapper.appendChild(node));
|
|
1427
|
-
return wrapper;
|
|
1428
|
-
}
|
|
1429
|
-
/**
|
|
1430
|
-
* Matches the target element's size to the source's size.
|
|
1431
|
-
* @param target Element that needs to be resized.
|
|
1432
|
-
* @param sourceRect Dimensions of the source element.
|
|
1433
|
-
*/
|
|
1434
|
-
function matchElementSize(target, sourceRect) {
|
|
1435
|
-
target.style.width = `${sourceRect.width}px`;
|
|
1436
|
-
target.style.height = `${sourceRect.height}px`;
|
|
1437
|
-
target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
|
1438
|
-
}
|
|
1439
1508
|
/** Callback invoked for `selectstart` events inside the shadow DOM. */
|
|
1440
1509
|
function shadowDomSelectStart(event) {
|
|
1441
1510
|
event.preventDefault();
|