@cloudcare/browser-rum 2.2.15 → 3.0.0
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.
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/recorderApi.js +161 -0
- package/cjs/boot/rum.entry.js +6 -1
- package/cjs/boot/rum.js +15 -5
- package/cjs/boot/rumPublicApi.js +8 -4
- package/cjs/boot/startRecording.js +55 -0
- package/cjs/constants.js +52 -0
- package/cjs/domain/assembly.js +1 -7
- package/cjs/domain/configuration.js +3 -2
- package/cjs/domain/contexts/foregroundContexts.js +138 -0
- package/cjs/domain/contexts/internalContext.js +1 -1
- package/cjs/domain/contexts/urlContexts.js +9 -2
- package/cjs/domain/domMutationCollection.js +4 -5
- package/cjs/domain/initViewportObservable.js +52 -0
- package/cjs/domain/locationChangeObservable.js +12 -26
- package/cjs/domain/performanceCollection.js +2 -13
- package/cjs/domain/replay/record/elementsScrollPositions.js +27 -0
- package/cjs/domain/replay/record/index.js +41 -0
- package/cjs/domain/replay/record/mutationBatch.js +58 -0
- package/cjs/domain/replay/record/mutationObserver.js +383 -0
- package/cjs/domain/replay/record/observers.js +473 -0
- package/cjs/domain/replay/record/privacy.js +256 -0
- package/cjs/domain/replay/record/record.js +174 -0
- package/cjs/domain/replay/record/serializationUtils.js +137 -0
- package/cjs/domain/replay/record/serialize.js +488 -0
- package/cjs/domain/replay/record/shadowRootsController.js +61 -0
- package/cjs/domain/replay/record/utils.js +53 -0
- package/cjs/domain/replay/record/viewports.js +104 -0
- package/cjs/domain/replay/replayStats.js +83 -0
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +43 -0
- package/cjs/domain/replay/segmentCollection/deflateWorker.js +4399 -0
- package/cjs/domain/replay/segmentCollection/index.js +33 -0
- package/cjs/domain/replay/segmentCollection/segment.js +101 -0
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +179 -0
- package/cjs/domain/replay/segmentCollection/startDeflateWorker.js +126 -0
- package/cjs/domain/requestCollection.js +35 -17
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js +12 -4
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js +6 -5
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +8 -6
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +111 -75
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +22 -28
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +94 -54
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +13 -5
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js +45 -0
- package/cjs/domain/rumEventsCollection/view/trackViewMetrics.js +1 -19
- package/cjs/domain/rumEventsCollection/view/trackViews.js +21 -18
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +12 -9
- package/cjs/domain/rumSessionManager.js +6 -3
- package/cjs/domain/tracing/getDocumentTraceId.js +2 -10
- package/cjs/domain/trackEventCounts.js +10 -2
- package/cjs/domain/waitPageActivityEnd.js +5 -1
- package/cjs/transport/startRumBatch.js +5 -7
- package/cjs/types/index.js +18 -0
- package/cjs/types/sessionReplayConstants.js +56 -0
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/recorderApi.js +149 -0
- package/esm/boot/rum.entry.js +4 -1
- package/esm/boot/rum.js +15 -6
- package/esm/boot/rumPublicApi.js +8 -4
- package/esm/boot/startRecording.js +44 -0
- package/esm/constants.js +31 -0
- package/esm/domain/assembly.js +1 -7
- package/esm/domain/configuration.js +4 -3
- package/esm/domain/contexts/foregroundContexts.js +122 -0
- package/esm/domain/contexts/internalContext.js +1 -1
- package/esm/domain/contexts/urlContexts.js +10 -3
- package/esm/domain/domMutationCollection.js +5 -6
- package/esm/domain/initViewportObservable.js +39 -0
- package/esm/domain/locationChangeObservable.js +13 -27
- package/esm/domain/performanceCollection.js +1 -12
- package/esm/domain/replay/record/elementsScrollPositions.js +20 -0
- package/esm/domain/replay/record/index.js +3 -0
- package/esm/domain/replay/record/mutationBatch.js +35 -0
- package/esm/domain/replay/record/mutationObserver.js +331 -0
- package/esm/domain/replay/record/observers.js +457 -0
- package/esm/domain/replay/record/privacy.js +233 -0
- package/esm/domain/replay/record/record.js +158 -0
- package/esm/domain/replay/record/serializationUtils.js +107 -0
- package/esm/domain/replay/record/serialize.js +461 -0
- package/esm/domain/replay/record/shadowRootsController.js +49 -0
- package/esm/domain/replay/record/utils.js +38 -0
- package/esm/domain/replay/record/viewports.js +87 -0
- package/esm/domain/replay/replayStats.js +64 -0
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +31 -0
- package/esm/domain/replay/segmentCollection/deflateWorker.js +4390 -0
- package/esm/domain/replay/segmentCollection/index.js +3 -0
- package/esm/domain/replay/segmentCollection/segment.js +84 -0
- package/esm/domain/replay/segmentCollection/segmentCollection.js +158 -0
- package/esm/domain/replay/segmentCollection/startDeflateWorker.js +113 -0
- package/esm/domain/requestCollection.js +36 -18
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +12 -4
- package/esm/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +6 -5
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +6 -6
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +105 -74
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +22 -28
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +99 -59
- package/esm/domain/rumEventsCollection/error/errorCollection.js +13 -5
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +33 -0
- package/esm/domain/rumEventsCollection/view/trackViewMetrics.js +1 -18
- package/esm/domain/rumEventsCollection/view/trackViews.js +21 -19
- package/esm/domain/rumEventsCollection/view/viewCollection.js +12 -9
- package/esm/domain/rumSessionManager.js +6 -3
- package/esm/domain/tracing/getDocumentTraceId.js +1 -9
- package/esm/domain/trackEventCounts.js +10 -2
- package/esm/domain/waitPageActivityEnd.js +5 -1
- package/esm/transport/startRumBatch.js +5 -7
- package/esm/types/index.js +1 -0
- package/esm/types/sessionReplayConstants.js +45 -0
- package/package.json +3 -3
- package/src/boot/recorderApi.js +166 -0
- package/src/boot/rum.entry.js +4 -1
- package/src/boot/rum.js +38 -10
- package/src/boot/rumPublicApi.js +13 -3
- package/src/boot/startRecording.js +77 -0
- package/src/constants.js +37 -0
- package/src/domain/assembly.js +1 -6
- package/src/domain/configuration.js +10 -2
- package/src/domain/contexts/foregroundContexts.js +140 -0
- package/src/domain/contexts/internalContext.js +10 -4
- package/src/domain/contexts/urlContexts.js +29 -15
- package/src/domain/domMutationCollection.js +14 -6
- package/src/domain/initViewportObservable.js +46 -0
- package/src/domain/locationChangeObservable.js +17 -25
- package/src/domain/performanceCollection.js +42 -42
- package/src/domain/replay/record/elementsScrollPositions.js +22 -0
- package/src/domain/replay/record/index.js +7 -0
- package/src/domain/replay/record/mutationBatch.js +38 -0
- package/src/domain/replay/record/mutationObserver.js +393 -0
- package/src/domain/replay/record/observers.js +562 -0
- package/src/domain/replay/record/privacy.js +304 -0
- package/src/domain/replay/record/record.js +158 -0
- package/src/domain/replay/record/serializationUtils.js +134 -0
- package/src/domain/replay/record/serialize.js +497 -0
- package/src/domain/replay/record/shadowRootsController.js +58 -0
- package/src/domain/replay/record/utils.js +44 -0
- package/src/domain/replay/record/viewports.js +89 -0
- package/src/domain/replay/replayStats.js +67 -0
- package/src/domain/replay/segmentCollection/buildReplayPayload.js +34 -0
- package/src/domain/replay/segmentCollection/deflateWorker.js +4577 -0
- package/src/domain/replay/segmentCollection/index.js +6 -0
- package/src/domain/replay/segmentCollection/segment.js +87 -0
- package/src/domain/replay/segmentCollection/segmentCollection.js +205 -0
- package/src/domain/replay/segmentCollection/startDeflateWorker.js +101 -0
- package/src/domain/requestCollection.js +64 -28
- package/src/domain/rumEventsCollection/actions/actionCollection.js +11 -4
- package/src/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/src/domain/rumEventsCollection/actions/computeFrustration.js +7 -4
- package/src/domain/rumEventsCollection/actions/getActionNameFromElement.js +9 -6
- package/src/domain/rumEventsCollection/actions/getSelectorsFromElement.js +130 -108
- package/src/domain/rumEventsCollection/actions/listenActionEvents.js +26 -27
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +162 -92
- package/src/domain/rumEventsCollection/error/errorCollection.js +11 -5
- package/src/domain/rumEventsCollection/view/trackViewEventCounts.js +38 -0
- package/src/domain/rumEventsCollection/view/trackViewMetrics.js +1 -19
- package/src/domain/rumEventsCollection/view/trackViews.js +98 -68
- package/src/domain/rumEventsCollection/view/viewCollection.js +15 -7
- package/src/domain/rumSessionManager.js +33 -19
- package/src/domain/tracing/getDocumentTraceId.js +6 -9
- package/src/domain/trackEventCounts.js +10 -4
- package/src/domain/waitPageActivityEnd.js +4 -1
- package/src/transport/startRumBatch.js +29 -24
- package/src/types/index.js +1 -0
- package/src/types/sessionReplayConstants.js +49 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { timeStampNow } from '@cloudcare/browser-core';
|
|
2
|
+
import { getViewportDimension } from '../../initViewportObservable';
|
|
3
|
+
import { RecordType, IncrementalSource } from '../../../types';
|
|
4
|
+
import { serializeDocument, SerializationContextStatus } from './serialize';
|
|
5
|
+
import { initObservers } from './observers';
|
|
6
|
+
import { getVisualViewport, getScrollX, getScrollY } from './viewports';
|
|
7
|
+
import { assembleIncrementalSnapshot } from './utils';
|
|
8
|
+
import { createElementsScrollPositions } from './elementsScrollPositions';
|
|
9
|
+
import { initShadowRootsController } from './shadowRootsController';
|
|
10
|
+
export function record(options) {
|
|
11
|
+
var emit = options.emit; // runtime checks for user options
|
|
12
|
+
|
|
13
|
+
if (!emit) {
|
|
14
|
+
throw new Error('emit function is required');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var elementsScrollPositions = createElementsScrollPositions();
|
|
18
|
+
|
|
19
|
+
var mutationCb = function mutationCb(mutation) {
|
|
20
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.Mutation, mutation));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var inputCb = function inputCb(s) {
|
|
24
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.Input, s));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var shadowRootsController = initShadowRootsController(options.configuration, {
|
|
28
|
+
mutationCb,
|
|
29
|
+
inputCb
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var takeFullSnapshot = function takeFullSnapshot(timestamp, serializationContext) {
|
|
33
|
+
if (typeof timestamp === 'undefined') {
|
|
34
|
+
timestamp = timeStampNow();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof serializationContext === 'undefined') {
|
|
38
|
+
serializationContext = {
|
|
39
|
+
status: SerializationContextStatus.INITIAL_FULL_SNAPSHOT,
|
|
40
|
+
elementsScrollPositions: elementsScrollPositions,
|
|
41
|
+
shadowRootsController: shadowRootsController
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var _viewportDimension = getViewportDimension();
|
|
46
|
+
|
|
47
|
+
var width = _viewportDimension.width;
|
|
48
|
+
var height = _viewportDimension.height;
|
|
49
|
+
emit({
|
|
50
|
+
data: {
|
|
51
|
+
height: height,
|
|
52
|
+
href: window.location.href,
|
|
53
|
+
width: width
|
|
54
|
+
},
|
|
55
|
+
type: RecordType.Meta,
|
|
56
|
+
timestamp: timestamp
|
|
57
|
+
});
|
|
58
|
+
emit({
|
|
59
|
+
data: {
|
|
60
|
+
has_focus: document.hasFocus()
|
|
61
|
+
},
|
|
62
|
+
type: RecordType.Focus,
|
|
63
|
+
timestamp: timestamp
|
|
64
|
+
});
|
|
65
|
+
emit({
|
|
66
|
+
data: {
|
|
67
|
+
node: serializeDocument(document, options.configuration, serializationContext),
|
|
68
|
+
initialOffset: {
|
|
69
|
+
left: getScrollX(),
|
|
70
|
+
top: getScrollY()
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
type: RecordType.FullSnapshot,
|
|
74
|
+
timestamp: timestamp
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (window.visualViewport) {
|
|
78
|
+
emit({
|
|
79
|
+
data: getVisualViewport(),
|
|
80
|
+
type: RecordType.VisualViewport,
|
|
81
|
+
timestamp: timestamp
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
takeFullSnapshot();
|
|
87
|
+
|
|
88
|
+
var _initObservers = initObservers({
|
|
89
|
+
lifeCycle: options.lifeCycle,
|
|
90
|
+
configuration: options.configuration,
|
|
91
|
+
elementsScrollPositions: elementsScrollPositions,
|
|
92
|
+
inputCb: inputCb,
|
|
93
|
+
mediaInteractionCb: function mediaInteractionCb(p) {
|
|
94
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.MediaInteraction, p));
|
|
95
|
+
},
|
|
96
|
+
mouseInteractionCb: function mouseInteractionCb(mouseInteractionRecord) {
|
|
97
|
+
emit(mouseInteractionRecord);
|
|
98
|
+
},
|
|
99
|
+
mousemoveCb: function mousemoveCb(positions, source) {
|
|
100
|
+
emit(assembleIncrementalSnapshot(source, {
|
|
101
|
+
positions: positions
|
|
102
|
+
}));
|
|
103
|
+
},
|
|
104
|
+
mutationCb: mutationCb,
|
|
105
|
+
scrollCb: function scrollCb(p) {
|
|
106
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.Scroll, p));
|
|
107
|
+
},
|
|
108
|
+
styleSheetCb: function styleSheetCb(r) {
|
|
109
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.StyleSheetRule, r));
|
|
110
|
+
},
|
|
111
|
+
viewportResizeCb: function viewportResizeCb(d) {
|
|
112
|
+
emit(assembleIncrementalSnapshot(IncrementalSource.ViewportResize, d));
|
|
113
|
+
},
|
|
114
|
+
frustrationCb: function frustrationCb(frustrationRecord) {
|
|
115
|
+
emit(frustrationRecord);
|
|
116
|
+
},
|
|
117
|
+
focusCb: function focusCb(data) {
|
|
118
|
+
emit({
|
|
119
|
+
data: data,
|
|
120
|
+
type: RecordType.Focus,
|
|
121
|
+
timestamp: timeStampNow()
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
visualViewportResizeCb: function visualViewportResizeCb(data) {
|
|
125
|
+
emit({
|
|
126
|
+
data: data,
|
|
127
|
+
type: RecordType.VisualViewport,
|
|
128
|
+
timestamp: timeStampNow()
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
shadowRootsController: shadowRootsController
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
var stopObservers = _initObservers.stop;
|
|
135
|
+
var flushMutationsFromObservers = _initObservers.flush;
|
|
136
|
+
|
|
137
|
+
function flushMutations() {
|
|
138
|
+
shadowRootsController.flush();
|
|
139
|
+
flushMutationsFromObservers();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
stop: function stop() {
|
|
144
|
+
shadowRootsController.stop();
|
|
145
|
+
stopObservers();
|
|
146
|
+
},
|
|
147
|
+
takeSubsequentFullSnapshot: function takeSubsequentFullSnapshot(timestamp) {
|
|
148
|
+
flushMutations();
|
|
149
|
+
takeFullSnapshot(timestamp, {
|
|
150
|
+
shadowRootsController: shadowRootsController,
|
|
151
|
+
status: SerializationContextStatus.SUBSEQUENT_FULL_SNAPSHOT,
|
|
152
|
+
elementsScrollPositions: elementsScrollPositions
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
flushMutations: flushMutations,
|
|
156
|
+
shadowRootsController: shadowRootsController
|
|
157
|
+
};
|
|
158
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getParentNode, isNodeShadowRoot, buildUrl } from '@cloudcare/browser-core';
|
|
2
|
+
import { CENSORED_STRING_MARK } from '../../../constants';
|
|
3
|
+
import { shouldMaskNode } from './privacy';
|
|
4
|
+
var serializedNodeIds = new WeakMap();
|
|
5
|
+
export function hasSerializedNode(node) {
|
|
6
|
+
return serializedNodeIds.has(node);
|
|
7
|
+
}
|
|
8
|
+
export function nodeAndAncestorsHaveSerializedNode(node) {
|
|
9
|
+
var current = node;
|
|
10
|
+
|
|
11
|
+
while (current) {
|
|
12
|
+
if (!hasSerializedNode(current) && !isNodeShadowRoot(current)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
current = getParentNode(current);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
export function getSerializedNodeId(node) {
|
|
22
|
+
return serializedNodeIds.get(node);
|
|
23
|
+
}
|
|
24
|
+
export function setSerializedNodeId(node, serializeNodeId) {
|
|
25
|
+
serializedNodeIds.set(node, serializeNodeId);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the element "value" to be serialized as an attribute or an input update record. It respects
|
|
29
|
+
* the input privacy mode of the element.
|
|
30
|
+
* PERFROMANCE OPTIMIZATION: Assumes that privacy level `HIDDEN` is never encountered because of earlier checks.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export function getElementInputValue(element, nodePrivacyLevel) {
|
|
34
|
+
/*
|
|
35
|
+
BROWSER SPEC NOTE: <input>, <select>
|
|
36
|
+
For some <input> elements, the `value` is an exceptional property/attribute that has the
|
|
37
|
+
value synced between el.value and el.getAttribute()
|
|
38
|
+
input[type=button,checkbox,hidden,image,radio,reset,submit]
|
|
39
|
+
*/
|
|
40
|
+
var tagName = element.tagName;
|
|
41
|
+
var value = element.value;
|
|
42
|
+
|
|
43
|
+
if (shouldMaskNode(element, nodePrivacyLevel)) {
|
|
44
|
+
var type = element.type;
|
|
45
|
+
|
|
46
|
+
if (tagName === 'INPUT' && (type === 'button' || type === 'submit' || type === 'reset')) {
|
|
47
|
+
// Overrule `MASK` privacy level for button-like element values, as they are used during replay
|
|
48
|
+
// to display their label. They can still be hidden via the "hidden" privacy attribute or class name.
|
|
49
|
+
return value;
|
|
50
|
+
} else if (!value || tagName === 'OPTION') {
|
|
51
|
+
// <Option> value provides no benefit
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return CENSORED_STRING_MARK;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (tagName === 'OPTION' || tagName === 'SELECT') {
|
|
59
|
+
return element.value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
export var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
|
|
69
|
+
export var ABSOLUTE_URL = /^[A-Za-z]+:|^\/\//;
|
|
70
|
+
export var DATA_URI = /^data:.*,/i;
|
|
71
|
+
export function switchToAbsoluteUrl(cssText, cssHref) {
|
|
72
|
+
return cssText.replace(URL_IN_CSS_REF, function (matchingSubstring, singleQuote, urlWrappedInSingleQuotes, doubleQuote, urlWrappedInDoubleQuotes, urlNotWrappedInQuotes) {
|
|
73
|
+
var url = urlWrappedInSingleQuotes || urlWrappedInDoubleQuotes || urlNotWrappedInQuotes;
|
|
74
|
+
|
|
75
|
+
if (!cssHref || !url || ABSOLUTE_URL.test(url) || DATA_URI.test(url)) {
|
|
76
|
+
return matchingSubstring;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var quote = singleQuote || doubleQuote || '';
|
|
80
|
+
return "url(".concat(quote).concat(makeUrlAbsolute(url, cssHref)).concat(quote, ")");
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export function makeUrlAbsolute(url, baseUrl) {
|
|
84
|
+
try {
|
|
85
|
+
return buildUrl(url, baseUrl).href;
|
|
86
|
+
} catch (_) {
|
|
87
|
+
return url;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function serializeStyleSheets(cssStyleSheets) {
|
|
91
|
+
if (cssStyleSheets === undefined || cssStyleSheets.length === 0) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return cssStyleSheets.map(function (cssStyleSheet) {
|
|
96
|
+
var rules = cssStyleSheet.cssRules || cssStyleSheet.rules;
|
|
97
|
+
var cssRules = Array.from(rules, function (cssRule) {
|
|
98
|
+
return cssRule.cssText;
|
|
99
|
+
});
|
|
100
|
+
var styleSheet = {
|
|
101
|
+
cssRules: cssRules,
|
|
102
|
+
disabled: cssStyleSheet.disabled || undefined,
|
|
103
|
+
media: cssStyleSheet.media.length > 0 ? Array.from(cssStyleSheet.media) : undefined
|
|
104
|
+
};
|
|
105
|
+
return styleSheet;
|
|
106
|
+
});
|
|
107
|
+
}
|