@chromatic-com/playwright 0.14.1 → 0.14.2-3c15dcd-20260519102148
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/browser.mjs +120 -72
- package/dist/index.js +20 -3
- package/dist/index.mjs +20 -3
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -62,15 +62,15 @@ function getUntaintedPrototype(key) {
|
|
|
62
62
|
const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
|
|
63
63
|
const isUntaintedAccessors = Boolean(accessorNames && // @ts-expect-error 2345
|
|
64
64
|
accessorNames.every((accessor) => {
|
|
65
|
-
var
|
|
66
|
-
return Boolean((_b = (
|
|
65
|
+
var _a, _b;
|
|
66
|
+
return Boolean((_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.get) == null ? void 0 : _b.toString().includes("[native code]"));
|
|
67
67
|
}));
|
|
68
68
|
const methodNames = key in testableMethods ? testableMethods[key] : void 0;
|
|
69
69
|
const isUntaintedMethods = Boolean(methodNames && methodNames.every(
|
|
70
70
|
// @ts-expect-error 2345
|
|
71
71
|
(method) => {
|
|
72
|
-
var
|
|
73
|
-
return typeof defaultPrototype[method] === "function" && ((
|
|
72
|
+
var _a;
|
|
73
|
+
return typeof defaultPrototype[method] === "function" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.toString().includes("[native code]"));
|
|
74
74
|
}
|
|
75
75
|
));
|
|
76
76
|
if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
|
|
@@ -95,12 +95,12 @@ function getUntaintedPrototype(key) {
|
|
|
95
95
|
__name(getUntaintedPrototype, "getUntaintedPrototype");
|
|
96
96
|
var untaintedAccessorCache = {};
|
|
97
97
|
function getUntaintedAccessor(key, instance, accessor) {
|
|
98
|
-
var
|
|
98
|
+
var _a;
|
|
99
99
|
const cacheKey = `${key}.${String(accessor)}`;
|
|
100
100
|
if (untaintedAccessorCache[cacheKey])
|
|
101
101
|
return untaintedAccessorCache[cacheKey].call(instance);
|
|
102
102
|
const untaintedPrototype = getUntaintedPrototype(key);
|
|
103
|
-
const untaintedAccessor = (
|
|
103
|
+
const untaintedAccessor = (_a = Object.getOwnPropertyDescriptor(untaintedPrototype, accessor)) == null ? void 0 : _a.get;
|
|
104
104
|
if (!untaintedAccessor)
|
|
105
105
|
return instance[accessor];
|
|
106
106
|
untaintedAccessorCache[cacheKey] = untaintedAccessor;
|
|
@@ -316,17 +316,19 @@ function isCSSStyleRule(rule2) {
|
|
|
316
316
|
return "selectorText" in rule2;
|
|
317
317
|
}
|
|
318
318
|
__name(isCSSStyleRule, "isCSSStyleRule");
|
|
319
|
-
var
|
|
320
|
-
|
|
319
|
+
var Mirror = class Mirror2 {
|
|
320
|
+
static {
|
|
321
|
+
__name(this, "Mirror");
|
|
322
|
+
}
|
|
321
323
|
constructor() {
|
|
322
324
|
__publicField(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
323
325
|
__publicField(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
324
326
|
}
|
|
325
327
|
getId(n) {
|
|
326
|
-
var
|
|
328
|
+
var _a;
|
|
327
329
|
if (!n)
|
|
328
330
|
return -1;
|
|
329
|
-
const id = (
|
|
331
|
+
const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
|
|
330
332
|
return id ?? -1;
|
|
331
333
|
}
|
|
332
334
|
getNode(id) {
|
|
@@ -371,7 +373,7 @@ var Mirror = (_a = class {
|
|
|
371
373
|
this.idNodeMap = /* @__PURE__ */ new Map();
|
|
372
374
|
this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
373
375
|
}
|
|
374
|
-
}
|
|
376
|
+
};
|
|
375
377
|
function createMirror() {
|
|
376
378
|
return new Mirror();
|
|
377
379
|
}
|
|
@@ -1472,8 +1474,10 @@ var __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Obje
|
|
|
1472
1474
|
var require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
1473
1475
|
var pico = picocolors_browserExports;
|
|
1474
1476
|
var terminalHighlight$1 = require$$2;
|
|
1475
|
-
var
|
|
1476
|
-
|
|
1477
|
+
var CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
1478
|
+
static {
|
|
1479
|
+
__name(this, "CssSyntaxError");
|
|
1480
|
+
}
|
|
1477
1481
|
constructor(message, line, column, source, file, plugin2) {
|
|
1478
1482
|
super(message);
|
|
1479
1483
|
this.name = "CssSyntaxError";
|
|
@@ -1500,7 +1504,7 @@ var CssSyntaxError$3 = (_a2 = class extends Error {
|
|
|
1500
1504
|
}
|
|
1501
1505
|
this.setMessage();
|
|
1502
1506
|
if (Error.captureStackTrace) {
|
|
1503
|
-
Error.captureStackTrace(this,
|
|
1507
|
+
Error.captureStackTrace(this, CssSyntaxError);
|
|
1504
1508
|
}
|
|
1505
1509
|
}
|
|
1506
1510
|
setMessage() {
|
|
@@ -1550,7 +1554,7 @@ var CssSyntaxError$3 = (_a2 = class extends Error {
|
|
|
1550
1554
|
}
|
|
1551
1555
|
return this.name + ": " + this.message + code;
|
|
1552
1556
|
}
|
|
1553
|
-
}
|
|
1557
|
+
};
|
|
1554
1558
|
var cssSyntaxError = CssSyntaxError$3;
|
|
1555
1559
|
CssSyntaxError$3.default = CssSyntaxError$3;
|
|
1556
1560
|
var symbols = {};
|
|
@@ -1574,8 +1578,10 @@ function capitalize(str) {
|
|
|
1574
1578
|
return str[0].toUpperCase() + str.slice(1);
|
|
1575
1579
|
}
|
|
1576
1580
|
__name(capitalize, "capitalize");
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1581
|
+
var Stringifier$2 = class Stringifier {
|
|
1582
|
+
static {
|
|
1583
|
+
__name(this, "Stringifier");
|
|
1584
|
+
}
|
|
1579
1585
|
constructor(builder) {
|
|
1580
1586
|
this.builder = builder;
|
|
1581
1587
|
}
|
|
@@ -1868,7 +1874,7 @@ var Stringifier$2 = (_a3 = class {
|
|
|
1868
1874
|
}
|
|
1869
1875
|
this[node2.type](node2, semicolon);
|
|
1870
1876
|
}
|
|
1871
|
-
}
|
|
1877
|
+
};
|
|
1872
1878
|
var stringifier = Stringifier$2;
|
|
1873
1879
|
Stringifier$2.default = Stringifier$2;
|
|
1874
1880
|
var Stringifier$1 = stringifier;
|
|
@@ -1909,8 +1915,10 @@ function cloneNode(obj, parent) {
|
|
|
1909
1915
|
return cloned;
|
|
1910
1916
|
}
|
|
1911
1917
|
__name(cloneNode, "cloneNode");
|
|
1912
|
-
var
|
|
1913
|
-
|
|
1918
|
+
var Node$4 = class Node {
|
|
1919
|
+
static {
|
|
1920
|
+
__name(this, "Node");
|
|
1921
|
+
}
|
|
1914
1922
|
constructor(defaults = {}) {
|
|
1915
1923
|
this.raws = {};
|
|
1916
1924
|
this[isClean$2] = false;
|
|
@@ -2220,12 +2228,14 @@ var Node$4 = (_a4 = class {
|
|
|
2220
2228
|
get proxyOf() {
|
|
2221
2229
|
return this;
|
|
2222
2230
|
}
|
|
2223
|
-
}
|
|
2231
|
+
};
|
|
2224
2232
|
var node = Node$4;
|
|
2225
2233
|
Node$4.default = Node$4;
|
|
2226
2234
|
var Node$3 = node;
|
|
2227
|
-
var
|
|
2228
|
-
|
|
2235
|
+
var Declaration$4 = class Declaration extends Node$3 {
|
|
2236
|
+
static {
|
|
2237
|
+
__name(this, "Declaration");
|
|
2238
|
+
}
|
|
2229
2239
|
constructor(defaults) {
|
|
2230
2240
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
2231
2241
|
defaults = {
|
|
@@ -2239,7 +2249,7 @@ var Declaration$4 = (_a5 = class extends Node$3 {
|
|
|
2239
2249
|
get variable() {
|
|
2240
2250
|
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
2241
2251
|
}
|
|
2242
|
-
}
|
|
2252
|
+
};
|
|
2243
2253
|
var declaration = Declaration$4;
|
|
2244
2254
|
Declaration$4.default = Declaration$4;
|
|
2245
2255
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
@@ -2264,8 +2274,10 @@ function fromBase64(str) {
|
|
|
2264
2274
|
}
|
|
2265
2275
|
}
|
|
2266
2276
|
__name(fromBase64, "fromBase64");
|
|
2267
|
-
var
|
|
2268
|
-
|
|
2277
|
+
var PreviousMap$2 = class PreviousMap {
|
|
2278
|
+
static {
|
|
2279
|
+
__name(this, "PreviousMap");
|
|
2280
|
+
}
|
|
2269
2281
|
constructor(css, opts) {
|
|
2270
2282
|
if (opts.map === false)
|
|
2271
2283
|
return;
|
|
@@ -2367,7 +2379,7 @@ var PreviousMap$2 = (_a6 = class {
|
|
|
2367
2379
|
withContent() {
|
|
2368
2380
|
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
2369
2381
|
}
|
|
2370
|
-
}
|
|
2382
|
+
};
|
|
2371
2383
|
var previousMap = PreviousMap$2;
|
|
2372
2384
|
PreviousMap$2.default = PreviousMap$2;
|
|
2373
2385
|
var { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
@@ -2380,8 +2392,10 @@ var PreviousMap$1 = previousMap;
|
|
|
2380
2392
|
var fromOffsetCache = Symbol("fromOffsetCache");
|
|
2381
2393
|
var sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
2382
2394
|
var pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
2383
|
-
var
|
|
2384
|
-
|
|
2395
|
+
var Input$4 = class Input {
|
|
2396
|
+
static {
|
|
2397
|
+
__name(this, "Input");
|
|
2398
|
+
}
|
|
2385
2399
|
constructor(css, opts = {}) {
|
|
2386
2400
|
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
2387
2401
|
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
@@ -2585,7 +2599,7 @@ var Input$4 = (_a7 = class {
|
|
|
2585
2599
|
get from() {
|
|
2586
2600
|
return this.file || this.id;
|
|
2587
2601
|
}
|
|
2588
|
-
}
|
|
2602
|
+
};
|
|
2589
2603
|
var input = Input$4;
|
|
2590
2604
|
Input$4.default = Input$4;
|
|
2591
2605
|
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
@@ -2597,8 +2611,10 @@ var { pathToFileURL } = require$$2;
|
|
|
2597
2611
|
var Input$3 = input;
|
|
2598
2612
|
var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
2599
2613
|
var pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
2600
|
-
var
|
|
2601
|
-
|
|
2614
|
+
var MapGenerator$2 = class MapGenerator {
|
|
2615
|
+
static {
|
|
2616
|
+
__name(this, "MapGenerator");
|
|
2617
|
+
}
|
|
2602
2618
|
constructor(stringify2, root2, opts, cssString) {
|
|
2603
2619
|
this.stringify = stringify2;
|
|
2604
2620
|
this.mapOpts = opts.map || {};
|
|
@@ -2932,16 +2948,18 @@ var MapGenerator$2 = (_a8 = class {
|
|
|
2932
2948
|
this.memoizedURLs.set(path, url);
|
|
2933
2949
|
return url;
|
|
2934
2950
|
}
|
|
2935
|
-
}
|
|
2951
|
+
};
|
|
2936
2952
|
var mapGenerator = MapGenerator$2;
|
|
2937
2953
|
var Node$2 = node;
|
|
2938
|
-
var
|
|
2939
|
-
|
|
2954
|
+
var Comment$4 = class Comment extends Node$2 {
|
|
2955
|
+
static {
|
|
2956
|
+
__name(this, "Comment");
|
|
2957
|
+
}
|
|
2940
2958
|
constructor(defaults) {
|
|
2941
2959
|
super(defaults);
|
|
2942
2960
|
this.type = "comment";
|
|
2943
2961
|
}
|
|
2944
|
-
}
|
|
2962
|
+
};
|
|
2945
2963
|
var comment = Comment$4;
|
|
2946
2964
|
Comment$4.default = Comment$4;
|
|
2947
2965
|
var { isClean: isClean$1, my: my$1 } = symbols;
|
|
@@ -2970,8 +2988,10 @@ function markDirtyUp(node2) {
|
|
|
2970
2988
|
}
|
|
2971
2989
|
}
|
|
2972
2990
|
__name(markDirtyUp, "markDirtyUp");
|
|
2973
|
-
var
|
|
2974
|
-
|
|
2991
|
+
var Container$7 = class Container extends Node$1 {
|
|
2992
|
+
static {
|
|
2993
|
+
__name(this, "Container");
|
|
2994
|
+
}
|
|
2975
2995
|
append(...children) {
|
|
2976
2996
|
for (let child of children) {
|
|
2977
2997
|
let nodes = this.normalize(child, this.last);
|
|
@@ -3145,7 +3165,7 @@ var Container$7 = (_a10 = class extends Node$1 {
|
|
|
3145
3165
|
}
|
|
3146
3166
|
let processed = nodes.map((i) => {
|
|
3147
3167
|
if (!i[my$1])
|
|
3148
|
-
|
|
3168
|
+
Container.rebuild(i);
|
|
3149
3169
|
i = i.proxyOf;
|
|
3150
3170
|
if (i.parent)
|
|
3151
3171
|
i.parent.removeChild(i);
|
|
@@ -3315,7 +3335,7 @@ var Container$7 = (_a10 = class extends Node$1 {
|
|
|
3315
3335
|
return void 0;
|
|
3316
3336
|
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
3317
3337
|
}
|
|
3318
|
-
}
|
|
3338
|
+
};
|
|
3319
3339
|
Container$7.registerParse = (dependant) => {
|
|
3320
3340
|
parse$4 = dependant;
|
|
3321
3341
|
};
|
|
@@ -3352,8 +3372,10 @@ Container$7.rebuild = (node2) => {
|
|
|
3352
3372
|
var Container$6 = container;
|
|
3353
3373
|
var LazyResult$4;
|
|
3354
3374
|
var Processor$3;
|
|
3355
|
-
var
|
|
3356
|
-
|
|
3375
|
+
var Document$3 = class Document extends Container$6 {
|
|
3376
|
+
static {
|
|
3377
|
+
__name(this, "Document");
|
|
3378
|
+
}
|
|
3357
3379
|
constructor(defaults) {
|
|
3358
3380
|
super({
|
|
3359
3381
|
type: "document",
|
|
@@ -3367,7 +3389,7 @@ var Document$3 = (_a11 = class extends Container$6 {
|
|
|
3367
3389
|
let lazy = new LazyResult$4(new Processor$3(), this, opts);
|
|
3368
3390
|
return lazy.stringify();
|
|
3369
3391
|
}
|
|
3370
|
-
}
|
|
3392
|
+
};
|
|
3371
3393
|
Document$3.registerLazyResult = (dependant) => {
|
|
3372
3394
|
LazyResult$4 = dependant;
|
|
3373
3395
|
};
|
|
@@ -3385,8 +3407,10 @@ var warnOnce$2 = /* @__PURE__ */ __name(function warnOnce(message) {
|
|
|
3385
3407
|
console.warn(message);
|
|
3386
3408
|
}
|
|
3387
3409
|
}, "warnOnce");
|
|
3388
|
-
var
|
|
3389
|
-
|
|
3410
|
+
var Warning$2 = class Warning {
|
|
3411
|
+
static {
|
|
3412
|
+
__name(this, "Warning");
|
|
3413
|
+
}
|
|
3390
3414
|
constructor(text, opts = {}) {
|
|
3391
3415
|
this.type = "warning";
|
|
3392
3416
|
this.text = text;
|
|
@@ -3413,12 +3437,14 @@ var Warning$2 = (_a12 = class {
|
|
|
3413
3437
|
}
|
|
3414
3438
|
return this.text;
|
|
3415
3439
|
}
|
|
3416
|
-
}
|
|
3440
|
+
};
|
|
3417
3441
|
var warning = Warning$2;
|
|
3418
3442
|
Warning$2.default = Warning$2;
|
|
3419
3443
|
var Warning$1 = warning;
|
|
3420
|
-
var
|
|
3421
|
-
|
|
3444
|
+
var Result$3 = class Result {
|
|
3445
|
+
static {
|
|
3446
|
+
__name(this, "Result");
|
|
3447
|
+
}
|
|
3422
3448
|
constructor(processor2, root2, opts) {
|
|
3423
3449
|
this.processor = processor2;
|
|
3424
3450
|
this.messages = [];
|
|
@@ -3446,7 +3472,7 @@ var Result$3 = (_a13 = class {
|
|
|
3446
3472
|
get content() {
|
|
3447
3473
|
return this.css;
|
|
3448
3474
|
}
|
|
3449
|
-
}
|
|
3475
|
+
};
|
|
3450
3476
|
var result = Result$3;
|
|
3451
3477
|
Result$3.default = Result$3;
|
|
3452
3478
|
var SINGLE_QUOTE = "'".charCodeAt(0);
|
|
@@ -3711,8 +3737,10 @@ var tokenize = /* @__PURE__ */ __name(function tokenizer(input2, options = {}) {
|
|
|
3711
3737
|
};
|
|
3712
3738
|
}, "tokenizer");
|
|
3713
3739
|
var Container$5 = container;
|
|
3714
|
-
var
|
|
3715
|
-
|
|
3740
|
+
var AtRule$3 = class AtRule extends Container$5 {
|
|
3741
|
+
static {
|
|
3742
|
+
__name(this, "AtRule");
|
|
3743
|
+
}
|
|
3716
3744
|
constructor(defaults) {
|
|
3717
3745
|
super(defaults);
|
|
3718
3746
|
this.type = "atrule";
|
|
@@ -3727,15 +3755,17 @@ var AtRule$3 = (_a14 = class extends Container$5 {
|
|
|
3727
3755
|
this.nodes = [];
|
|
3728
3756
|
return super.prepend(...children);
|
|
3729
3757
|
}
|
|
3730
|
-
}
|
|
3758
|
+
};
|
|
3731
3759
|
var atRule = AtRule$3;
|
|
3732
3760
|
AtRule$3.default = AtRule$3;
|
|
3733
3761
|
Container$5.registerAtRule(AtRule$3);
|
|
3734
3762
|
var Container$4 = container;
|
|
3735
3763
|
var LazyResult$3;
|
|
3736
3764
|
var Processor$2;
|
|
3737
|
-
var
|
|
3738
|
-
|
|
3765
|
+
var Root$5 = class Root extends Container$4 {
|
|
3766
|
+
static {
|
|
3767
|
+
__name(this, "Root");
|
|
3768
|
+
}
|
|
3739
3769
|
constructor(defaults) {
|
|
3740
3770
|
super(defaults);
|
|
3741
3771
|
this.type = "root";
|
|
@@ -3770,7 +3800,7 @@ var Root$5 = (_a15 = class extends Container$4 {
|
|
|
3770
3800
|
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
3771
3801
|
return lazy.stringify();
|
|
3772
3802
|
}
|
|
3773
|
-
}
|
|
3803
|
+
};
|
|
3774
3804
|
Root$5.registerLazyResult = (dependant) => {
|
|
3775
3805
|
LazyResult$3 = dependant;
|
|
3776
3806
|
};
|
|
@@ -3841,8 +3871,10 @@ var list_1 = list$2;
|
|
|
3841
3871
|
list$2.default = list$2;
|
|
3842
3872
|
var Container$3 = container;
|
|
3843
3873
|
var list$1 = list_1;
|
|
3844
|
-
var
|
|
3845
|
-
|
|
3874
|
+
var Rule$3 = class Rule extends Container$3 {
|
|
3875
|
+
static {
|
|
3876
|
+
__name(this, "Rule");
|
|
3877
|
+
}
|
|
3846
3878
|
constructor(defaults) {
|
|
3847
3879
|
super(defaults);
|
|
3848
3880
|
this.type = "rule";
|
|
@@ -3857,7 +3889,7 @@ var Rule$3 = (_a16 = class extends Container$3 {
|
|
|
3857
3889
|
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
3858
3890
|
this.selector = values.join(sep2);
|
|
3859
3891
|
}
|
|
3860
|
-
}
|
|
3892
|
+
};
|
|
3861
3893
|
var rule = Rule$3;
|
|
3862
3894
|
Rule$3.default = Rule$3;
|
|
3863
3895
|
Container$3.registerRule(Rule$3);
|
|
@@ -3880,8 +3912,10 @@ function findLastWithPosition(tokens) {
|
|
|
3880
3912
|
}
|
|
3881
3913
|
}
|
|
3882
3914
|
__name(findLastWithPosition, "findLastWithPosition");
|
|
3883
|
-
var
|
|
3884
|
-
|
|
3915
|
+
var Parser$1 = class Parser {
|
|
3916
|
+
static {
|
|
3917
|
+
__name(this, "Parser");
|
|
3918
|
+
}
|
|
3885
3919
|
constructor(input2) {
|
|
3886
3920
|
this.input = input2;
|
|
3887
3921
|
this.root = new Root$4();
|
|
@@ -4410,7 +4444,7 @@ var Parser$1 = (_a17 = class {
|
|
|
4410
4444
|
offset: token[2] + token[1].length
|
|
4411
4445
|
});
|
|
4412
4446
|
}
|
|
4413
|
-
}
|
|
4447
|
+
};
|
|
4414
4448
|
var parser = Parser$1;
|
|
4415
4449
|
var Container$2 = container;
|
|
4416
4450
|
var Parser2 = parser;
|
|
@@ -4557,15 +4591,17 @@ function cleanMarks(node2) {
|
|
|
4557
4591
|
}
|
|
4558
4592
|
__name(cleanMarks, "cleanMarks");
|
|
4559
4593
|
var postcss$2 = {};
|
|
4560
|
-
var
|
|
4561
|
-
|
|
4594
|
+
var LazyResult$2 = class LazyResult {
|
|
4595
|
+
static {
|
|
4596
|
+
__name(this, "LazyResult");
|
|
4597
|
+
}
|
|
4562
4598
|
constructor(processor2, css, opts) {
|
|
4563
4599
|
this.stringified = false;
|
|
4564
4600
|
this.processed = false;
|
|
4565
4601
|
let root2;
|
|
4566
4602
|
if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
|
|
4567
4603
|
root2 = cleanMarks(css);
|
|
4568
|
-
} else if (css instanceof
|
|
4604
|
+
} else if (css instanceof LazyResult || css instanceof Result$2) {
|
|
4569
4605
|
root2 = cleanMarks(css.root);
|
|
4570
4606
|
if (css.map) {
|
|
4571
4607
|
if (typeof opts.map === "undefined")
|
|
@@ -4942,7 +4978,7 @@ var LazyResult$2 = (_a18 = class {
|
|
|
4942
4978
|
get [Symbol.toStringTag]() {
|
|
4943
4979
|
return "LazyResult";
|
|
4944
4980
|
}
|
|
4945
|
-
}
|
|
4981
|
+
};
|
|
4946
4982
|
LazyResult$2.registerPostcss = (dependant) => {
|
|
4947
4983
|
postcss$2 = dependant;
|
|
4948
4984
|
};
|
|
@@ -4955,8 +4991,10 @@ var stringify$1 = stringify_1;
|
|
|
4955
4991
|
var warnOnce2 = warnOnce$2;
|
|
4956
4992
|
var parse$1 = parse_1;
|
|
4957
4993
|
var Result$1 = result;
|
|
4958
|
-
var
|
|
4959
|
-
|
|
4994
|
+
var NoWorkResult$1 = class NoWorkResult {
|
|
4995
|
+
static {
|
|
4996
|
+
__name(this, "NoWorkResult");
|
|
4997
|
+
}
|
|
4960
4998
|
constructor(processor2, css, opts) {
|
|
4961
4999
|
css = css.toString();
|
|
4962
5000
|
this.stringified = false;
|
|
@@ -5057,15 +5095,17 @@ var NoWorkResult$1 = (_a19 = class {
|
|
|
5057
5095
|
get [Symbol.toStringTag]() {
|
|
5058
5096
|
return "NoWorkResult";
|
|
5059
5097
|
}
|
|
5060
|
-
}
|
|
5098
|
+
};
|
|
5061
5099
|
var noWorkResult = NoWorkResult$1;
|
|
5062
5100
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
5063
5101
|
var NoWorkResult2 = noWorkResult;
|
|
5064
5102
|
var LazyResult$1 = lazyResult;
|
|
5065
5103
|
var Document$1 = document$1;
|
|
5066
5104
|
var Root$2 = root;
|
|
5067
|
-
var
|
|
5068
|
-
|
|
5105
|
+
var Processor$1 = class Processor {
|
|
5106
|
+
static {
|
|
5107
|
+
__name(this, "Processor");
|
|
5108
|
+
}
|
|
5069
5109
|
constructor(plugins = []) {
|
|
5070
5110
|
this.version = "8.4.38";
|
|
5071
5111
|
this.plugins = this.normalize(plugins);
|
|
@@ -5107,7 +5147,7 @@ var Processor$1 = (_a20 = class {
|
|
|
5107
5147
|
]));
|
|
5108
5148
|
return this;
|
|
5109
5149
|
}
|
|
5110
|
-
}
|
|
5150
|
+
};
|
|
5111
5151
|
var processor = Processor$1;
|
|
5112
5152
|
Processor$1.default = Processor$1;
|
|
5113
5153
|
Root$2.registerProcessor(Processor$1);
|
|
@@ -5275,7 +5315,11 @@ postcss$1.Root;
|
|
|
5275
5315
|
postcss$1.Node;
|
|
5276
5316
|
|
|
5277
5317
|
// src/browser.ts
|
|
5278
|
-
window
|
|
5318
|
+
if (!isWindowWithReportFunction(window)) {
|
|
5319
|
+
throw new Error("Missing __chromatic_report_results__ function on window. Was exposeFunction called?");
|
|
5320
|
+
}
|
|
5321
|
+
var results = await takeSnapshot();
|
|
5322
|
+
window.__chromatic_report_results__(results);
|
|
5279
5323
|
async function takeSnapshot() {
|
|
5280
5324
|
const mirror = createMirror();
|
|
5281
5325
|
const domSnapshot = snapshot(document, {
|
|
@@ -5325,3 +5369,7 @@ async function toDataURL(url) {
|
|
|
5325
5369
|
});
|
|
5326
5370
|
}
|
|
5327
5371
|
__name(toDataURL, "toDataURL");
|
|
5372
|
+
function isWindowWithReportFunction(win) {
|
|
5373
|
+
return "__chromatic_report_results__" in win && typeof win.__chromatic_report_results__ === "function";
|
|
5374
|
+
}
|
|
5375
|
+
__name(isWindowWithReportFunction, "isWindowWithReportFunction");
|
package/dist/index.js
CHANGED
|
@@ -4061,6 +4061,7 @@ var NodeType2 = /* @__PURE__ */ ((NodeType22) => {
|
|
|
4061
4061
|
|
|
4062
4062
|
// src/takeSnapshot.ts
|
|
4063
4063
|
var chromaticSnapshots = /* @__PURE__ */ new Map();
|
|
4064
|
+
var pageToResultHandler = /* @__PURE__ */ new WeakMap();
|
|
4064
4065
|
async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
|
|
4065
4066
|
let name;
|
|
4066
4067
|
let testId;
|
|
@@ -4112,14 +4113,30 @@ async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
|
|
|
4112
4113
|
});
|
|
4113
4114
|
}
|
|
4114
4115
|
__name(takeSnapshot, "takeSnapshot");
|
|
4116
|
+
async function getResultHandler(context) {
|
|
4117
|
+
const page = "page" in context ? context.page() : context;
|
|
4118
|
+
let handler = pageToResultHandler.get(page);
|
|
4119
|
+
if (!handler) {
|
|
4120
|
+
handler = {
|
|
4121
|
+
listeners: [],
|
|
4122
|
+
// Handlers are consumed once - use .splice() to empty previous listeners
|
|
4123
|
+
onResult: (result) => handler.listeners.splice(0).forEach((listener) => listener(result))
|
|
4124
|
+
};
|
|
4125
|
+
await page.exposeFunction("__chromatic_report_results__", handler.onResult);
|
|
4126
|
+
pageToResultHandler.set(page, handler);
|
|
4127
|
+
}
|
|
4128
|
+
return {
|
|
4129
|
+
waitForResult: new Promise((resolve) => handler.listeners.push(resolve))
|
|
4130
|
+
};
|
|
4131
|
+
}
|
|
4132
|
+
__name(getResultHandler, "getResultHandler");
|
|
4115
4133
|
async function executeSnapshotScript(context) {
|
|
4134
|
+
const { waitForResult } = await getResultHandler(context);
|
|
4116
4135
|
await context.addScriptTag({
|
|
4117
4136
|
type: "module",
|
|
4118
4137
|
path: __require.resolve("@chromatic-com/playwright/browser")
|
|
4119
4138
|
});
|
|
4120
|
-
return await
|
|
4121
|
-
return await window.__chromatic_takeSnapshot();
|
|
4122
|
-
});
|
|
4139
|
+
return await waitForResult;
|
|
4123
4140
|
}
|
|
4124
4141
|
__name(executeSnapshotScript, "executeSnapshotScript");
|
|
4125
4142
|
function findIframes(node) {
|
package/dist/index.mjs
CHANGED
|
@@ -4055,6 +4055,7 @@ var NodeType2 = /* @__PURE__ */ ((NodeType22) => {
|
|
|
4055
4055
|
|
|
4056
4056
|
// src/takeSnapshot.ts
|
|
4057
4057
|
var chromaticSnapshots = /* @__PURE__ */ new Map();
|
|
4058
|
+
var pageToResultHandler = /* @__PURE__ */ new WeakMap();
|
|
4058
4059
|
async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
|
|
4059
4060
|
let name;
|
|
4060
4061
|
let testId;
|
|
@@ -4106,14 +4107,30 @@ async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
|
|
|
4106
4107
|
});
|
|
4107
4108
|
}
|
|
4108
4109
|
__name(takeSnapshot, "takeSnapshot");
|
|
4110
|
+
async function getResultHandler(context) {
|
|
4111
|
+
const page = "page" in context ? context.page() : context;
|
|
4112
|
+
let handler = pageToResultHandler.get(page);
|
|
4113
|
+
if (!handler) {
|
|
4114
|
+
handler = {
|
|
4115
|
+
listeners: [],
|
|
4116
|
+
// Handlers are consumed once - use .splice() to empty previous listeners
|
|
4117
|
+
onResult: (result) => handler.listeners.splice(0).forEach((listener) => listener(result))
|
|
4118
|
+
};
|
|
4119
|
+
await page.exposeFunction("__chromatic_report_results__", handler.onResult);
|
|
4120
|
+
pageToResultHandler.set(page, handler);
|
|
4121
|
+
}
|
|
4122
|
+
return {
|
|
4123
|
+
waitForResult: new Promise((resolve) => handler.listeners.push(resolve))
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
__name(getResultHandler, "getResultHandler");
|
|
4109
4127
|
async function executeSnapshotScript(context) {
|
|
4128
|
+
const { waitForResult } = await getResultHandler(context);
|
|
4110
4129
|
await context.addScriptTag({
|
|
4111
4130
|
type: "module",
|
|
4112
4131
|
path: __require.resolve("@chromatic-com/playwright/browser")
|
|
4113
4132
|
});
|
|
4114
|
-
return await
|
|
4115
|
-
return await window.__chromatic_takeSnapshot();
|
|
4116
|
-
});
|
|
4133
|
+
return await waitForResult;
|
|
4117
4134
|
}
|
|
4118
4135
|
__name(executeSnapshotScript, "executeSnapshotScript");
|
|
4119
4136
|
function findIframes(node) {
|