Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shiny type update #1054

Merged
merged 6 commits into from
Jul 26, 2024
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
29 changes: 15 additions & 14 deletions inst/components/dist/components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions inst/components/dist/components.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/components/dist/components.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/components/dist/components.min.js.map

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions inst/components/dist/web-components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions inst/components/dist/web-components.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions inst/components/dist/web-components.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/components/dist/web-components.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion srcts/src/components/_shinyAddCustomMessageHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export function shinyAddCustomMessageHandlers(handlers: {
}

for (const [name, handler] of Object.entries(handlers)) {
Shiny.addCustomMessageHandler(name, handler);
window.Shiny.addCustomMessageHandler(name, handler);
}
}
8 changes: 5 additions & 3 deletions srcts/src/components/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import type { HtmlDep } from "rstudio-shiny/srcts/types/src/shiny/render";

import type { InputBinding as InputBindingType } from "rstudio-shiny/srcts/types/src/bindings/input";

import type { ShinyClass } from "rstudio-shiny/srcts/types/src";

// eslint-disable-next-line @typescript-eslint/naming-convention
const Shiny: typeof window.Shiny | undefined = window.Shiny;
const Shiny: ShinyClass | undefined = window.Shiny;

// Exclude undefined from T
type NotUndefined<T> = T extends undefined ? never : T;
Expand Down Expand Up @@ -87,8 +89,8 @@ function getAllFocusableChildren(el: HTMLElement): HTMLElement[] {
}

