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