Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Improvements and bug fixes

* `input_code_editor()` now supports `language = "ggsql"` for syntax highlighting of ggsql queries. (#1291)

* Improved the sidebar resize handle to avoid conflicts with the sidebar's native scrollbar and to better support touch devices. (#1299)

* `sidebar()` gains a `resizable` argument (default `TRUE`) to control whether the sidebar can be resized by dragging its edge on desktop (wide screen sizes). (#1299)
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion R/versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version_bs4 <- "4.6.0"
version_bs3 <- "3.4.1"
version_accessibility <- "1.0.6"
version_prism_code_editor <- "4.2.0"
code_editor_bundled_languages <- c("r", "python", "julia", "sql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff")
code_editor_bundled_languages <- c("r", "python", "julia", "sql", "ggsql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff")
85 changes: 85 additions & 0 deletions inst/lib/prism-code-editor/prism/languages/ggsql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// ggsql.js — ggsql language for prism-code-editor
//
// AUTO-GENERATED by tools/build_ggsql_grammar.R from the TextMate grammar at:
// https://github.com/posit-dev/ggsql/blob/main/ggsql-vscode/syntaxes/ggsql.tmLanguage.json
// Do not edit by hand.
//
// NOTE: The import path below is a content-hashed internal module of
// prism-code-editor. If bslib updates prism-code-editor, this hash may change.
// Re-run this script to regenerate.

import "./sql.js";
import { l as languages } from "../../index-C1_GGQ8y.js";

var sql = languages.sql;
var ggsql = {};

// Copy SQL tokens
Object.keys(sql).forEach(function(k) { ggsql[k] = sql[k]; });

// ggsql clause keywords
ggsql["ggsql-keyword"] = {
pattern: /\b(?:VISUALISE|VISUALIZE|DRAW|PLACE|SCALE|FACET|PROJECT|LABEL|MAPPING|REMAPPING|SETTING|FILTER|FROM|ORDER|BY|PARTITION|RENAMING|AS|TO|VIA)\b/i,
alias: "keyword",
};

// Geom types
ggsql["ggsql-geom"] = {
pattern: /\b(?:point|line|path|bar|col|area|tile|polygon|ribbon|histogram|density|smooth|boxplot|violin|text|label|segment|arrow|rule|errorbar|rect)\b/,
alias: "builtin",
};

// Scale type modifiers
ggsql["ggsql-scale-type"] = {
pattern: /\b(?:CONTINUOUS|DISCRETE|BINNED|ORDINAL|IDENTITY)\b/i,
alias: "builtin",
};

// Scale type values
ggsql["ggsql-scale-value"] = {
pattern: /\b(?:linear|log|log10|log2|sqrt|reverse|date|datetime|time|viridis|plasma|magma|inferno|cividis|diverging|sequential|identity)\b/,
alias: "string",
};

// Aesthetic names
ggsql["ggsql-aesthetic"] = {
pattern: /\b(?:x|y|xmin|xmax|ymin|ymax|xend|yend|theta|radius|thetamin|thetamax|radiusmin|radiusmax|thetaend|radiusend|color|colour|fill|stroke|opacity|size|shape|linetype|linewidth|width|height|label|family|fontface|hjust|vjust|weight|coef|intercept|offset|density|count|intensity|panel|row|column)\b/,
alias: "attr-name",
};

// Property names
ggsql["ggsql-property"] = {
pattern: /\b(?:type|limits|breaks|labels|expand|direction|na_value|palette|domain|range|free|ncol|missing|xlim|ylim|ratio|angle|clip|start|title|subtitle|x|y|caption|tag|color|colour|fill|size|shape|linetype)\b/,
alias: "property",
};

// Project types
ggsql["ggsql-project"] = {
pattern: /\b(?:cartesian|polar)\b/,
alias: "class-name",
};

// Fat arrow operator
ggsql["ggsql-arrow"] = {
pattern: /=>/,
alias: "operator",
};

// SQL functions (aggregate, window, datetime, string, math, conversion, conditional, JSON, list)
ggsql["function"] = /\b(?:count|sum|avg|min|max|stddev|variance|array_agg|string_agg|group_concat|row_number|rank|dense_rank|ntile|lag|lead|first_value|last_value|nth_value|cume_dist|percent_rank|date_trunc|date_part|datepart|datename|dateadd|datediff|extract|now|current_date|current_time|current_timestamp|getdate|getutcdate|strftime|strptime|make_date|make_time|make_timestamp|concat|substring|substr|left|right|length|len|char_length|lower|upper|trim|ltrim|rtrim|replace|reverse|repeat|lpad|rpad|split_part|string_split|format|printf|regexp_replace|regexp_extract|regexp_matches|abs|ceil|ceiling|floor|round|trunc|truncate|mod|power|sqrt|exp|ln|log|log10|log2|sign|sin|cos|tan|asin|acos|atan|atan2|pi|degrees|radians|random|rand|cast|convert|coalesce|nullif|ifnull|isnull|nvl|try_cast|typeof|if|iff|iif|greatest|least|decode|json|json_extract|json_extract_path|json_extract_string|json_value|json_query|json_object|json_array|json_array_length|to_json|from_json|list|list_value|list_aggregate|array_length|unnest|generate_series|range)(?=\s*\()/i;

// Reorder: ggsql tokens before generic SQL keyword/boolean
var ordered = {};
["comment", "variable", "string", "identifier"].forEach(function(k) {
if (k in ggsql) ordered[k] = ggsql[k];
});
["ggsql-keyword", "ggsql-geom", "ggsql-scale-type", "ggsql-scale-value",
"ggsql-aesthetic", "ggsql-property", "ggsql-project", "ggsql-arrow"].forEach(function(k) {
if (k in ggsql) ordered[k] = ggsql[k];
});
Object.keys(ggsql).forEach(function(k) {
if (!(k in ordered)) ordered[k] = ggsql[k];
});

languages.ggsql = ordered;

Binary file modified man/figures/navset-card-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-card-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/page-navbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-background-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-background-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-gradient-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-named-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-named-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-left-center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-showcase-top-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-text-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-text-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/value-box-theme-class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/input-code-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
input_code_editor("test", language = "fortran")
Condition
Error in `input_code_editor()`:
! `language` must be one of "r", "python", "julia", "sql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".
! `language` must be one of "r", "python", "julia", "sql", "ggsql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".

# input_code_editor validates theme names

Expand All @@ -33,15 +33,15 @@
input_code_editor("test", language = "fortran")
Condition
Error in `input_code_editor()`:
! `language` must be one of "r", "python", "julia", "sql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".
! `language` must be one of "r", "python", "julia", "sql", "ggsql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".

# update_code_editor validates inputs

Code
update_code_editor("test", language = "fortran", session = NULL)
Condition
Error in `update_code_editor()`:
! `language` must be one of "r", "python", "julia", "sql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".
! `language` must be one of "r", "python", "julia", "sql", "ggsql", "javascript", "typescript", "markup", "css", "scss", "sass", "json", "markdown", "yaml", "xml", "toml", "ini", "bash", "docker", "latex", "cpp", "rust", "diff", "md", "html", "plain", "plaintext", "text", or "txt", not "fortran".

---

Expand Down
Loading