async function shinyRenderContent(
...args: Parameters<Shiny["renderContentAsync"]>
): ReturnType<Shiny["renderContentAsync"]> {
...args: Parameters<ShinyClass["renderContentAsync"]>
): Promise<void> {
if (!Shiny) {
throw new Error("This function must be called in a Shiny app.");
}
Expand Down
2 changes: 1 addition & 1 deletion srcts/src/components/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class AccordionInputBinding extends InputBinding {
(x) => data.target.indexOf(x.value) > -1
);

const unbindAll = Shiny?.unbindAll;
const unbindAll = window.Shiny?.unbindAll;

targetItems.forEach((x) => {
if (unbindAll) unbindAll(x.item);
Expand Down
7 changes: 5 additions & 2 deletions srcts/src/components/webcomponents/_makeInputBinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function makeInputBinding<T>(
return;
}

class NewCustomBinding extends Shiny["InputBinding"] {
class NewCustomBinding extends window.Shiny["InputBinding"] {
constructor() {
super();
}
Expand Down Expand Up @@ -70,5 +70,8 @@ export function makeInputBinding<T>(
}
}

Shiny.inputBindings.register(new NewCustomBinding(), `${tagName}-Binding`);
window.Shiny.inputBindings.register(
new NewCustomBinding(),
`${tagName}-Binding`
);
}
2 changes: 1 addition & 1 deletion srcts/src/components/webcomponents/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class BslibPopover extends BslibElement {
const deps = [];
if (content) deps.push(...content.deps);
if (header) deps.push(...header.deps);
Shiny.renderDependencies(deps);
window.Shiny.renderDependencies(deps);

const { tip } = this.bsPopover;

Expand Down
2 changes: 1 addition & 1 deletion srcts/src/components/webcomponents/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class BslibTooltip extends BslibElement {
private _updateTitle(title: UpdateMessage["title"]): void {
if (!title) return;

Shiny.renderDependencies(title.deps);
window.Shiny.renderDependencies(title.deps);
setContentCarefully({
instance: this.bsTooltip,
trigger: this.triggerElement,
Expand Down
42 changes: 40 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,25 @@
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9"
integrity sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ==

"@lit-labs/ssr-dom-shim@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz#353ce4a76c83fadec272ea5674ede767650762fd"
integrity sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==

"@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.6.0":
version "1.6.2"
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.6.2.tgz#c256690f82f2d7d0ffb0b1cdf68dcb1ec86cea28"
integrity sha512-rDfl+QnCYjuIGf5xI2sVJWdYIi56CTCwWa+nidKYX6oIuBYwUbT/vX4qbUDlHiZKJ/3FRNQ/tWJui44p6/stSA==
dependencies:
"@lit-labs/ssr-dom-shim" "^1.0.0"

"@lit/reactive-element@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.4.tgz#8f2ed950a848016383894a26180ff06c56ae001b"
integrity sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==
dependencies:
"@lit-labs/ssr-dom-shim" "^1.2.0"

"@nodelib/[email protected]":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down Expand Up @@ -313,15 +325,16 @@
integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==

"@types/rstudio-shiny@https://github.com/rstudio/shiny#main":
version "1.7.5-alpha.9001"
resolved "https://github.com/rstudio/shiny#56878ebbaa92e1abf7136c8da8795fa71aa20a79"
version "1.8.1-alpha.9001"
resolved "https://github.com/rstudio/shiny#15b5fa6c01197a1c9fca33ff103eeb7250ffa870"
dependencies:
"@types/bootstrap" "3.4.0"
"@types/bootstrap-datepicker" "0.0.14"
"@types/datatables.net" "^1.10.19"
"@types/ion-rangeslider" "2.3.0"
"@types/jquery" "3.5.14"
"@types/selectize" "0.12.34"
lit "^3.0.0"

"@types/[email protected]":
version "0.12.34"
Expand Down Expand Up @@ -1110,13 +1123,29 @@ lit-element@^3.3.0:
"@lit/reactive-element" "^1.3.0"
lit-html "^2.7.0"

lit-element@^4.0.4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-4.0.5.tgz#f20cd8a6231eaf5358f7a6877ca6ea7628fa2015"
integrity sha512-iTWskWZEtn9SyEf4aBG6rKT8GABZMrTWop1+jopsEOgEcugcXJGKuX5bEbkq9qfzY+XB4MAgCaSPwnNpdsNQ3Q==
dependencies:
"@lit-labs/ssr-dom-shim" "^1.2.0"
"@lit/reactive-element" "^2.0.4"
lit-html "^3.1.2"

lit-html@^2.7.0:
version "2.7.5"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.7.5.tgz#0c1b9d381abe20c01475ae53ea4b07bf4c923eb8"
integrity sha512-YqUzpisJodwKIlbMFCtyrp58oLloKGnnPLMJ1t23cbfIJjg/H9pvLWK4XS69YeubK5HUs1UE4ys9w5dP1zg6IA==
dependencies:
"@types/trusted-types" "^2.0.2"

lit-html@^3.1.2:
version "3.1.3"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-3.1.3.tgz#ae2e9fee0258d0a1b5d7b86c87da51117e4f911b"
integrity sha512-FwIbqDD8O/8lM4vUZ4KvQZjPPNx7V1VhT7vmRB8RBAO0AU6wuTVdoXiu2CivVjEGdugvcbPNBLtPE1y0ifplHA==
dependencies:
"@types/trusted-types" "^2.0.2"

lit@^2.7.5:
version "2.7.6"
resolved "https://registry.yarnpkg.com/lit/-/lit-2.7.6.tgz#810007b876ed43e0c70124de91831921598b1665"
Expand All @@ -1126,6 +1155,15 @@ lit@^2.7.5:
lit-element "^3.3.0"
lit-html "^2.7.0"

lit@^3.0.0:
version "3.1.3"
resolved "https://registry.yarnpkg.com/lit/-/lit-3.1.3.tgz#809ecdaccfea47e1e3b46649fae6c6e7b9802675"
integrity sha512-l4slfspEsnCcHVRTvaP7YnkTZEZggNFywLEIhQaGhYDczG+tu/vlgm/KaWIEjIp+ZyV20r2JnZctMb8LeLCG7Q==
dependencies:
"@lit/reactive-element" "^2.0.4"
lit-element "^4.0.4"
lit-html "^3.1.2"

locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
Expand Down