Skip to content

Commit

Permalink
Type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed May 30, 2024
1 parent 75ebe81 commit ad317e5
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
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);
}
}
2 changes: 1 addition & 1 deletion srcts/src/components/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function getAllFocusableChildren(el: HTMLElement): HTMLElement[] {
}

async function shinyRenderContent(
...args: Parameters<ShinyClass.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
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@

"@types/rstudio-shiny@https://github.com/rstudio/shiny#init-promise":
version "1.8.1-alpha.9001"
resolved "https://github.com/rstudio/shiny#83d9cae6cc45a86489f2d2d068e65a443ba57d53"
resolved "https://github.com/rstudio/shiny#9c7937b3dfe85f4108d17d6a3220151ba467f924"
dependencies:
"@types/bootstrap" "3.4.0"
"@types/bootstrap-datepicker" "0.0.14"
Expand Down

0 comments on commit ad317e5

Please sign in to comment.