Commit Graph

912 Commits

Author SHA1 Message Date
Yanzhen Yu
7feb2c945c update typescript to 3.9.5 2020-06-12 18:32:48 +08:00
Maxim Postautov
341b1858b9 add '-' to symbolAndNumberRegex (#34) 2020-06-06 21:14:09 +08:00
Eoghan Murray
8766335c82 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
2020-06-06 18:33:58 +08:00
Yanzhen Yu
ee73bd4919 close #216 rebuild first full snapshot when init the replayer 2020-05-31 16:35:42 +08:00
yz-yu
8913bcb9d6 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
2020-05-31 15:40:17 +08:00
Jinxing Lin
0910447081 update packer unit test (#220) 2020-05-30 22:48:02 +08:00
Rifaudeen
a60cf99691 Added tags support in the player timeline (#17)
* implemented custom-event handler from replayer

* Added tags support in the player timeline

* updated event type check with EventType enum from rrweb
2020-05-28 23:31:12 +08:00
Eoghan Murray
7d062830ab Keep npm run typings happy (#222) 2020-05-27 10:04:43 +08:00
Eoghan Murray
0bbe79b42b This dimension is in px but is unitless according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe (#214) 2020-05-23 15:24:19 +08:00
Rifaudeen
45a7f89f2b added custom-event emitter to replayer (#219) 2020-05-23 15:20:41 +08:00
nicolas-meunier-97
0ef1155308 Small syntaxe error (#207)
"A" should be used here, because the word after it ("unique"), begins with a consonant sound
2020-05-05 21:03:37 +08:00
yz-yu
7a666293b6 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.
2020-05-02 14:08:10 +08:00
Yanzhen Yu
f8e3cc6e19 close #205
1. upgrade rollup postcss plugin
2. fix postcss plugins for bundles
2020-04-30 21:41:51 +08:00
yz-yu
7a0fbaecd5 Bundles (#199)
* provide more bundle outputs

* update commonJS and es module entry to boot file
2020-04-15 22:54:12 +08:00
yz-yu
877e2ce958 impl basic player state machine (#198) 2020-04-12 15:16:30 +08:00
Yanzhen Yu
c92978f4e8 update rollup terser plugin 2020-04-12 14:46:04 +08:00
Yanzhen Yu
445b3953f1 Release 0.7.33 2020-04-12 00:07:32 +08:00
Yanzhen Yu
f159d7711f upgrade TS 2020-04-12 00:06:57 +08:00
Eoghan Murray
1bb7ffd8fc 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
2020-04-11 23:15:10 +08:00
Yanzhen Yu
36ba02e709 use a fixed version of styled-components to make snapshot testing stable 2020-04-11 22:51:50 +08:00
Yanzhen Yu
675a8541b4 Release 0.4.6 2020-04-11 20:03:13 +08:00
Yanzhen Yu
c435c5f095 update player with built-in unpack function 2020-04-11 20:02:26 +08:00
Yanzhen Yu
4811589816 Release 0.7.32 2020-04-11 18:36:07 +08:00
Yanzhen Yu
685951d0c4 Revert "Create FUNDING.yml"
This reverts commit 2c438d1812.
2020-04-08 20:38:55 +08:00
yz-yu
2c438d1812 Create FUNDING.yml 2020-04-08 20:35:45 +08:00
Yanzhen Yu
8a1d74f6cb Update rollup
With rollup's preserveModules option and the sideEffects flag in
package.json, now we have the power of tree shaking.
2020-04-07 22:11:46 +08:00
yz-yu
4f36d0e57d 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
2020-04-07 18:03:47 +08:00
Yanzhen Yu
b0451fc257 Release 0.4.5 2020-04-05 22:33:12 +08:00
Yanzhen Yu
6933a3b807 use player dimension to calc scale when fullscreen 2020-04-05 22:31:47 +08:00
Yanzhen Yu
18063bee33 Release 0.4.4 2020-04-05 22:14:52 +08:00
Yanzhen Yu
08d21b41ba allow scale over 1 2020-04-05 22:14:28 +08:00
Yanzhen Yu
b1723e1716 update rrweb 2020-04-05 22:10:27 +08:00
Yanzhen Yu
18129bab70 Release 0.7.31 2020-04-05 22:04:46 +08:00
Eoghan Murray
e12d240064 Keep track of pause/play state so that player doesn't accidentally 'unpause' a user pause action (#189) 2020-03-31 22:15:17 +08:00
Yanzhen Yu
318ce9eb09 Release 0.7.30 2020-03-29 22:25:57 +08:00
Yanzhen Yu
3f30c47cfb remove useless console.log 2020-03-29 22:05:07 +08:00
Yanzhen Yu
380819ca70 tolerate insertRule error since browser may throw Error on wrong prefix 2020-03-29 21:18:39 +08:00
Yanzhen Yu
6e38ae4735 avoid style sheet rules index overflow 2020-03-29 21:14:45 +08:00
Eoghan Murray
c14242e932 Avoid more common causes of 'blocked script execution' console.error messages in Chrome which are not exceptions (but look like them): (#30)
'Blocked script execution in '<page>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set'
2020-03-26 23:15:41 +08:00
Yanzhen Yu
197526fbe8 ignore style sheet changes before the target DOM was serialized
The serialized DOM will contains all the styles, so this looks safe.
2020-03-22 00:36:20 +08:00
Yanzhen Yu
02a33faaf9 add an integration tests for react and styled components 2020-03-21 23:21:45 +08:00
Yanzhen Yu
5e549c4ee4 make the unit tests more stable 2020-03-21 22:18:08 +08:00
Yanzhen Yu
9f2f6757b3 update rrweb-snapshot 2020-03-14 15:20:18 +08:00
Yanzhen Yu
6245bee7bd Release 0.7.26 2020-03-14 14:48:41 +08:00
Yanzhen Yu
89445f3c50 close #29 add MIT license 2020-03-14 14:46:56 +08:00
James Bradley
86cf78822d H tags (#28)
* Failing test

* Allow numbers in el name tests

* Allow numbers in el names
2020-03-10 22:33:23 +08:00
Filip Slatinac
fc6c6c43d5 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
2020-03-01 15:02:32 +08:00
Eoghan Murray
444570b7fc 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
2020-03-01 15:00:32 +08:00
Yanzhen Yu
10f192d54b Release 0.4.3 2020-02-28 19:53:55 +08:00
Yanzhen Yu
6e4a7c3637 add rrweb options 2020-02-28 19:53:31 +08:00