-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathstate.js
97 lines (95 loc) · 2.31 KB
/
state.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict'
const hsl = require('hsl-to-rgb-for-reals')
const { colorHash } = require('d3-fg')
module.exports = ({ colors, trees, exclude, merged = false, kernelTracing, title, visualizeCpuProfile }) => ({
trees,
focusedNodeId: null,
key: {
colors: [
colorHash({ top: 0, name: 'cold' }, 1, 100),
colorHash({ top: 1, name: 'luke-warm' }, 1, 100),
colorHash({ top: 3, name: 'warm' }, 1, 100),
colorHash({ top: 10, name: 'hot' }, 1, 100)
],
enableOptUnopt: !merged
},
title: { title },
control: {
tiers: false,
optimized: false,
unoptimized: false,
renderMergedBtn: !kernelTracing,
merged: merged,
visualizeCpuProfile
},
typeFilters: {
visualizeCpuProfile,
enableInlinable: !merged,
renderInlinable: !kernelTracing,
unhighlighted: {
inlinable: '#fff',
app: '#fff',
deps: '#fff',
core: '#fff',
wasm: '#fff',
native: '#fff',
cpp: '#fff',
regexp: '#fff',
v8: '#fff',
init: '#fff'
},
highlighted: {
inlinable: `rgb(${hsl(
colors.inlinable.h,
colors.inlinable.s / 100 * 1.2,
colors.inlinable.l / 100 * 1.2
)})`,
app: `rgb(${hsl(
colors.app.h,
colors.app.s / 100 * 1.2,
colors.app.l / 100 * 1.2
)})`,
deps: `rgb(${hsl(
colors.deps.h,
colors.deps.s / 100 * 1.2,
colors.deps.l / 100 * 1.2
)})`,
core: `rgb(${hsl(
colors.core.h,
colors.core.s / 100 * 1.2,
colors.core.l / 100 * 1.2
)})`,
wasm: `rgb(${hsl(
colors.wasm.h,
colors.wasm.s / 100,
colors.wasm.l / 100
)})`,
native: `rgb(${hsl(
colors.native.h,
colors.native.s / 100 * 1.2,
colors.native.l / 100 * 1.2
)})`,
cpp: `rgb(${hsl(
colors.cpp.h,
colors.cpp.s / 100 * 1.2,
colors.cpp.l / 100 * 1.2
)})`,
regexp: `rgb(${hsl(
colors.regexp.h,
colors.regexp.s / 100 * 1.2,
colors.regexp.l / 100 * 1.2
)})`,
v8: `rgb(${hsl(
colors.v8.h,
colors.v8.s / 100 * 1.2,
colors.v8.l / 100 * 1.2
)})`,
init: `rgb(${hsl(
colors.init.h,
colors.init.s / 100 * 1.2,
colors.init.l / 100 * 1.2
)})`
},
exclude
}
})