@elenjical-ai/replay 10.76.2 → 10.76.3

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.
@@ -3214,11 +3214,52 @@ function initAdoptedStyleSheetObserver({
3214
3214
  if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)
3215
3215
  return () => {
3216
3216
  };
3217
+ let stopped = false;
3218
+ let changePending = false;
3219
+ const proxies = /* @__PURE__ */ new WeakMap();
3220
+ const recordInPlaceChange = () => {
3221
+ if (changePending) return;
3222
+ changePending = true;
3223
+ void Promise.resolve().then(() => {
3224
+ changePending = false;
3225
+ if (stopped || hostId === null || hostId === -1) return;
3226
+ try {
3227
+ const sheets = originalPropertyDescriptor.get?.call(
3228
+ host
3229
+ );
3230
+ stylesheetManager.adoptStyleSheets(Array.from(sheets), hostId);
3231
+ } catch (e2) {
3232
+ }
3233
+ });
3234
+ };
3235
+ const recordingProxy = (sheets) => {
3236
+ if (!sheets || typeof Proxy === "undefined" || stylesheetManager.recordInPlaceChanges === false)
3237
+ return sheets;
3238
+ let proxy = proxies.get(sheets);
3239
+ if (!proxy) {
3240
+ proxy = new Proxy(sheets, {
3241
+ set(target, property, value) {
3242
+ const result = Reflect.set(target, property, value);
3243
+ recordInPlaceChange();
3244
+ return result;
3245
+ },
3246
+ deleteProperty(target, property) {
3247
+ const result = Reflect.deleteProperty(target, property);
3248
+ recordInPlaceChange();
3249
+ return result;
3250
+ }
3251
+ });
3252
+ proxies.set(sheets, proxy);
3253
+ }
3254
+ return proxy;
3255
+ };
3217
3256
  Object.defineProperty(host, "adoptedStyleSheets", {
3218
3257
  configurable: originalPropertyDescriptor.configurable,
3219
3258
  enumerable: originalPropertyDescriptor.enumerable,
3220
3259
  get() {
3221
- return originalPropertyDescriptor.get?.call(this);
3260
+ return recordingProxy(
3261
+ originalPropertyDescriptor.get?.call(this)
3262
+ );
3222
3263
  },
3223
3264
  set(sheets) {
3224
3265
  const result = originalPropertyDescriptor.set?.call(this, sheets);
@@ -3232,6 +3273,7 @@ function initAdoptedStyleSheetObserver({
3232
3273
  }
3233
3274
  });
3234
3275
  return callbackWrapper(() => {
3276
+ stopped = true;
3235
3277
  Object.defineProperty(host, "adoptedStyleSheets", {
3236
3278
  configurable: originalPropertyDescriptor.configurable,
3237
3279
  enumerable: originalPropertyDescriptor.enumerable,
@@ -3967,6 +4009,7 @@ class StylesheetManager {
3967
4009
  this.styleMirror = new StyleSheetMirror();
3968
4010
  this.mutationCb = options.mutationCb;
3969
4011
  this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
4012
+ this.recordInPlaceChanges = options.recordInPlaceChanges !== false;
3970
4013
  }
3971
4014
  attachLinkElement(linkEl, childSn) {
3972
4015
  if ("_cssText" in childSn.attributes)
@@ -4085,6 +4128,7 @@ function record(options = {}) {
4085
4128
  recordDOM = true,
4086
4129
  recordCanvas = false,
4087
4130
  recordCrossOriginIframes = false,
4131
+ recordAdoptedStyleSheetChanges = true,
4088
4132
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
4089
4133
  userTriggeredOnInput = false,
4090
4134
  collectFonts = false,
@@ -4231,7 +4275,8 @@ function record(options = {}) {
4231
4275
  });
4232
4276
  const stylesheetManager = new StylesheetManager({
4233
4277
  mutationCb: wrappedMutationEmit,
4234
- adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit
4278
+ adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit,
4279
+ recordInPlaceChanges: recordAdoptedStyleSheetChanges
4235
4280
  });
4236
4281
  const iframeManager = typeof __RRWEB_EXCLUDE_IFRAME__ === "boolean" && __RRWEB_EXCLUDE_IFRAME__ ? new IframeManagerNoop() : new IframeManager({
4237
4282
  mirror,
@@ -8246,7 +8291,9 @@ class Replay {
8246
8291
  }
8247
8292
  },
8248
8293
  // experimental support for recording iframes from different origins
8249
- recordCrossOriginIframes: Boolean(_experiments.recordCrossOriginIframes)
8294
+ recordCrossOriginIframes: Boolean(_experiments.recordCrossOriginIframes),
8295
+ // Elenjical: adoptedStyleSheets changed in place (Stencil 4.36+, Ionic 8.7.1+) are recorded unless turned off.
8296
+ recordAdoptedStyleSheetChanges: _experiments.recordAdoptedStyleSheetChanges !== false
8250
8297
  };
8251
8298
  this._initialOptions = {
8252
8299
  flushMinDelay,