@percy/dom 1.26.2 → 1.26.3-alpha.4
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/dist/bundle.js +39 -30
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
(function() {
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
(function () {
|
|
2
7
|
(function (exports) {
|
|
3
8
|
'use strict';
|
|
4
9
|
|
|
5
|
-
const process =
|
|
10
|
+
const process = typeof globalThis !== "undefined" && globalThis.process || {};
|
|
6
11
|
process.env = process.env || {};
|
|
7
12
|
process.env.__PERCY_BROWSERIFIED__ = true;
|
|
8
13
|
|
|
@@ -205,7 +210,8 @@
|
|
|
205
210
|
dom,
|
|
206
211
|
clone,
|
|
207
212
|
resources,
|
|
208
|
-
cache
|
|
213
|
+
cache,
|
|
214
|
+
warnings
|
|
209
215
|
} = _ref;
|
|
210
216
|
// in-memory CSSOM into their respective DOM nodes.
|
|
211
217
|
for (let styleSheet of dom.styleSheets) {
|
|
@@ -241,24 +247,29 @@
|
|
|
241
247
|
|
|
242
248
|
// clone Adopted Stylesheets
|
|
243
249
|
// Regarding ordering of the adopted stylesheets - https://github.com/WICG/construct-stylesheets/issues/93
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
clone.
|
|
259
|
-
|
|
260
|
-
|
|
250
|
+
/* istanbul ignore next: tested, but coverage is stripped */
|
|
251
|
+
if (dom.adoptedStyleSheets) {
|
|
252
|
+
for (let sheet of dom.adoptedStyleSheets) {
|
|
253
|
+
const styleLink = document.createElement('link');
|
|
254
|
+
styleLink.setAttribute('rel', 'stylesheet');
|
|
255
|
+
if (!cache.has(sheet)) {
|
|
256
|
+
let resource = createStyleResource(sheet);
|
|
257
|
+
resources.add(resource);
|
|
258
|
+
cache.set(sheet, resource.url);
|
|
259
|
+
}
|
|
260
|
+
styleLink.setAttribute('data-percy-adopted-stylesheets-serialized', 'true');
|
|
261
|
+
styleLink.setAttribute('data-percy-serialized-attribute-href', cache.get(sheet));
|
|
262
|
+
|
|
263
|
+
/* istanbul ignore next: tested, but coverage is stripped */
|
|
264
|
+
if (clone.constructor.name === 'HTMLDocument' || clone.constructor.name === 'DocumentFragment') {
|
|
265
|
+
// handle document and iframe
|
|
266
|
+
clone.body.prepend(styleLink);
|
|
267
|
+
} else if (clone.constructor.name === 'ShadowRoot') {
|
|
268
|
+
clone.prepend(styleLink);
|
|
269
|
+
}
|
|
261
270
|
}
|
|
271
|
+
} else {
|
|
272
|
+
warnings.add('Skipping `adoptedStyleSheets` as it is not supported.');
|
|
262
273
|
}
|
|
263
274
|
}
|
|
264
275
|
|
|
@@ -476,11 +487,12 @@
|
|
|
476
487
|
|
|
477
488
|
// Returns a copy or new doctype for a document.
|
|
478
489
|
function doctype(dom) {
|
|
490
|
+
var _ref2;
|
|
479
491
|
let {
|
|
480
492
|
name = 'html',
|
|
481
493
|
publicId = '',
|
|
482
494
|
systemId = ''
|
|
483
|
-
} = (dom === null || dom === void 0 ? void 0 : dom.doctype)
|
|
495
|
+
} = (_ref2 = dom === null || dom === void 0 ? void 0 : dom.doctype) !== null && _ref2 !== void 0 ? _ref2 : {};
|
|
484
496
|
let deprecated = '';
|
|
485
497
|
if (publicId && systemId) {
|
|
486
498
|
deprecated = ` PUBLIC "${publicId}" "${systemId}"`;
|
|
@@ -512,11 +524,10 @@
|
|
|
512
524
|
let percyElementId = shadowHost.getAttribute('data-percy-element-id');
|
|
513
525
|
let cloneShadowHost = ctx.clone.querySelector(`[data-percy-element-id="${percyElementId}"]`);
|
|
514
526
|
if (shadowHost.shadowRoot && cloneShadowHost.shadowRoot) {
|
|
515
|
-
serializeElements({
|
|
516
|
-
...ctx,
|
|
527
|
+
serializeElements(_objectSpread(_objectSpread({}, ctx), {}, {
|
|
517
528
|
dom: shadowHost.shadowRoot,
|
|
518
529
|
clone: cloneShadowHost.shadowRoot
|
|
519
|
-
});
|
|
530
|
+
}));
|
|
520
531
|
} else {
|
|
521
532
|
ctx.warnings.add('data-percy-shadow-host does not have shadowRoot');
|
|
522
533
|
}
|
|
@@ -566,18 +577,16 @@
|
|
|
566
577
|
};
|
|
567
578
|
return stringifyResponse ? JSON.stringify(result) : result;
|
|
568
579
|
}
|
|
569
|
-
|
|
570
580
|
exports["default"] = serializeDOM;
|
|
571
581
|
exports.serialize = serializeDOM;
|
|
572
582
|
exports.serializeDOM = serializeDOM;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
583
|
+
Object.defineProperty(exports, '__esModule', {
|
|
584
|
+
value: true
|
|
585
|
+
});
|
|
576
586
|
})(this.PercyDOM = this.PercyDOM || {});
|
|
577
587
|
}).call(window);
|
|
578
|
-
|
|
579
588
|
if (typeof define === "function" && define.amd) {
|
|
580
589
|
define("@percy/dom", [], () => window.PercyDOM);
|
|
581
590
|
} else if (typeof module === "object" && module.exports) {
|
|
582
591
|
module.exports = window.PercyDOM;
|
|
583
|
-
}
|
|
592
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "alpha"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/bundle.js",
|
|
15
15
|
"browser": "dist/bundle.js",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"interactor.js": "^2.0.0-beta.10"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d89ab97b8d5169eafd3eb42bdbbef41a2ac624ba"
|
|
39
39
|
}
|