Commit Graph

257 Commits

Author SHA1 Message Date
Yanzhen Yu
42a205e4c5 update typings entry 2026-04-01 12:00:00 +08:00
Yanzhen Yu
ccb2dd0562 Release 0.8.0 2026-04-01 12:00:00 +08:00
Yanzhen Yu
191908aa1d continue #199: redesign the bundled file structure
According to @eoghanmurray's suggestion, we can support three
main scenarios:
1. record only
2. replay only
3. all in one

Since we have implemented the packer feature, which has a big
influence in bundle size, we provide another three bundles:
1. record and pack
2. replay and unpack
3. all in one with pack and unpack
2026-04-01 12:00:00 +08:00
Yanzhen Yu
81b3407dd7 export utils as public API 2026-04-01 12:00:00 +08:00
Yanzhen Yu
6b10e1c4ee update typescript to 3.9.5 2026-04-01 12:00:00 +08:00
Eoghan Murray
d57cae3d51 Move mutation processing into it's own class (#223)
* Move mutation processing into it's own object.

This should stand on it's own as a refactor, but is intended as a basis
for exposing the new MutationBuffer object to further outside control e.g.
to 'mute' or batch up mutation emission when the page becomes inactive
from a https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
point of view

* The `processMutations` function needed to be bound to the `mutationBuffer` object, as otherwise `this` referred to the `MutationObserver` object itself

* Neglected to add this output of `npm run typings`

* Get around the binding problem by using Arrow function expressions

