@brianmsm/quarto-bento 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +93 -2
- package/bin/qbento-npm.mjs +62 -0
- package/distribution/LICENSE +21 -0
- package/distribution/PACKAGING.md +59 -0
- package/distribution/bin/qbento +5 -0
- package/distribution/bin/qbento.cmd +4 -0
- package/distribution/manifest.json +720 -0
- package/distribution/runtime/LICENSE +21 -0
- package/distribution/runtime/_extensions/qbento/_extension.yml +24 -0
- package/distribution/runtime/_extensions/qbento/capture.lua +21 -0
- package/distribution/runtime/_extensions/qbento/guard.lua +7 -0
- package/distribution/runtime/_extensions/qbento/post.ts +2 -0
- package/distribution/runtime/_extensions/qbento/pre.ts +2 -0
- package/distribution/runtime/_extensions/qbento/producer-activation.js +129 -0
- package/distribution/runtime/src/bridge/browser.js +168 -0
- package/distribution/runtime/src/bridge/isolation.ts +55 -0
- package/distribution/runtime/src/browser/chromium.ts +218 -0
- package/distribution/runtime/src/cli.ts +232 -0
- package/distribution/runtime/src/core/agent.ts +546 -0
- package/distribution/runtime/src/core/annotations.ts +384 -0
- package/distribution/runtime/src/core/capture.ts +203 -0
- package/distribution/runtime/src/core/component-actions.ts +550 -0
- package/distribution/runtime/src/core/component-frames.ts +59 -0
- package/distribution/runtime/src/core/component-sync.ts +290 -0
- package/distribution/runtime/src/core/design-diagnostics.ts +78 -0
- package/distribution/runtime/src/core/design-registry.ts +287 -0
- package/distribution/runtime/src/core/graph-relations.ts +354 -0
- package/distribution/runtime/src/core/graph-scope.ts +63 -0
- package/distribution/runtime/src/core/graph-sync.ts +228 -0
- package/distribution/runtime/src/core/io.ts +27 -0
- package/distribution/runtime/src/core/kpi-appearance.ts +205 -0
- package/distribution/runtime/src/core/layouts.ts +245 -0
- package/distribution/runtime/src/core/project.ts +851 -0
- package/distribution/runtime/src/core/reconcile.ts +384 -0
- package/distribution/runtime/src/core/recovery.ts +1255 -0
- package/distribution/runtime/src/core/slide-actions.ts +158 -0
- package/distribution/runtime/src/core/source-scope.ts +50 -0
- package/distribution/runtime/src/core/sync.ts +2557 -0
- package/distribution/runtime/src/core/widgets.ts +300 -0
- package/distribution/runtime/src/integration/install.ts +98 -0
- package/distribution/runtime/src/integration/invocation.ts +100 -0
- package/distribution/runtime/src/integration/quarto.ts +457 -0
- package/distribution/runtime/src/render/assets.ts +66 -0
- package/distribution/runtime/src/render/capture.lua +8 -0
- package/distribution/runtime/src/render/chart.ts +165 -0
- package/distribution/runtime/src/render/components.ts +199 -0
- package/distribution/runtime/src/render/design.ts +820 -0
- package/distribution/runtime/src/render/diagnostics.ts +36 -0
- package/distribution/runtime/src/render/graphs.ts +747 -0
- package/distribution/runtime/src/render/html.ts +82 -0
- package/distribution/runtime/src/render/images.ts +268 -0
- package/distribution/runtime/src/render/inline.ts +259 -0
- package/distribution/runtime/src/render/kpi.ts +385 -0
- package/distribution/runtime/src/render/lists.ts +183 -0
- package/distribution/runtime/src/render/math.ts +413 -0
- package/distribution/runtime/src/render/measure.ts +185 -0
- package/distribution/runtime/src/render/native-layout.ts +174 -0
- package/distribution/runtime/src/render/producer-capture.ts +319 -0
- package/distribution/runtime/src/render/producer-environment.R +49 -0
- package/distribution/runtime/src/render/producer-environment.ts +96 -0
- package/distribution/runtime/src/render/producer-profile.R +91 -0
- package/distribution/runtime/src/render/producer-site-profile.R +18 -0
- package/distribution/runtime/src/render/project.ts +1806 -0
- package/distribution/runtime/src/render/quarto.ts +127 -0
- package/distribution/runtime/src/render/registry.ts +233 -0
- package/distribution/runtime/src/render/resources.ts +292 -0
- package/distribution/runtime/src/render/shell.ts +110 -0
- package/distribution/runtime/src/render/source-inline.ts +169 -0
- package/distribution/runtime/src/render/table.ts +220 -0
- package/distribution/runtime/src/render/text-overflow.ts +208 -0
- package/distribution/runtime/src/render/types.ts +71 -0
- package/distribution/runtime/src/render/validate.ts +572 -0
- package/distribution/runtime/src/rich/project.ts +117 -0
- package/distribution/runtime/src/rich/table.ts +374 -0
- package/distribution/runtime/src/source/annotations.ts +490 -0
- package/distribution/runtime/src/source/attributes.ts +415 -0
- package/distribution/runtime/src/source/chart.ts +165 -0
- package/distribution/runtime/src/source/code-language.ts +277 -0
- package/distribution/runtime/src/source/component-insertion.ts +160 -0
- package/distribution/runtime/src/source/deletion.ts +278 -0
- package/distribution/runtime/src/source/graphs.ts +517 -0
- package/distribution/runtime/src/source/identities.ts +256 -0
- package/distribution/runtime/src/source/identity-id.ts +6 -0
- package/distribution/runtime/src/source/image.ts +50 -0
- package/distribution/runtime/src/source/kpi.ts +196 -0
- package/distribution/runtime/src/source/mod.ts +876 -0
- package/distribution/runtime/src/source/notes.ts +308 -0
- package/distribution/runtime/src/source/structure.ts +647 -0
- package/distribution/runtime/src/source/table.ts +290 -0
- package/distribution/runtime/src/source/text-conversion.ts +146 -0
- package/distribution/runtime/src/state/components.ts +281 -0
- package/distribution/runtime/src/state/graphs.ts +200 -0
- package/distribution/runtime/src/state/json.ts +162 -0
- package/distribution/runtime/src/state/merge.ts +1034 -0
- package/distribution/runtime/src/state/mod.ts +5 -0
- package/distribution/runtime/src/state/store.ts +226 -0
- package/distribution/runtime/src/state/types.ts +151 -0
- package/distribution/runtime/src/studio/client.js +892 -0
- package/distribution/runtime/src/studio/components.js +188 -0
- package/distribution/runtime/src/studio/index.html +283 -0
- package/distribution/runtime/src/studio/layouts.js +170 -0
- package/distribution/runtime/src/studio/registry.js +283 -0
- package/distribution/runtime/src/studio/relations.js +169 -0
- package/distribution/runtime/src/studio/server.ts +461 -0
- package/distribution/runtime/src/widgets/deck.ts +39 -0
- package/distribution/runtime/src/widgets/plotly.ts +354 -0
- package/distribution/runtime/src/widgets/presenter.ts +367 -0
- package/distribution/runtime/src/widgets/snapshot.ts +116 -0
- package/distribution/runtime/vendor/bento/FONT_NOTICES.md +49 -0
- package/distribution/runtime/vendor/bento/LICENSE +21 -0
- package/distribution/runtime/vendor/bento/THIRD_PARTY_NOTICES.md +51 -0
- package/distribution/runtime/vendor/bento/font-licenses/fraunces-OFL.txt +93 -0
- package/distribution/runtime/vendor/bento/font-licenses/instrument-sans-OFL.txt +93 -0
- package/distribution/runtime/vendor/bento/pin.json +69 -0
- package/distribution/runtime/vendor/bento/provenance/slides.package-lock.json +1928 -0
- package/distribution/runtime/vendor/bento/provenance/slides.package.json +28 -0
- package/distribution/runtime/vendor/bento/runtime-dependencies.json +244 -0
- package/distribution/runtime/vendor/bento/runtime-licenses.json +4038 -0
- package/distribution/runtime/vendor/bento/shell.html +269 -0
- package/distribution/runtime/vendor/bento/slides.schema.json +2379 -0
- package/package.json +40 -4
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Per-process compatibility adapter; the original QMD and knitr options are intact.
|
|
2
|
+
local({
|
|
3
|
+
profile_set <- Sys.getenv('QBENTO_ORIGINAL_R_PROFILE_SET') == '1'
|
|
4
|
+
profile_value <- Sys.getenv('QBENTO_ORIGINAL_R_PROFILE_USER')
|
|
5
|
+
if (profile_set) Sys.setenv(R_PROFILE_USER=profile_value) else Sys.unsetenv('R_PROFILE_USER')
|
|
6
|
+
selected <- if (profile_set) profile_value else {
|
|
7
|
+
local_profile <- file.path(getwd(), '.Rprofile')
|
|
8
|
+
if (file.exists(local_profile)) local_profile else file.path(path.expand('~'), '.Rprofile')
|
|
9
|
+
}
|
|
10
|
+
if (nzchar(selected) && file.exists(selected)) sys.source(selected, envir=.GlobalEnv)
|
|
11
|
+
|
|
12
|
+
manifest <- jsonlite::fromJSON(Sys.getenv('QBENTO_PRODUCER_MANIFEST'), simplifyVector=FALSE)
|
|
13
|
+
ns <- asNamespace('knitr')
|
|
14
|
+
original <- get('call_block',ns)
|
|
15
|
+
if (!identical(names(formals(original)), 'block')) stop('UNSUPPORTED_KNITR_PRODUCER_ADAPTER: expected call_block(block)')
|
|
16
|
+
active <- FALSE
|
|
17
|
+
expected_input <- NULL
|
|
18
|
+
expected_dir <- NULL
|
|
19
|
+
resolve_expected_input <- function() {
|
|
20
|
+
if (!is.null(expected_input)) return(invisible(NULL))
|
|
21
|
+
if (!('rmarkdown' %in% loadedNamespaces())) {
|
|
22
|
+
stop('UNSUPPORTED_RMARKDOWN_PATH_ADAPTER: the rmarkdown namespace is not loaded while knitting; Quarto must load its render engine before producer chunks run')
|
|
23
|
+
}
|
|
24
|
+
rmarkdown_ns <- asNamespace('rmarkdown')
|
|
25
|
+
file_name_without_shell_chars <- get0(
|
|
26
|
+
'file_name_without_shell_chars',
|
|
27
|
+
envir=rmarkdown_ns,
|
|
28
|
+
inherits=FALSE,
|
|
29
|
+
ifnotfound=NULL
|
|
30
|
+
)
|
|
31
|
+
if (!is.function(file_name_without_shell_chars) ||
|
|
32
|
+
!identical(names(formals(file_name_without_shell_chars)), 'file')) {
|
|
33
|
+
stop('UNSUPPORTED_RMARKDOWN_PATH_ADAPTER: this rmarkdown version does not expose the expected file_name_without_shell_chars(file) mapping; verify the installed Quarto/rmarkdown integration before rendering')
|
|
34
|
+
}
|
|
35
|
+
mapped_input <- tryCatch(
|
|
36
|
+
file_name_without_shell_chars(manifest$input),
|
|
37
|
+
error=function(error) error
|
|
38
|
+
)
|
|
39
|
+
if (inherits(mapped_input, 'error') || !is.character(mapped_input) ||
|
|
40
|
+
length(mapped_input)!=1L || is.na(mapped_input) || !nzchar(mapped_input) ||
|
|
41
|
+
!identical(dirname(mapped_input), dirname(manifest$input))) {
|
|
42
|
+
stop('UNSUPPORTED_RMARKDOWN_PATH_ADAPTER: rmarkdown did not map the original input to one filename in its original directory; verify the installed Quarto/rmarkdown integration before rendering')
|
|
43
|
+
}
|
|
44
|
+
expected_input <<- tryCatch(
|
|
45
|
+
normalizePath(mapped_input, mustWork=TRUE),
|
|
46
|
+
error=function(error) NULL
|
|
47
|
+
)
|
|
48
|
+
expected_dir <<- tryCatch(
|
|
49
|
+
normalizePath(dirname(manifest$input), mustWork=TRUE),
|
|
50
|
+
error=function(error) NULL
|
|
51
|
+
)
|
|
52
|
+
if (is.null(expected_input) || is.null(expected_dir)) {
|
|
53
|
+
expected_input <<- NULL
|
|
54
|
+
expected_dir <<- NULL
|
|
55
|
+
stop('UNSUPPORTED_RMARKDOWN_PATH_ADAPTER: the normalized input or original directory is unavailable; verify Quarto input staging before rendering')
|
|
56
|
+
}
|
|
57
|
+
invisible(NULL)
|
|
58
|
+
}
|
|
59
|
+
adapter <- function(block) {
|
|
60
|
+
input <- knitr::current_input(dir=TRUE)
|
|
61
|
+
resolve_expected_input()
|
|
62
|
+
resolved_input <- if (is.character(input) && length(input)==1L &&
|
|
63
|
+
!is.na(input) && nzchar(input)) {
|
|
64
|
+
tryCatch(normalizePath(input, mustWork=TRUE), error=function(error) NULL)
|
|
65
|
+
} else NULL
|
|
66
|
+
if (active || is.null(resolved_input) ||
|
|
67
|
+
!identical(dirname(resolved_input), expected_dir) ||
|
|
68
|
+
!identical(resolved_input, expected_input)) {
|
|
69
|
+
stop("UNMAPPED_PRODUCER_RECEIPT: nested or foreign knit input needs an explicit execution adapter")
|
|
70
|
+
}
|
|
71
|
+
active <<- TRUE
|
|
72
|
+
on.exit(active <<- FALSE)
|
|
73
|
+
label <- block$params$label
|
|
74
|
+
candidates <- Filter(function(chunk) identical(chunk$label,label),manifest$chunks)
|
|
75
|
+
if (length(candidates)!=1L) stop('UNMAPPED_PRODUCER_RECEIPT: original parsed chunk has no unique source identity')
|
|
76
|
+
chunk <- candidates[[1L]]
|
|
77
|
+
code <- paste(as.character(knitr::knit_code$get(label)),collapse='\n')
|
|
78
|
+
if (!identical(chunk$code,code)) stop('UNMAPPED_PRODUCER_RECEIPT: parsed chunk body differs from original source')
|
|
79
|
+
output <- original(block)
|
|
80
|
+
if (!is.character(output) || length(output)!=1L) stop('INVALID_PRODUCER_OUTPUT: expected one Markdown result')
|
|
81
|
+
if (!nzchar(output)) return(output)
|
|
82
|
+
runs <- regmatches(output,gregexpr('(?m)^:{3,}',output,perl=TRUE))[[1L]]
|
|
83
|
+
fence <- paste(rep(':',max(c(3L,nchar(runs)))+1L),collapse='')
|
|
84
|
+
token <- paste(manifest$nonce,chunk$index,sep=':')
|
|
85
|
+
cat(jsonlite::toJSON(token,auto_unbox=TRUE),'\n',file=manifest$outputReceiptPath,append=TRUE)
|
|
86
|
+
paste0('\n',fence,' {.qbento-execution qbento-producer-proof="',token,'"}\n\n',output,'\n',fence,'\n')
|
|
87
|
+
}
|
|
88
|
+
unlockBinding('call_block',ns)
|
|
89
|
+
assign('call_block',adapter,ns)
|
|
90
|
+
lockBinding('call_block',ns)
|
|
91
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Chain the original site profile before selecting the user profile. A site
|
|
2
|
+
# profile may itself change R_PROFILE_USER; that selection must remain effective.
|
|
3
|
+
local({
|
|
4
|
+
site_set <- Sys.getenv('QBENTO_ORIGINAL_R_SITE_SET') == '1'
|
|
5
|
+
site_value <- Sys.getenv('QBENTO_ORIGINAL_R_SITE')
|
|
6
|
+
if (site_set) Sys.setenv(R_PROFILE=site_value) else Sys.unsetenv('R_PROFILE')
|
|
7
|
+
user_set <- Sys.getenv('QBENTO_ORIGINAL_R_PROFILE_SET') == '1'
|
|
8
|
+
user_value <- Sys.getenv('QBENTO_ORIGINAL_R_PROFILE_USER')
|
|
9
|
+
if (user_set) Sys.setenv(R_PROFILE_USER=user_value) else Sys.unsetenv('R_PROFILE_USER')
|
|
10
|
+
selected <- if (site_set) site_value else file.path(R.home('etc'), 'Rprofile.site')
|
|
11
|
+
if (nzchar(selected) && file.exists(selected)) sys.source(selected, envir=.GlobalEnv)
|
|
12
|
+
effective <- Sys.getenv('R_PROFILE_USER', unset=NA_character_)
|
|
13
|
+
Sys.setenv(
|
|
14
|
+
QBENTO_ORIGINAL_R_PROFILE_SET=if (is.na(effective)) '0' else '1',
|
|
15
|
+
QBENTO_ORIGINAL_R_PROFILE_USER=if (is.na(effective)) '' else effective,
|
|
16
|
+
R_PROFILE_USER=Sys.getenv('QBENTO_PRODUCER_PROFILE')
|
|
17
|
+
)
|
|
18
|
+
})
|