Commit Graph

887 Commits

Author SHA1 Message Date
Yanzhen Yu
cabd5eb157 chore(release): publish new version
- rrweb@1.0.6
 - rrweb-player@0.7.8
 - rrweb-snapshot@1.1.9
2021-10-13 00:42:54 +08:00
谭光志
bcadd25f1f docs: 录制与回放时最常用的使用方式 -> 录制与回放是最常用的使用方式 (#729) 2021-10-13 00:22:56 +08:00
Justin Halsall
f410668e3f VSCode Workspace (#718)
* Add workspace file

* Only setup jest tests for rrdom

* Update .vscode/monorepo.code-workspace
2021-10-07 14:15:49 +08:00
yz-yu
6483a594ac update repl tools and script, close #338 (#722) 2021-10-07 14:14:58 +08:00
yz-yu
18e4356be9 migrate to jest (#721)
* migrate rrweb-snapshot tests to jest

* migrate rrweb tests to jest
2021-10-06 15:31:42 +08:00
Yanzhen Yu
5622738e61 fix lock file registry 2021-10-06 13:19:53 +08:00
Yanzhen Yu
2afd4a27e6 upgrade rollup and rollup plugins 2021-10-06 12:14:12 +08:00
Eoghan Murray
333ba18239 Record when a doc is in compatMode and trigger this mode upon replay (#697)
* Hygiene: clean up the xhtml namespace attribute; this is an artefact of the `serializeToString` method which we are using (I think) to be consistent with whitespace and to clean up invalid attributes. I'm removing as was confused as am adding tests related to doctypes

* Record when a document is in `compatMode` and trigger this mode on the iframe upon replay

 https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode

 the included DOCTYPE was picked up from https://stackoverflow.com/questions/18976213/ - there may be better ways of triggering compatMode

* Don't write an extra DOCTYPE if there's one already present in the snapshot. Rely instead on whatever doctype is there to trigger the BackCompat mode

* Modify to write the correct doctype if we can sniff xhtml - don't have any evidence that this will make a difference

* Dev convenience: Ignore files generated by editors

* Typo fix

* Was getting a 2000ms timeout on the 'before' hook I believe

* Change certain tests to go directly to their localhost page instead of loading the html content programmatically in order to avoid triggering an incorrect BackCompat mode (incorrect in that the html content has a correct doctype)

* Add test based on motivating site that had images lined up in a square which were all different sizes; very old style percentage width/height attributes were doing the right thing in quirksmode, which is what we are testing for here

* Fixup rrweb test html to include a valid doctype and avoid BackCompat to ensure we're not accidentally testing against quirks modes. I didn't find an elegant way of avoiding the `BackCompat` when adding a minimal iframe, so some BackCompat has slipped in here, I don't think there's much harm
2021-10-06 09:34:22 +08:00
Pavel Hurieiev
4ff6e41877 fix(rrweb-snapshot): don't exclude @import CSS rules from the output and use CSSRule.cssText instead when they throw an exception while accessing their CSSStyleSheet.cssRules property (#720) 2021-10-06 09:20:41 +08:00
Phil Leggetter
179e7e77d7 adds PostHog as users to the README (#719) 2021-10-06 09:11:23 +08:00
Yanzhen Yu
fe4342e8b8 gc virtual style map when DOM has been removed 2021-10-02 22:15:46 +08:00
Yanzhen Yu
53492c1ee4 improve type assertion, from #716 2021-10-01 15:27:45 +08:00
Yanzhen Yu
10375632ec fix lint warning 2021-10-01 15:05:34 +08:00
Eoghan Murray
b2f2b8e4ef Monkeypatch each iframe (#716)
* `setTimeout` and `clearTimeout` are global functions. Think the window versions of them were for the following reason: https://stackoverflow.com/questions/60245787/

* Comments and extra test here helped me understand which inserts were expected and which are to be ignored

* Add a test for the style setProperty/removeProperty added in #671

* Add a test to ensure that listeners get added correctly in nested iframes - particularly important for those which rely on prototype monkeypatching

* Pass in the window object from the current iframe so that monkeypatching applies to all windows

* Satisfy typings

* No need to insert an iframe as there's one already set up for us

* Enable the console logger to also intercept log messages within iframes

* There's no tests for FontFace but presumably the monkeypatching here works similarly to the others
2021-10-01 14:56:17 +08:00
Yanzhen Yu
fe43860376 fix props typo 2021-09-29 17:58:01 +08:00
John Pham
971c08adc1 Set the blockClass element's background color to the inherited color (#707)
* Set the blockClass element's background color to the inherited color

* Update snapshot

* Update snapshot
2021-09-25 23:54:49 +08:00
Justin Halsall
e67eb1cd09 Fixes #690 (#701)
Add nested css recording for safari
2021-09-21 22:36:45 +08:00
Justin Halsall
e441a05928 prefer yarn over npm (#705) 2021-09-16 18:59:39 +08:00
Lucky Feng
875e3c5bd2 improve config definition in the console plugin (#704)
One user encountered a type problem(https://rrweb.slack.com/archives/C01BYDC5C93/p1631683830050900). It turns out that definition of LogReplayConfig isn't perfect
2021-09-15 19:25:19 +08:00
Justin Halsall
e630cfb88e Keep blocked root elements as placeholders (#696)
* Keep blocked root elements as placeholders

`serializeNode` turns blocked elements into placeholder nodes so we need to make sure we don't remove these elements from the mutations when they get added.
We do however need to keep removing any children of these blocked elements from getting added or mutated.

* Update packages/rrweb/src/record/mutation.ts
2021-09-13 20:06:25 +08:00
Yanzhen Yu
c864e5b0e9 chore(release): publish new version
- rrweb@1.0.5
 - rrweb-player@0.7.7
2021-09-11 22:46:25 +08:00
Yanzhen Yu
83ef4138aa update lerna scripts 2021-09-11 22:46:06 +08:00
Yuku Kotani
5b40470dcf chek is CSSGroupingRule supported (#693) 2021-09-09 23:51:33 +08:00
Yanzhen Yu
b068241f8e close #688, remove legacy counter
A previous patch has refactored the canvas image loading process
and it does not use <img /> anymore, so the counter is no longer
need.

commit: 4a72ff0b3cdf9920ea38bca8f69eedbfe52c99904a0036f3fc1cd7c1e0248a37R725
2021-09-02 15:55:39 +08:00
dependabot[bot]
e9db702b48 Bump tar from 4.4.17 to 4.4.19 (#686)
Bumps [tar](https://github.com/npm/node-tar) from 4.4.17 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.17...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-01 10:22:42 +08:00
Yanzhen Yu
df75d58fb0 chore(release): publish %s
- rrweb@1.0.4
 - rrweb-player@0.7.6
2021-08-30 21:41:48 +08:00
Yanzhen Yu
b711ff9114 hotfix rrweb es entry 2021-08-30 21:40:58 +08:00
Yanzhen Yu
5857c7b718 update typing files 2021-08-29 22:42:03 +08:00
yz-yu
5dcbfa530f impl #650, CSS declaration observer (#671) 2021-08-23 12:22:23 +08:00
Eoghan Murray
9e226b593f The desktop pointer cursor is not representative of mobile (#662)
* Simplify css for click animation

* Refactor to transfer responsibility for casting multiple synchronous to index.ts from machine.ts (so they can be dealt with in bulk)

* During synchronous application of a batch of events, move the mouse to the last position so that it's in the correct place when the timer starts

 - previous `needCastInSyncMode` added in 4bf533a675 meant that the isSync versions of MouseMove/TouchMove were being accidentally ignored
 - each synchronous MouseMove would have resulted in a separate mouse position update
 - the Click/TouchStart/TouchEnd events didn't have an async version

* The desktop pointer cursor is not representative of what is happening on a mobile device.

Instead, check a recording for any presence of a Touch event, and switch to a touch visualisation mode for the entire recording.
(for now, we use this mode even for mixed touch/mouse devices - this could be improved upon in future)

Show a round circle representing the users' finger which is visible only between TouchStart and TouchEnd events
Again this can be evolved upon, but this change should be a good start in the right direction.

* It's more correct to not have a transition for repositioning of touch as user can lift finger off screen and place elsewhere; however we can now have much smoother touch movement during the .touch-active phase as we know the finger is on the screen. This has a .25s delaying effect on the touch position which IMO is acceptable; e.g. scroll position can lag behind a touch movement and this seems to bring them more in sync

* Ensure we end up with the correct touch-active state after a series of synchronous events

* Important to discontinue tail animations and position transitions when user has lifted their finger and placed it into a new position. This is apparent in a replay session where the user is scrolling the page using repeated TouchMove bottom-to-top movements

* Simplify by unwrapping `mouseState.touchActive` and `mouseState.pos` into their own global vars
2021-08-17 15:05:47 +08:00
Justin Halsall
0bf53089da refactor nested style code (#667) 2021-08-15 16:41:40 +08:00
Yanzhen Yu
997e960feb fix registry in lock file 2021-08-15 16:15:31 +08:00
Yanzhen Yu
f95ee4dfec update yarn.lock 2021-08-15 15:53:29 +08:00
yz-yu
e6f1810144 Record and replay nested stylesheet rules (#666)
* fix typo

* record nested style rules

* Replay nested style rules

* handle index array in replayer

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2021-08-15 15:48:17 +08:00
Yanzhen Yu
8d881b1783 chore(release): publish %s
- rrweb@1.0.3
 - rrweb-player@0.7.5
 - rrweb-snapshot@1.1.8
2021-08-15 15:13:46 +08:00
Yanzhen Yu
9571c36d80 add lerna to manage monorepo 2021-08-14 23:58:56 +08:00
Eoghan Murray
e5b0750e90 Don't trust the html 'value' attribute on <option> - the DOM .selected is the one we want I think. (#651)
- encountered inconsistent html with multiple <option> elements with the same value attribute
 - due to check `attributes.selected = (n as HTMLOptionElement).selected;` the extra ones were being stored as `selected: false`; furthermore, the `false` value was being ignored upon replay, and so the last of the extra ones was being chosen as the 'selected' option
2021-08-14 15:17:17 +08:00
Eoghan Murray
c0fbfa7774 Revert some of the non-essential changes of #630 (for ease of merging other branches) (#652) 2021-08-14 14:56:57 +08:00
Eoghan Murray
009d73ab79 Fix that timer.addAction reverses order when splicing multiple events at same timestamp (#611)
* Add test for event ordering utilizing final html testing method added by Justin (with thanks)

* Found an error where two mutation events had the same timestamp, but one removed a node added in the other. The `actions.splice` method was reversing their order and triggering a 'Node with id [...] not found' error
2021-08-10 00:03:24 +08:00
Eoghan Murray
188f31eea9 Correct links in #647; think they were only working previously with an auto-redirect (#658) 2021-08-09 18:18:32 +08:00
Peter Chen
8d40e52010 fix: fix console plugin's OOM problem (#656)
* fix: fix console plugin's OOM problem

* fix: fix console plugin

* feat: patch

* feat: patch

* feat: patch

Co-authored-by: chenyangbj01 <chenyangbj01@fenbi.com>
2021-08-07 23:06:50 +08:00
Olivia Osborn
838287a16d Removed sn undefined warning (#572) 2021-08-03 13:09:43 +08:00
Yanzhen Yu
2cd978b335 update git ignore 2021-08-01 21:43:04 +08:00
dbseel
da721e4f5a DragEvent handling, null check fixes (#630) 2021-07-31 15:18:02 +08:00
Eoghan Murray
3301038869 Reference packages directly in docs (removing direct references to the old rrweb-snapshot and rrweb-player repositories) (#647) 2021-07-31 15:02:41 +08:00
Eoghan Murray
1dc8d688d2 Provide an option to only build rrweb-snapshot for inclusion in rrweb (#649) 2021-07-31 00:15:34 +08:00
Justin Halsall
588164aa12 Cache addHoverClass as it is quite expensive (#643)
* Add cache and cache purging

Needed for https://github.com/rrweb-io/rrweb-snapshot/pull/85

* Add cache and cache purging

Needed for https://github.com/rrweb-io/rrweb-snapshot/pull/85

* Cache addHoverClass as it is quite expensive

https://github.com/rrweb-io/rrweb-snapshot/pull/85

* Make cache non-optional

* Make cache required on addHoverClass
2021-07-26 22:13:03 +08:00
yz-yu
bdd869506c Merge pull request #595 from Mark-Fenng/monorepo
Merge rrweb, rrweb-snapshot, rrweb-player into a mono repository
2021-07-23 23:01:19 +08:00
Mark-fenng
4f0d21a053 update links of packages and README 2021-07-23 08:45:29 +08:00
Mark-fenng
6c34ffa7ce moved rrweb into packages/rrweb 2021-07-22 23:43:52 +08:00