* Prettier formatting
2026-04-01 12:00:00 +08:00
Yanzhen Yu
06024b245f close #216 rebuild first full snapshot when init the replayer 2026-04-01 12:00:00 +08:00
yz-yu
2a6e2e0ef9 Live mode 2 (#226)
* refactoring play, pause, resume, load style sheet to subscribe style code

* support live mode in state machine

* 1. upgrade @xstate/fsm
2. add toggle interact methods to the player
2026-04-01 12:00:00 +08:00
Jinxing Lin
5317bf73b9 update packer unit test (#220) 2026-04-01 12:00:00 +08:00
Eoghan Murray
da2ad8b456 Keep npm run typings happy (#222) 2026-04-01 12:00:00 +08:00
Eoghan Murray
610c2b3ec4 This dimension is in px but is unitless according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe (#214) 2026-04-01 12:00:00 +08:00
Rifaudeen
4bb0bdb180 added custom-event emitter to replayer (#219) 2026-04-01 12:00:00 +08:00
nicolas-meunier-97
dcff282c90 Small syntaxe error (#207)
"A" should be used here, because the word after it ("unique"), begins with a consonant sound
2026-04-01 12:00:00 +08:00
yz-yu
43be602816 mutation observer v2 (#206)
There are some long-term issues in rrweb's mutation observer.

A scenario cause problem:
A list of DOM node: n1, n2, n3, n4, n5
Steps of modifying the nodes:
  1. remove n1, n2, n3, n4 sequentially
  2. append n4, n3, n2, n1 after n5 sequentially
Then we got the added node data like this:
  (id: n4, prev: null, next: n3  )
  (id: n3, prev: n4,   next: n2  )
  (id: n2, prev: n3,   next: n1  )
  (id: n1, prev: n2,   next: null)
The problem comes when we try to replay the first add node datum.
Since its prev node is null, we rely on its next sibling n3. But
n3 was not present at this moment, and in previous code, we fallback
to append n4 to the last of its parent node.

The solution is to defer the append of elements that missing
siblings. But it is also hard to tell which node is the first one
that needs to be appended.

Take a step back and rethink the design of the mutation observer,
we've found there are two implementations make things complicated.
1. We set the id to -1 when we seeing some nodes are not serialized yet.
2. We record both previous sibling and next sibling to determine the
position of the node.
But we can do better!
First, we can put nodes with un-serialized siblings
to a queue, and try to add it again later. Then we can just record the next
sibling as 'the single truth' so we can be sure which node is the last
one of its parent.

This patch has implemented the new observer strategy. Data recorded with
the new observer should no longer have any node with id -1. But for
compatibility consideration, we still keep some replayer code that helps
solve legacy data.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
2a323da123 close #205
1. upgrade rollup postcss plugin
2. fix postcss plugins for bundles
2026-04-01 12:00:00 +08:00
yz-yu
1efc9ad30b Bundles (#199)
* provide more bundle outputs

* update commonJS and es module entry to boot file
2026-04-01 12:00:00 +08:00
yz-yu
bfc0c43aa7 impl basic player state machine (#198) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
a7d857c9e4 update rollup terser plugin 2026-04-01 12:00:00 +08:00
Yanzhen Yu
b8366ebf2d Release 0.7.33 2026-04-01 12:00:00 +08:00
Yanzhen Yu
0a62fd730c upgrade TS 2026-04-01 12:00:00 +08:00
Eoghan Murray
cd78aaa0fd Fix for certain websites which don't scroll on their document.documentElement (#193)
- document.documentElement.scrollTop may be zero, but document.body.scrollTop may have the actual scrolling amount
 - main fallback idea taken from https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX
 - modified as `(document.documentElement || document.body).scrollTop` will incorrectly report zero.
 - version here supported by https://github.com/mochi/mochikit/blob/master/MochiKit/Position.js#L23
2026-04-01 12:00:00 +08:00
Yanzhen Yu
6a4d9e4c67 use a fixed version of styled-components to make snapshot testing stable 2026-04-01 12:00:00 +08:00
Yanzhen Yu
bc78468ef4 Release 0.7.32 2026-04-01 12:00:00 +08:00
Yanzhen Yu
7fb0eb4d19 Revert "Create FUNDING.yml"
This reverts commit 2c438d1812.
2026-04-01 12:00:00 +08:00
yz-yu
825ebdf6e8 Create FUNDING.yml 2026-04-01 12:00:00 +08:00
Yanzhen Yu
4209ea7fe8 Update rollup
With rollup's preserveModules option and the sideEffects flag in
package.json, now we have the power of tree shaking.
2026-04-01 12:00:00 +08:00
yz-yu
dcad6ff922 Packer (#172)
* introduce pako and add general packer interface

* add tests for packer

* use function API instead of class API for better tree shaking support

* refcatoring the rollup bundle config
2026-04-01 12:00:00 +08:00
Yanzhen Yu
f1adef4693 Release 0.7.31 2026-04-01 12:00:00 +08:00
Eoghan Murray
3d4280b23a Keep track of pause/play state so that player doesn't accidentally 'unpause' a user pause action (#189) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
f8b20530d3 Release 0.7.30 2026-04-01 12:00:00 +08:00
Yanzhen Yu
f57bb1041b remove useless console.log 2026-04-01 12:00:00 +08:00
Yanzhen Yu
67ef897454 tolerate insertRule error since browser may throw Error on wrong prefix 2026-04-01 12:00:00 +08:00
Yanzhen Yu
c68d3e1803 avoid style sheet rules index overflow 2026-04-01 12:00:00 +08:00
Yanzhen Yu
bd5aa59589 ignore style sheet changes before the target DOM was serialized
The serialized DOM will contains all the styles, so this looks safe.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
79a7191916 add an integration tests for react and styled components 2026-04-01 12:00:00 +08:00
Yanzhen Yu
e194e08b17 make the unit tests more stable 2026-04-01 12:00:00 +08:00
Yanzhen Yu
ca2b074743 update rrweb-snapshot 2026-04-01 12:00:00 +08:00
Filip Slatinac
a242a105d3 Checking node existence (#174)
* added our package

* reverted back to old rrweb snapshot

* Array.from does not capture all elements added in the set, we have to manually iterate through the iterator

* package lock

* checking if nodes are in the parent before we try inserting them
2026-04-01 12:00:00 +08:00
Eoghan Murray
23220f1771 Was experiencing case when a TouchEnd event occurred on a text element i.e. (nodeType: 3 / nodeName: #text) (#180)
This was a recording taken with rrweb 0.7.27 (3afff63970) and rrweb-snapshot 0.7.21 (a0dc9481b2) so issue may have been fixed in the intervening commits
2026-04-01 12:00:00 +08:00
Yanzhen Yu
91064d48cb Release 0.7.29 2026-04-01 12:00:00 +08:00
Yanzhen Yu
329c790194 add trigger focus option to replayer, which may helps integration into other apps 2026-04-01 12:00:00 +08:00
Yanzhen Yu
9035a8f814 Release 0.7.28 2026-04-01 12:00:00 +08:00
Yanzhen Yu
268a0df040 update rrweb-snapshot 2026-04-01 12:00:00 +08:00
David Cramer
704f6d4a4f Add support for replaying StyleSheetRule events (#178) 2026-04-01 12:00:00 +08:00
David Cramer
3a0e829884 Add observers for stylesheet mutations (#177)
* hack together stylesheet observer

* Add test coverage for insertRule/deleteRule on stylesheets

* Add new observers

* update patch based on changes to master

* Functioning event recording

* Remove print statements

* Fix ID usage and mark add vs remove

* Correct type

Co-authored-by: Jon Perl <perl.jonathan@gmail.com>
2026-04-01 12:00:00 +08:00
Yanzhen Yu
c7140ea8c6 fix dependency path 2026-04-01 12:00:00 +08:00
Yanzhen Yu
5bfc2c704a impl media interactions recording
close #159
close #72
listen to HTMLMediaElement's play/pause events, and replay them
by programmatically play and pause the target element.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
d0c31bb4cf close #153 emit event when it being casted 2026-04-01 12:00:00 +08:00
Yanzhen Yu
e1d025a1fd close #152
update rrweb-snapshot which contains the fix
2026-04-01 12:00:00 +08:00
Yanzhen Yu
73dc8bd9cd update release it config 2026-04-01 12:00:00 +08:00