-
Notifications
You must be signed in to change notification settings - Fork 503
/
dependencies.R
117 lines (114 loc) · 3.5 KB
/
dependencies.R
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# N.B. These are all the dependencies required to define leaflet's htmlwidget
# binding. We've intentionally avoided htmlwidgets' yaml approach to defining
# these since jQuery (in particular) wants to be defined with R code and must be
# provided first. For static rendering, it's sufficient to provide these to
# htmlwidgets::createWidget(dependencies = ...); however, when we dynamically
# render (via renderLeaflet()) the output container (i.e., leafletOutput()) also
# needs these dependencies attached (without them, the output binding won't be
# registered in the time when shiny binds to the DOM). Typically, we don't need
# to do this since htmlwidgets will automatically attach dependencies defined in
# yaml to the output container (which we cannot do anymore).
leafletBindingDependencies <- function() {
list(
jquerylib::jquery_core(3),
htmltools::htmlDependency(
name = "leaflet",
version = "1.3.1",
package = "leaflet",
src = "htmlwidgets/lib/leaflet",
script = "leaflet.js",
stylesheet = "leaflet.css"
),
htmltools::htmlDependency(
name = "leafletfix",
version = "1.0.0",
package = "leaflet",
src = "htmlwidgets/lib/leafletfix",
stylesheet = "leafletfix.css"
),
htmltools::htmlDependency(
name = "proj4",
version = "2.6.2",
package = "leaflet",
src = "htmlwidgets/plugins/Proj4Leaflet",
script = "proj4.min.js",
all_files = FALSE
),
htmltools::htmlDependency(
name = "Proj4Leaflet",
version = "1.0.1",
package = "leaflet",
src = "htmlwidgets/plugins/Proj4Leaflet",
script = "proj4leaflet.js",
all_files = FALSE
),
htmltools::htmlDependency(
name = "rstudio_leaflet",
version = "1.3.1",
package = "leaflet",
src = "htmlwidgets/lib/rstudio_leaflet",
stylesheet = "rstudio_leaflet.css"
),
# Include the rstudio leaflet binding last
# https://github.com/ramnathv/htmlwidgets/blob/7b9c1ea3d9fbf4736d84f1fd1178fce0af29f8e3/R/utils.R#L59-L68
htmltools::htmlDependency(
name = "leaflet-binding",
version = get_package_version("leaflet"),
src = "htmlwidgets/assets",
package = "leaflet",
script = "leaflet.js",
all_files = FALSE
)
)
}
#' Various leaflet dependency functions for use in downstream packages
#' @examples \dontrun{
#' addBootStrap <- function(map) {
#' map$dependencies <- c(map$dependencies, leafletDependencies$bootstrap())
#' map
#' }
#' }
#' @export
leafletDependencies <- list(
markerCluster = function() {
markerClusterDependencies()
},
awesomeMarkers = function() {
leafletAwesomeMarkersDependencies()
},
bootstrap = function() {
leafletAmBootstrapDependencies()
},
fontawesome = function() {
leafletAmFontAwesomeDependencies()
},
ionicon = function() {
leafletAmIonIconDependencies()
},
omnivore = function() {
leafletOmnivoreDependencies()
},
# the ones below are not really expected to be used directly
# but are included for completeness sake.
graticule = function() {
leafletGraticuleDependencies()
},
simpleGraticule = function() {
leafletSimpleGraticuleDependencies()
},
easyButton = function() {
leafletEasyButtonDependencies()
},
measure = function() {
leafletMeasureDependencies()
},
terminator = function() {
leafletTerminatorDependencies()
},
minimap = function() {
leafletMiniMapDependencies()
},
providers = function() {
leafletProviderDependencies()
}
)