Export TypeScript type definitions to local folder (#3418)

This commit is contained in:
Barret Schloerke
2021-06-14 14:25:05 -04:00
committed by GitHub
parent 1dd256b210
commit 3fe8c27d21
85 changed files with 1332 additions and 79 deletions

View File

@@ -129,12 +129,16 @@ jobs:
tree src
yarn install --immutable && yarn build
git add ./src && git commit -m 'yarn lint (GitHub Actions)' || echo "No yarn lint changes to commit"
git add ./src_d && git commit -m 'yarn tsc (GitHub Actions)' || echo "No type definition changes to commit"
git add ../inst && git commit -m 'yarn build (GitHub Actions)' || echo "No yarn build changes to commit"
- name: Check JS build is latest
run: |
./tools/checkJSCurrent.sh
if [ -n "$(git status --porcelain)" ]
then
git status --porcelain
>&2 echo "The above files changed when we built the JavaScript assets."
exit 1
else
echo "No difference detected; TypeScript build is current."
fi
- name: Git Push (PR)
uses: r-lib/actions/pr-push@master

View File

@@ -1,6 +1,9 @@
{
"name": "@types/shiny",
"private": true,
"main": "src/index.ts",
"version": "1.6.0",
"main": "",
"types": "src_d/shiny/index.d.ts",
"engines": {
"node": ">= 14",
"yarn": ">= 1.22"
@@ -64,7 +67,7 @@
"test": "jest --coverage",
"test_phantom": "echo '\n\t!! Must manually stop phantomjs test !!\n\n' && yarn bundle_shiny && phantomjs --debug=yes ../inst/www/shared/shiny.js",
"lint": "eslint --fix --ext .ts src",
"typescript-check": "tsc -p tsconfig.json --noEmit",
"typescript-check": "tsc -p tsconfig.json",
"type-check": "type-coverage -p tsconfig.json --detail --at-least 85",
"import-check": "madge --circular --extensions ts src",
"checks": "yarn run lint && yarn run typescript-check && yarn run type-check && yarn run import-check"

3
srcts/src_d/bindings/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { InputBinding } from "./input";
import { OutputBinding } from "./output";
export { InputBinding, OutputBinding };

View File

@@ -0,0 +1,33 @@
import { RatePolicyModes } from "../../inputPolicies/inputRateDecorator";
import { bindScope } from "../../shiny/bind";
import type { NumberReceiveMessageData } from "./number";
import type { RadioReceiveMessageData } from "./radio";
import type { SelectInputReceiveMessageData } from "./selectInput";
import type { SliderReceiveMessageData } from "./slider";
import type { TabInputReceiveMessageData } from "./tabinput";
import type { TextReceiveMessageData } from "./text";
import type { ActionButtonReceiveMessageData } from "./actionbutton";
import type { CheckboxGroupReceiveMessageData } from "./checkboxgroup";
import type { DateReceiveMessageData } from "./date";
import type { CheckboxReceiveMessageData } from "./checkbox";
import type { DateRangeReceiveMessageData } from "./daterange";
declare type receiveMessageDataType = NumberReceiveMessageData | RadioReceiveMessageData | SelectInputReceiveMessageData | SliderReceiveMessageData | TabInputReceiveMessageData | TextReceiveMessageData | ActionButtonReceiveMessageData | CheckboxReceiveMessageData | CheckboxGroupReceiveMessageData | DateReceiveMessageData | DateRangeReceiveMessageData;
declare class InputBinding {
name: string;
find(scope: bindScope): JQuery<HTMLElement>;
getId(el: HTMLElement): string;
getType(el: HTMLElement): string | false;
getValue(el: HTMLElement): any;
subscribe(el: HTMLElement, callback: (value: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
receiveMessage(el: HTMLElement, data: receiveMessageDataType): void;
getState(el: HTMLElement): any;
getRatePolicy(el: HTMLElement): {
policy: RatePolicyModes;
delay: number;
} | null;
initialize(el: HTMLElement): void;
dispose(el: HTMLElement): void;
}
export { InputBinding };
export type { receiveMessageDataType };

View File

@@ -0,0 +1,19 @@
import { InputBinding } from "./InputBinding";
declare type ActionButtonReceiveMessageData = {
label?: string;
icon?: string;
};
declare class ActionButtonInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: HTMLElement): number;
setValue(el: HTMLElement, value: number): void;
getType(el: HTMLElement): string;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
getState(el: HTMLElement): {
value: number;
};
receiveMessage(el: HTMLElement, data: ActionButtonReceiveMessageData): void;
unsubscribe(el: HTMLElement): void;
}
export { ActionButtonInputBinding };
export type { ActionButtonReceiveMessageData };

View File

@@ -0,0 +1,20 @@
import { InputBinding } from "./InputBinding";
declare type CheckedHTMLElement = HTMLInputElement;
declare type CheckboxReceiveMessageData = {
value?: any;
label?: string;
};
declare class CheckboxInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: CheckedHTMLElement): any;
setValue(el: CheckedHTMLElement, value: boolean): void;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
getState(el: CheckedHTMLElement): {
label: string;
value: any;
};
receiveMessage(el: CheckedHTMLElement, data: CheckboxReceiveMessageData): void;
}
export { CheckboxInputBinding };
export type { CheckedHTMLElement, CheckboxReceiveMessageData };

View File

@@ -0,0 +1,30 @@
import { InputBinding } from "./InputBinding";
import { CheckedHTMLElement } from "./checkbox";
declare type CheckboxGroupHTMLElement = CheckedHTMLElement;
declare type ValueLabelObject = {
value: any;
label: string;
};
declare type CheckboxGroupReceiveMessageData = {
options?: any;
value?: any;
label: string;
};
declare class CheckboxGroupInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: CheckboxGroupHTMLElement): Array<CheckboxGroupHTMLElement>;
setValue(el: HTMLElement, value: Array<string> | string): void;
getState(el: CheckboxGroupHTMLElement): {
label: string;
value: any;
options: Array<ValueLabelObject>;
};
receiveMessage(el: CheckboxGroupHTMLElement, data: CheckboxGroupReceiveMessageData): void;
subscribe(el: CheckboxGroupHTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: CheckboxGroupHTMLElement): void;
_getLabelNode(el: CheckboxGroupHTMLElement): JQuery<HTMLElement>;
_getLabel(obj: HTMLElement): string | null;
_setLabel(obj: HTMLElement, value: string): null;
}
export { CheckboxGroupInputBinding };
export type { CheckboxGroupReceiveMessageData };

55
srcts/src_d/bindings/input/date.d.ts vendored Normal file
View File

@@ -0,0 +1,55 @@
/// <reference types="bootstrap-datepicker" />
import { InputBinding } from "./InputBinding";
declare global {
interface JQuery {
bsDatepicker(methodName: string): any;
bsDatepicker(methodName: string, params: any): any;
}
}
declare type DateReceiveMessageData = {
label: string;
min?: Date | null;
max?: Date | null;
value?: Date | null;
};
declare class DateInputBindingBase extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getType(el: HTMLElement): string;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
getRatePolicy(): {
policy: "debounce";
delay: 250;
};
setValue(el: HTMLElement, data: unknown): void;
initialize(el: HTMLElement): void;
_getLabelNode(el: HTMLElement): JQuery<HTMLElement>;
_formatToString(format: {
parts: Array<string>;
separators: Array<string>;
}): string;
_setMin(el: HTMLElement, date: Date | undefined | null): void;
_setMax(el: HTMLElement, date: Date): void;
_newDate(date: Date | string | never): Date | void;
_floorDateTime(date: Date): Date;
_dateAsUTC(date: Date): Date;
_UTCDateAsLocal(date: Date): Date;
}
declare class DateInputBinding extends DateInputBindingBase {
getValue(el: HTMLElement): string;
setValue(el: HTMLElement, value: Date): void;
getState(el: HTMLElement): {
label: string;
value: string | null;
valueString: string | number | string[];
min: string | null;
max: string | null;
language: string | null;
weekstart: number;
format: string;
startview: DatepickerViewModes;
};
receiveMessage(el: HTMLElement, data: DateReceiveMessageData): void;
}
export { DateInputBinding, DateInputBindingBase };
export type { DateReceiveMessageData };

View File

@@ -0,0 +1,36 @@
import { DateInputBindingBase } from "./date";
declare type DateRangeReceiveMessageData = {
label: string;
min?: Date;
max?: Date;
value?: {
start?: Date;
end?: Date;
};
};
declare class DateRangeInputBinding extends DateInputBindingBase {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: HTMLElement): [string, string];
setValue(el: HTMLElement, value: {
start?: Date;
end?: Date;
}): void;
getState(el: HTMLElement): {
label: string;
value: [string, string];
valueString: [string, string];
min: Date;
max: Date;
weekstart: string;
format: string;
language: string;
startview: string;
};
receiveMessage(el: HTMLElement, data: DateRangeReceiveMessageData): void;
initialize(el: HTMLElement): void;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
_getLabelNode(el: HTMLElement): JQuery<HTMLElement>;
}
export { DateRangeInputBinding };
export type { DateRangeReceiveMessageData };

View File

@@ -0,0 +1,21 @@
/// <reference types="jquery" />
import { InputBinding } from "./InputBinding";
declare class FileInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getId(el: HTMLInputElement): string;
getValue(el: HTMLElement): {
name?: string;
} | null;
setValue(el: HTMLElement, value: void): void;
getType(el: HTMLElement): string;
_zoneOf(el: HTMLElement | JQuery<HTMLElement>): JQuery<HTMLElement>;
_enableDraghover(el: JQuery<HTMLElement>): JQuery<HTMLElement>;
_disableDraghover(el: JQuery<HTMLElement>): JQuery<HTMLElement>;
_enableDocumentEvents(): void;
_disableDocumentEvents(): void;
_canSetFiles(fileList: FileList): boolean;
_handleDrop(e: JQuery.DragEventBase, el: HTMLInputElement): void;
subscribe(el: HTMLInputElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
}
export { FileInputBinding };

9
srcts/src_d/bindings/input/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { BindingRegistry } from "../registry";
import { InputBinding } from "./InputBinding";
import { FileInputBinding } from "./fileinput";
declare type InitInputBindings = {
inputBindings: BindingRegistry<InputBinding>;
fileInputBinding: FileInputBinding;
};
declare function initInputBindings(): InitInputBindings;
export { initInputBindings, InputBinding };

20
srcts/src_d/bindings/input/number.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
import { TextInputBinding } from "./text";
declare type NumberHTMLElement = HTMLInputElement;
declare type NumberReceiveMessageData = {
label: string;
value?: any;
min?: any;
max?: any;
step?: any;
};
declare class NumberInputBinding extends TextInputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: NumberHTMLElement): string | number | string[];
setValue(el: NumberHTMLElement, value: number): void;
getType(el: NumberHTMLElement): string;
receiveMessage(el: NumberHTMLElement, data: NumberReceiveMessageData): void;
getState(el: NumberHTMLElement): any;
_getLabelNode(el: NumberHTMLElement): JQuery<HTMLElement>;
}
export { NumberInputBinding };
export type { NumberReceiveMessageData };

View File

@@ -0,0 +1,6 @@
import { TextInputBinding } from "./text";
declare class PasswordInputBinding extends TextInputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getType(el: HTMLElement): string;
}
export { PasswordInputBinding };

29
srcts/src_d/bindings/input/radio.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
import { InputBinding } from "./InputBinding";
declare type RadioHTMLElement = HTMLInputElement;
declare type ValueLabelObject = {
value: any;
label: string;
};
declare type RadioReceiveMessageData = {
value?: string;
options?: Array<ValueLabelObject>;
label: string;
};
declare class RadioInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: RadioHTMLElement): string | number | string[] | null;
setValue(el: RadioHTMLElement, value: string): void;
getState(el: RadioHTMLElement): {
label: string;
value: string | number | string[];
options: Array<ValueLabelObject>;
};
receiveMessage(el: RadioHTMLElement, data: RadioReceiveMessageData): void;
subscribe(el: RadioHTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: RadioHTMLElement): void;
_getLabelNode(el: RadioHTMLElement): JQuery<HTMLElement>;
_getLabel(obj: HTMLElement): string | null;
_setLabel(obj: HTMLElement, value: string): null;
}
export { RadioInputBinding };
export type { RadioReceiveMessageData };

View File

@@ -0,0 +1,36 @@
/// <reference types="selectize" />
import { InputBinding } from "./InputBinding";
declare type SelectHTMLElement = HTMLSelectElement & {
nonempty: boolean;
};
declare type SelectInputReceiveMessageData = {
label: string;
options?: any;
config?: any;
url?: string;
value?: string;
};
declare class SelectInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getType(el: HTMLElement): string;
getId(el: SelectHTMLElement): string;
getValue(el: HTMLElement): string | number | string[];
setValue(el: SelectHTMLElement, value: string): void;
getState(el: SelectHTMLElement): {
label: JQuery<HTMLElement>;
value: string | number | string[];
options: Array<{
value: string;
label: string;
}>;
};
receiveMessage(el: SelectHTMLElement, data: SelectInputReceiveMessageData): void;
subscribe(el: SelectHTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
initialize(el: SelectHTMLElement): void;
_getLabelNode(el: SelectHTMLElement): JQuery<HTMLElement>;
_is_selectize(el: HTMLElement): boolean;
_selectize(el: SelectHTMLElement, update?: boolean): Selectize.IApi<any, any>;
}
export { SelectInputBinding };
export type { SelectInputReceiveMessageData };

44
srcts/src_d/bindings/input/slider.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
import { TextHTMLElement, TextInputBinding } from "./text";
declare type TimeFormatter = (fmt: string, dt: Date) => string;
declare type legacySliderType = {
canStepNext: () => boolean;
stepNext: () => void;
resetToStart: () => void;
};
declare type SliderReceiveMessageData = {
label: string;
value?: Array<string | number> | string | number;
min?: number;
max?: number;
step?: number;
};
declare global {
interface Window {
strftime: {
utc: () => TimeFormatter;
timezone: (timezone: string) => TimeFormatter;
} & TimeFormatter;
}
interface JQuery {
slider: () => legacySliderType;
}
}
declare class SliderInputBinding extends TextInputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getType(el: HTMLElement): string | false;
getValue(el: TextHTMLElement): number | string | [number | string, number | string];
setValue(el: HTMLElement, value: number | string | [number | string, number | string]): void;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
receiveMessage(el: HTMLElement, data: SliderReceiveMessageData): void;
getRatePolicy(el: HTMLElement): {
policy: "debounce";
delay: 250;
};
getState(el: HTMLInputElement): void;
initialize(el: HTMLElement): void;
_getLabelNode(el: HTMLElement): JQuery<HTMLElement>;
_numValues(el: HTMLElement): 1 | 2;
}
export { SliderInputBinding };
export type { SliderReceiveMessageData };

View File

@@ -0,0 +1,18 @@
import { InputBinding } from "./InputBinding";
declare type TabInputReceiveMessageData = {
value?: string;
};
declare class BootstrapTabInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getValue(el: HTMLElement): string | null;
setValue(el: HTMLElement, value: string): void;
getState(el: HTMLElement): {
value: string | null;
};
receiveMessage(el: HTMLElement, data: TabInputReceiveMessageData): void;
subscribe(el: HTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
_getTabName(anchor: JQuery<HTMLElement>): string;
}
export { BootstrapTabInputBinding };
export type { TabInputReceiveMessageData };

28
srcts/src_d/bindings/input/text.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
import { InputBinding } from "./InputBinding";
declare type TextHTMLElement = HTMLInputElement;
declare type TextReceiveMessageData = {
label: string;
value?: any;
placeholder?: any;
};
declare class TextInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
getId(el: TextHTMLElement): string;
getValue(el: TextHTMLElement): any;
setValue(el: TextHTMLElement, value: any): void;
subscribe(el: TextHTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: TextHTMLElement): void;
receiveMessage(el: TextHTMLElement, data: TextReceiveMessageData): void;
getState(el: TextHTMLElement): {
label: string;
value: any;
placeholder: any;
};
getRatePolicy(el: HTMLElement): {
policy: "debounce";
delay: 250;
};
_getLabelNode(el: HTMLElement): JQuery<HTMLElement>;
}
export { TextInputBinding };
export type { TextHTMLElement, TextReceiveMessageData };

View File

@@ -0,0 +1,5 @@
import { TextInputBinding } from "./text";
declare class TextareaInputBinding extends TextInputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
}
export { TextareaInputBinding };

View File

@@ -0,0 +1,13 @@
import type { errorsMessageValue } from "../../shiny/shinyapp";
declare class OutputBinding {
name: string;
find(scope: JQuery<HTMLElement> | HTMLElement): JQuery<HTMLElement>;
renderValue(el: HTMLElement, data: any): void;
getId(el: HTMLElement): string;
onValueChange(el: HTMLElement, data: any): void;
onValueError(el: HTMLElement, err: errorsMessageValue): void;
renderError(el: HTMLElement, err: errorsMessageValue): void;
clearError(el: HTMLElement): void;
showProgress(el: HTMLElement, show: boolean): void;
}
export { OutputBinding };

View File

@@ -0,0 +1,21 @@
import { OutputBinding } from "./OutputBinding";
import type { errorsMessageValue } from "../../shiny/shinyapp";
declare class DatatableOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
onValueError(el: HTMLElement, err: errorsMessageValue): void;
renderValue(el: HTMLElement, data: null | {
colnames?: Array<string>;
options?: null | {
searching?: boolean;
search?: {
caseInsensitive?: boolean;
};
};
action?: string;
escape?: string;
evalOptions?: Array<string>;
callback?: string;
searchDelay?: number;
}): void;
}
export { DatatableOutputBinding };

View File

@@ -0,0 +1,6 @@
import { OutputBinding } from "./OutputBinding";
declare class DownloadLinkOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
renderValue(el: HTMLElement, data: string): void;
}
export { DownloadLinkOutputBinding };

9
srcts/src_d/bindings/output/html.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { OutputBinding } from "./OutputBinding";
import { renderContent } from "../../shiny/render";
import type { errorsMessageValue } from "../../shiny/shinyapp";
declare class HtmlOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
onValueError(el: HTMLElement, err: errorsMessageValue): void;
renderValue(el: HTMLElement, data: Parameters<typeof renderContent>[1]): void;
}
export { HtmlOutputBinding };

10
srcts/src_d/bindings/output/image.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
import { OutputBinding } from "./OutputBinding";
declare class ImageOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
renderValue(el: HTMLElement, data: any): void;
renderError(el: HTMLElement, err: any): void;
clearError(el: any): void;
resize(el: HTMLElement, width: string | number, height: string | number): void;
}
declare const imageOutputBinding: ImageOutputBinding;
export { imageOutputBinding, ImageOutputBinding };

View File

@@ -0,0 +1,7 @@
import { BindingRegistry } from "../registry";
import { OutputBinding } from "./OutputBinding";
declare type InitOutputBindings = {
outputBindings: BindingRegistry<OutputBinding>;
};
declare function initOutputBindings(): InitOutputBindings;
export { OutputBinding, initOutputBindings };

6
srcts/src_d/bindings/output/text.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
import { OutputBinding } from "./OutputBinding";
declare class TextOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement>;
renderValue(el: HTMLElement, data: string | number | boolean): void;
}
export { TextOutputBinding };

View File

@@ -0,0 +1,16 @@
import type { errorsMessageValue } from "../shiny/shinyapp";
import { OutputBinding } from "./output";
interface OutpuBindingWithResize extends OutputBinding {
resize?: (el: HTMLElement, width: string | number, height: string | number) => void;
}
declare class OutputBindingAdapter {
el: HTMLElement;
binding: OutputBinding;
constructor(el: HTMLElement, binding: OutpuBindingWithResize);
getId(): string;
onValueChange(data: any): void;
onValueError(err: errorsMessageValue): void;
showProgress(show: boolean): void;
onResize(): void;
}
export { OutputBindingAdapter };

17
srcts/src_d/bindings/registry.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
interface BindingInterface {
name: string;
}
interface BindingObjType<BindingType> {
binding: BindingType;
priority: number;
name?: string;
}
declare class BindingRegistry<BindingType extends BindingInterface> {
bindings: Array<BindingObjType<BindingType>>;
bindingNames: Record<string, BindingObjType<BindingType>>;
register(binding: BindingType, bindingName: string, priority?: number): void;
setPriority(bindingName: string, priority: number): void;
getPriority(bindingName: string): number | false;
getBindings(): Array<BindingObjType<BindingType>>;
}
export { BindingRegistry };

32
srcts/src_d/events/shinyEvents.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
/// <reference types="jquery" />
import type { InputBinding, receiveMessageDataType } from "../bindings/input/InputBinding";
import type { OutputBindingAdapter } from "../bindings/output_adapter";
import type { priorityType } from "../inputPolicies/InputPolicy";
import type { errorsMessageValue } from "../shiny/shinyapp";
interface ShinyEventCommon extends JQuery.Event {
name: string;
value: any;
el: HTMLElement;
}
interface ShinyEventInputChanged extends ShinyEventCommon {
value: any;
binding: InputBinding;
inputType: string;
priority: priorityType;
}
interface ShinyEventUpdateInput extends ShinyEventCommon {
message: receiveMessageDataType;
binding: InputBinding;
}
interface ShinyEventValue extends ShinyEventCommon {
value: any;
binding: OutputBindingAdapter;
}
interface ShinyEventError extends ShinyEventCommon {
binding: OutputBindingAdapter;
error: errorsMessageValue;
}
interface ShinyEventMessage extends JQuery.Event {
message: any;
}
export type { ShinyEventInputChanged, ShinyEventUpdateInput, ShinyEventValue, ShinyEventError, ShinyEventMessage, };

View File

@@ -0,0 +1,4 @@
import type { FileInputBinding } from "../bindings/input/fileinput";
import type { ShinyEventInputChanged } from "./shinyEvents";
declare function triggerFileInputChanged(name: string, value: any, binding: FileInputBinding, el: HTMLElement, inputType: string, onEl: typeof document): ShinyEventInputChanged;
export { triggerFileInputChanged };

38
srcts/src_d/file/FileProcessor.d.ts vendored Normal file
View File

@@ -0,0 +1,38 @@
import { ShinyApp } from "../shiny/shinyapp";
declare class FileProcessor {
files: FileList;
fileIndex: number;
aborted: boolean;
completed: boolean;
constructor(files: FileList, exec$run?: boolean);
onBegin(files: FileList, cont: () => void): void;
onFile(file: File, cont: () => void): void;
onComplete(): void;
onAbort(): void;
abort(): void;
$getRun(): () => void;
$run(): void;
}
declare class FileUploader extends FileProcessor {
shinyapp: any;
id: string;
el: HTMLElement;
jobId: string;
uploadUrl: string;
progressBytes: number;
totalBytes: number;
constructor(shinyapp: ShinyApp, id: string, files: FileList, el: HTMLElement);
makeRequest(method: any, args: any, onSuccess: any, onFailure: any, blobs: any): void;
onBegin(files: FileList, cont: () => void): void;
onFile(file: File, cont: () => void): void;
onComplete(): void;
onError(message: string): void;
onAbort(): void;
onProgress(file: File | null, completed: number): void;
$container(): JQuery<HTMLElement>;
$bar(): JQuery<HTMLElement>;
$setVisible(visible: boolean): void;
$setError(error: any | null): void;
$setActive(active: boolean): void;
}
export { FileUploader };

78
srcts/src_d/imageutils/createBrush.d.ts vendored Normal file
View File

@@ -0,0 +1,78 @@
import type { CoordmapType } from "./initCoordmap";
import type { PanelType } from "./initPanelScales";
import type { OffsetType } from "./findbox";
declare type BoundsType = {
xmin: number;
xmax: number;
ymin: number;
ymax: number;
};
declare type BoundsCss = BoundsType;
declare type BoundsData = BoundsType;
declare type ImageState = {
brushing?: boolean;
dragging?: boolean;
resizing?: boolean;
down?: OffsetType;
up?: OffsetType;
resizeSides?: {
left: boolean;
right: boolean;
top: boolean;
bottom: boolean;
};
boundsCss?: BoundsCss;
boundsData?: BoundsData;
panel?: PanelType;
changeStartBounds?: BoundsType;
};
declare type BrushOptsType = {
brushDirection: "x" | "y" | "xy";
brushClip: boolean;
brushFill: string;
brushOpacity: string;
brushStroke: string;
brushDelayType?: "throttle" | "debounce";
brushDelay?: number;
brushResetOnNew?: boolean;
};
declare type BrushType = {
reset: () => void;
importOldBrush: () => void;
isInsideBrush: (offsetCss: OffsetType) => boolean;
isInResizeArea: (offsetCss: OffsetType) => boolean;
whichResizeSides: (offsetCss: OffsetType) => ImageState["resizeSides"];
onResize: () => void;
boundsCss: {
(boxCss: BoundsCss): void;
(): BoundsCss;
};
boundsData: {
(boxData: BoundsData): void;
(): BoundsData;
};
getPanel: () => ImageState["panel"];
down: {
(): ImageState["down"];
(offsetCss: any): void;
};
up: {
(): ImageState["up"];
(offsetCss: any): void;
};
isBrushing: () => ImageState["brushing"];
startBrushing: () => void;
brushTo: (offsetCss: OffsetType) => void;
stopBrushing: () => void;
isDragging: () => ImageState["dragging"];
startDragging: () => void;
dragTo: (offsetCss: OffsetType) => void;
stopDragging: () => void;
isResizing: () => ImageState["resizing"];
startResizing: () => void;
resizeTo: (offsetCss: OffsetType) => void;
stopResizing: () => void;
};
declare function createBrush($el: JQuery<HTMLElement>, opts: BrushOptsType, coordmap: CoordmapType, expandPixels: number): BrushType;
export { createBrush };
export type { BoundsType, BrushOptsType, BoundsCss };

View File

@@ -0,0 +1,6 @@
/// <reference types="jquery" />
declare function createClickInfo($el: JQuery<HTMLElement>, dblclickId: string, dblclickDelay: number): {
mousedown: (e: JQuery.MouseDownEvent) => void;
dblclickIE8: (e: JQuery.DoubleClickEvent) => void;
};
export { createClickInfo };

View File

@@ -0,0 +1,38 @@
/// <reference types="jquery" />
import type { BoundsCss, BoundsType, BrushOptsType } from "./createBrush";
import type { OffsetType } from "./findbox";
import type { CoordmapType } from "./initCoordmap";
import type { PanelType } from "./initPanelScales";
declare type CreateHandlerType = {
mousemove?: (e: JQuery.MouseMoveEvent) => void;
mouseout?: (e: JQuery.MouseOutEvent) => void;
mousedown?: (e: JQuery.MouseDownEvent) => void;
onResetImg: () => void;
onResize?: () => void;
};
declare type BrushInfo = {
xmin: number;
xmax: number;
ymin: number;
ymax: number;
coords_css?: BoundsCss;
coords_img?: BoundsType;
x?: number;
y?: number;
img_css_ratio?: OffsetType;
mapping?: PanelType["mapping"];
domain?: PanelType["domain"];
range?: PanelType["range"];
log?: PanelType["log"];
direction?: BrushOptsType["brushDirection"];
brushId?: string;
outputId?: string;
};
declare type InputIdType = Parameters<CoordmapType["mouseCoordinateSender"]>[0];
declare type ClipType = Parameters<CoordmapType["mouseCoordinateSender"]>[1];
declare type NullOutsideType = Parameters<CoordmapType["mouseCoordinateSender"]>[2];
declare function createClickHandler(inputId: InputIdType, clip: ClipType, coordmap: CoordmapType): CreateHandlerType;
declare function createHoverHandler(inputId: InputIdType, delay: number, delayType: "throttle" | string, clip: ClipType, nullOutside: NullOutsideType, coordmap: CoordmapType): CreateHandlerType;
declare function createBrushHandler(inputId: InputIdType, $el: JQuery<HTMLElement>, opts: BrushOptsType, coordmap: CoordmapType, outputId: BrushInfo["outputId"]): CreateHandlerType;
export { createClickHandler, createHoverHandler, createBrushHandler };
export type { BrushInfo };

View File

@@ -0,0 +1,2 @@
declare function disableDrag($el: JQuery<HTMLElement>, $img: JQuery<HTMLElement>): void;
export { disableDrag };

8
srcts/src_d/imageutils/findbox.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { BoundsType } from "./createBrush";
declare type OffsetType = {
x: number;
y: number;
};
declare function findBox(offset1: OffsetType, offset2: OffsetType): BoundsType;
export type { OffsetType };
export { findBox };

9
srcts/src_d/imageutils/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { createBrush } from "./createBrush";
import { createClickInfo } from "./createClickInfo";
import { createClickHandler, createHoverHandler, createBrushHandler } from "./createHandlers";
import { disableDrag } from "./disableDrag";
import { findBox } from "./findbox";
import { initCoordmap } from "./initCoordmap";
import { initPanelScales } from "./initPanelScales";
import { shiftToRange } from "./shiftToRange";
export { disableDrag, initPanelScales, initCoordmap, findBox, shiftToRange, createClickInfo, createClickHandler, createHoverHandler, createBrushHandler, createBrush, };

View File

@@ -0,0 +1,33 @@
/// <reference types="jquery" />
import type { OffsetType } from "./findbox";
import type { BoundsType } from "./createBrush";
import type { PanelType } from "./initPanelScales";
declare function findOrigin($el: JQuery<HTMLElement>): OffsetType;
declare type OffsetCssType = Record<string, number>;
declare type OffsetImgType = Record<string, number>;
declare type CoordmapType = {
panels: Array<PanelType>;
dims: {
height: number;
width: number;
};
mouseOffsetCss: (evt: JQuery.MouseEventBase) => OffsetType;
scaleCssToImg: {
(offsetCss: BoundsType): BoundsType;
(offsetCss: OffsetType): OffsetType;
(offsetCss: OffsetCssType): OffsetImgType;
};
scaleImgToCss: {
(offsetImg: BoundsType): BoundsType;
(offsetImg: OffsetType): OffsetType;
(offsetImg: OffsetImgType): OffsetCssType;
};
imgToCssScalingRatio: () => OffsetType;
cssToImgScalingRatio: () => OffsetType;
getPanelCss: (offsetCss: OffsetCssType, expand?: number) => PanelType;
isInPanelCss: (offsetCss: OffsetCssType, expand?: number) => boolean;
mouseCoordinateSender: (inputId: string, clip?: boolean, nullOutside?: boolean) => (e: JQuery.MouseDownEvent) => void;
};
declare function initCoordmap($el: JQuery<HTMLElement>, coordmap: CoordmapType): void;
export type { CoordmapType };
export { initCoordmap, findOrigin };

View File

@@ -0,0 +1,36 @@
import { OffsetType } from "./findbox";
declare type PanelType = {
domain: {
top: number;
bottom: number;
left: number;
right: number;
};
range: {
top: number;
bottom: number;
left: number;
right: number;
};
log?: {
x?: number;
y?: number;
};
mapping: Record<string, string>;
panel_vars?: Record<string, number | string>;
scaleDataToImg?: (val: Record<string, number>, clip?: boolean) => Record<string, number>;
scaleImgToData?: {
(val: OffsetType, clip?: boolean): OffsetType;
(val: Record<string, number>, clip?: boolean): Record<string, number>;
};
clipImg?: (offsetImg: {
x: number;
y: number;
}) => {
x: number;
y: number;
};
};
declare function initPanelScales(panels: Array<PanelType>): void;
export type { PanelType };
export { initPanelScales };

View File

@@ -0,0 +1,2 @@
declare function resetBrush(brushId: string): void;
export { resetBrush };

View File

@@ -0,0 +1,2 @@
declare function shiftToRange(vals: number | Array<number>, min: number, max: number): Array<number>;
export { shiftToRange };

1
srcts/src_d/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export {};

2
srcts/src_d/initialize/browser.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function determineBrowserInfo(): void;
export { determineBrowserInfo };

View File

@@ -0,0 +1,2 @@
declare function disableFormSubmission(): void;
export { disableFormSubmission };

2
srcts/src_d/initialize/history.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function trackHistory(): void;
export { trackHistory };

2
srcts/src_d/initialize/index.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function init(): void;
export { init };

View File

@@ -0,0 +1,9 @@
declare type priorityType = "immediate" | "deferred" | "event";
declare class InputPolicy {
target: InputPolicy;
setInput(name: string, value: unknown, opts: {
priority: priorityType;
}): void;
}
export { InputPolicy };
export type { priorityType };

9
srcts/src_d/inputPolicies/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { InputBatchSender } from "./inputBatchSender";
import { InputNoResendDecorator } from "./inputNoResendDecorator";
import { InputEventDecorator } from "./inputEventDecorator";
import { InputRateDecorator } from "./inputRateDecorator";
import { InputDeferDecorator } from "./inputDeferDecorator";
import { InputValidateDecorator } from "./inputValidateDecorator";
import { priorityType, InputPolicy } from "./InputPolicy";
export { InputBatchSender, InputEventDecorator, InputNoResendDecorator, InputRateDecorator, InputDeferDecorator, InputValidateDecorator, InputPolicy, };
export type { priorityType };

View File

@@ -0,0 +1,16 @@
/// <reference types="node" />
import { priorityType, InputPolicy } from "./InputPolicy";
import { ShinyApp } from "../shiny/shinyapp";
declare class InputBatchSender extends InputPolicy {
shinyapp: ShinyApp;
timerId: NodeJS.Timeout;
pendingData: Record<string, unknown>;
reentrant: boolean;
lastChanceCallback: Array<() => void>;
constructor(shinyapp: ShinyApp);
setInput(nameType: string, value: unknown, opts: {
priority: priorityType;
}): void;
private $sendNow;
}
export { InputBatchSender };

View File

@@ -0,0 +1,15 @@
import { priorityType, InputPolicy } from "./InputPolicy";
declare class InputDeferDecorator extends InputPolicy {
pendingInput: Record<string, {
value: unknown;
opts: {
priority: priorityType;
};
}>;
constructor(target: InputPolicy);
setInput(nameType: string, value: unknown, opts: {
priority: priorityType;
}): void;
submit(): void;
}
export { InputDeferDecorator };

View File

@@ -0,0 +1,12 @@
import type { priorityType } from "./InputPolicy";
import { InputPolicy } from "./InputPolicy";
import type { InputBinding } from "../bindings";
declare class InputEventDecorator extends InputPolicy {
constructor(target: InputPolicy);
setInput(nameType: string, value: unknown, opts: {
el: HTMLElement;
priority: priorityType;
binding: InputBinding;
}): void;
}
export { InputEventDecorator };

View File

@@ -0,0 +1,12 @@
import { priorityType, InputPolicy } from "./InputPolicy";
declare type lastSentValuesType = Record<string, Record<string, string>>;
declare class InputNoResendDecorator extends InputPolicy {
lastSentValues: lastSentValuesType;
constructor(target: InputPolicy, initialValues?: lastSentValuesType);
setInput(nameType: string, value: unknown, opts: {
priority: priorityType;
}): void;
reset(values?: {}): void;
forget(name: string): void;
}
export { InputNoResendDecorator };

View File

@@ -0,0 +1,14 @@
import { priorityType, InputPolicy } from "./InputPolicy";
declare type RatePolicyModes = "direct" | "debounce" | "throttle";
declare class InputRateDecorator extends InputPolicy {
inputRatePolicies: {};
constructor(target: InputPolicy);
setInput(nameType: string, value: unknown, opts: {
priority: priorityType;
}): void;
setRatePolicy(nameType: string, mode: RatePolicyModes, millis?: number): void;
private $ensureInit;
private $doSetInput;
}
export { InputRateDecorator };
export type { RatePolicyModes };

View File

@@ -0,0 +1,17 @@
import { priorityType, InputPolicy } from "./InputPolicy";
declare type MaybeInputOpts = {
priority?: priorityType;
binding?: unknown;
el?: HTMLElement;
};
declare function addDefaultInputOpts<T>(opts?: T & MaybeInputOpts): T & {
priority: priorityType;
binding: unknown;
el?: HTMLElement;
};
declare class InputValidateDecorator {
target: any;
constructor(target: InputPolicy);
setInput: <T>(nameType: string, value: unknown, opts?: T & MaybeInputOpts) => void;
}
export { InputValidateDecorator, addDefaultInputOpts };

View File

@@ -0,0 +1,5 @@
declare function splitInputNameType(nameType: string): {
name: string;
inputType: string | "";
};
export { splitInputNameType };

1
srcts/src_d/main.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export {};

26
srcts/src_d/shiny/bind.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
import type { InputBinding, OutputBinding } from "../bindings";
import type { BindingRegistry } from "../bindings/registry";
import type { InputRateDecorator, InputValidateDecorator } from "../inputPolicies";
declare type bindScope = HTMLElement | JQuery<HTMLElement>;
declare type bindInputsCtx = {
inputs: InputValidateDecorator;
inputsRate: InputRateDecorator;
inputBindings: BindingRegistry<InputBinding>;
outputBindings: BindingRegistry<OutputBinding>;
sendOutputHiddenState: () => void;
maybeAddThemeObserver: (el: HTMLElement) => void;
initDeferredIframes: () => void;
};
declare function bindInputs(shinyCtx: bindInputsCtx, scope?: bindScope): Record<string, {
value: unknown;
opts: {
immediate: boolean;
binding: InputBinding;
el: HTMLElement;
};
}>;
declare function _bindAll(shinyCtx: bindInputsCtx, scope: bindScope): ReturnType<typeof bindInputs>;
declare function unbindAll(shinyCtx: bindInputsCtx, scope: bindScope, includeSelf?: boolean): void;
declare function bindAll(shinyCtx: bindInputsCtx, scope: bindScope): void;
export { unbindAll, bindAll, _bindAll };
export type { bindScope, bindInputsCtx };

50
srcts/src_d/shiny/index.d.ts vendored Normal file
View File

@@ -0,0 +1,50 @@
import { InputBinding, OutputBinding } from "../bindings";
import { resetBrush } from "../imageutils/resetBrush";
import { $escape, compareVersion } from "../utils";
import { showNotification, removeNotification } from "./notifications";
import { showModal, removeModal } from "./modal";
import { showReconnectDialog, hideReconnectDialog } from "./reconnectDialog";
import { renderContent, renderDependencies, renderHtml } from "./render";
import { shinyBindAll, shinyForgetLastInputValue, shinySetInputValue, shinyInitializeInputs, shinyUnbindAll } from "./initedMethods";
import { addCustomMessageHandler, HandlerType, ShinyApp } from "./shinyapp";
import { initInputBindings } from "../bindings/input";
import { initOutputBindings } from "../bindings/output";
interface ShinyType {
version: string;
$escape: typeof $escape;
compareVersion: typeof compareVersion;
inputBindings: ReturnType<typeof initInputBindings>["inputBindings"];
InputBinding: typeof InputBinding;
outputBindings: ReturnType<typeof initOutputBindings>["outputBindings"];
OutputBinding: typeof OutputBinding;
resetBrush: typeof resetBrush;
notifications: {
show: typeof showNotification;
remove: typeof removeNotification;
};
modal: {
show: typeof showModal;
remove: typeof removeModal;
};
createSocket?: () => WebSocket;
showReconnectDialog: typeof showReconnectDialog;
hideReconnectDialog: typeof hideReconnectDialog;
renderDependencies: typeof renderDependencies;
renderContent: typeof renderContent;
renderHtml: typeof renderHtml;
user: string;
progressHandlers?: ShinyApp["progressHandlers"];
addCustomMessageHandler: typeof addCustomMessageHandler;
shinyapp?: ShinyApp;
setInputValue?: typeof shinySetInputValue;
onInputChange?: typeof shinySetInputValue;
forgetLastInputValue?: typeof shinyForgetLastInputValue;
bindAll?: typeof shinyBindAll;
unbindAll?: typeof shinyUnbindAll;
initializeInputs?: typeof shinyInitializeInputs;
oncustommessage?: HandlerType;
}
declare let Shiny: ShinyType;
declare function setShiny(Shiny_: ShinyType): void;
export { Shiny, setShiny };
export type { ShinyType };

3
srcts/src_d/shiny/init.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { ShinyType } from ".";
declare function initShiny(Shiny: ShinyType): void;
export { initShiny };

23
srcts/src_d/shiny/initedMethods.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
import type { ShinyType } from ".";
import type { FileInputBinding } from "../bindings/input/fileinput";
import type { OutputBindingAdapter } from "../bindings/output_adapter";
import type { priorityType } from "../inputPolicies";
import type { bindScope } from "./bind";
import type { HandlerType, ShinyApp } from "./shinyapp";
declare function setShinyObj(shiny: ShinyType): void;
declare function shinySetInputValue(name: string, value: unknown, opts?: {
priority?: priorityType;
}): void;
declare function shinyShinyApp(): ShinyApp;
declare function setShinyUser(user: string): void;
declare function shinyForgetLastInputValue(name: string): void;
declare function shinyBindAll(scope: bindScope): void;
declare function shinyUnbindAll(scope: bindScope, includeSelf?: boolean): void;
declare function shinyInitializeInputs(scope: bindScope): void;
declare function shinyAppBindOutput(id: string, binding: OutputBindingAdapter): void;
declare function shinyAppUnbindOutput(id: string, binding: OutputBindingAdapter): boolean;
declare function getShinyOnCustomMessage(): null | HandlerType;
declare function getFileInputBinding(): FileInputBinding;
declare function setFileInputBinding(fileInputBinding: FileInputBinding): void;
declare function getShinyCreateWebsocket(): (() => WebSocket) | void;
export { setShinyObj, shinySetInputValue, shinyShinyApp, setShinyUser, shinyForgetLastInputValue, shinyBindAll, shinyUnbindAll, shinyInitializeInputs, shinyAppBindOutput, shinyAppUnbindOutput, getShinyOnCustomMessage, getFileInputBinding, setFileInputBinding, getShinyCreateWebsocket, };

6
srcts/src_d/shiny/modal.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
declare function show({ html, deps }?: {
html?: string;
deps?: any[];
}): void;
declare function remove(): void;
export { show as showModal, remove as removeModal };

12
srcts/src_d/shiny/notifications.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { randomId } from "../utils";
declare function show({ html, action, deps, duration, id, closeButton, type, }?: {
html?: string;
action?: string;
deps?: any[];
duration?: number;
id?: any;
closeButton?: boolean;
type?: any;
}): ReturnType<typeof randomId>;
declare function remove(id?: string): void;
export { show as showNotification, remove as removeNotification };

2
srcts/src_d/shiny/reactlog.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function initReactlog(): void;
export { initReactlog };

View File

@@ -0,0 +1,3 @@
declare function showReconnectDialog(delay: any): void;
declare function hideReconnectDialog(): void;
export { showReconnectDialog, hideReconnectDialog };

12
srcts/src_d/shiny/render.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { bindScope } from "./bind";
import { renderHtml as singletonsRenderHtml } from "./singletons";
declare function renderDependencies(dependencies: any): void;
declare type RenderWhereType = "beforeBegin" | "afterEnd" | "replace";
declare function renderContent(el: bindScope, content: null | string | {
html: any;
deps?: any;
}, where?: RenderWhereType): void;
declare function renderHtml(html: any, el: bindScope, dependencies: any, where?: RenderWhereType): ReturnType<typeof singletonsRenderHtml>;
declare function registerDependency(name: any, version: any): void;
export { renderDependencies, renderContent, renderHtml, registerDependency };
export type { RenderWhereType };

9
srcts/src_d/shiny/sendImageSize.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { InputBatchSender } from "../inputPolicies";
import { Debouncer } from "../time";
declare class SendImageSize {
regular: () => void;
transitioned: () => void;
setImageSend(inputBatchSender: InputBatchSender, doSendImageSize: () => void): Debouncer;
}
declare const sendImageSizeFns: SendImageSize;
export { sendImageSizeFns };

82
srcts/src_d/shiny/shinyapp.d.ts vendored Normal file
View File

@@ -0,0 +1,82 @@
import { OutputBindingAdapter } from "../bindings/output_adapter";
declare type HandlerType = (msg: Record<string, unknown> | Array<unknown> | boolean | string) => void;
declare type ShinyWebSocket = WebSocket & {
allowReconnect?: boolean;
};
declare type errorsMessageValue = {
message: string;
call: Array<string>;
type?: Array<string>;
};
declare function addCustomMessageHandler(type: string, handler: HandlerType): void;
declare class ShinyApp {
$socket: ShinyWebSocket;
config: {
workerId: string;
sessionId: string;
};
$inputValues: {};
$initialInput: {};
$bindings: Record<string, OutputBindingAdapter>;
$values: {};
$errors: Record<string, errorsMessageValue>;
$conditionals: {};
$pendingMessages: any[];
$activeRequests: {};
$nextRequestId: number;
$allowReconnect: boolean | "force";
constructor();
connect(initialInput: unknown): void;
isConnected(): boolean;
private scheduledReconnect;
reconnect(): void;
createSocket(): ShinyWebSocket;
sendInput(values: unknown): void;
$notifyDisconnected(): void;
$removeSocket(): void;
$scheduleReconnect(delay: Parameters<typeof setTimeout>[1]): void;
reconnectDelay: {
next: () => number;
reset: () => void;
};
onDisconnected(): void;
onConnected(): void;
makeRequest(method: string, args: Array<unknown>, onSuccess: (value: unknown) => void, onError: (err: string) => void, blobs: Array<Blob | ArrayBuffer | string>): void;
$sendMsg(msg: any): void;
receiveError(name: string, error: errorsMessageValue): void;
receiveOutput<T>(name: string, value: T): T;
bindOutput(id: string, binding: OutputBindingAdapter): OutputBindingAdapter;
unbindOutput(id: string, binding: OutputBindingAdapter): boolean;
private narrowScopeComponent;
private narrowScope;
$updateConditionals(): void;
private addMessageHandler;
dispatchMessage(data: string | ArrayBufferLike): void;
_sendMessagesToHandlers(msgObj: Record<string, unknown>, handlers: Record<string, HandlerType>, handlerOrder: Array<string>): void;
private init;
progressHandlers: {
binding: (message: {
id: string;
}) => void;
open: (message: {
style: "notification" | "old";
id: string;
}) => void;
update: (message: {
style: "notification" | "old";
id: string;
message?: string;
detail?: string;
value?: number;
}) => void;
close: (message: {
style: "notification";
id: string;
}) => void;
};
getTestSnapshotBaseUrl({ fullUrl }?: {
fullUrl?: boolean;
}): string;
}
export { ShinyApp, addCustomMessageHandler };
export type { HandlerType, errorsMessageValue };

8
srcts/src_d/shiny/singletons.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import { bindScope } from "./bind";
declare function renderHtml(html: any, el: bindScope, where: any): {
html: any;
head: string;
singletons: Record<string, true>;
};
declare function registerNames(s: any): void;
export { renderHtml, registerNames };

16
srcts/src_d/time/debounce.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/// <reference types="node" />
declare class Debouncer {
target: unknown;
func: (...args: Array<unknown>) => void;
delayMs: number;
timerId: NodeJS.Timeout;
args: Array<unknown>;
constructor(target: unknown, func: (...args: Array<unknown>) => void, delayMs: number);
normalCall(...args: Array<unknown>): void;
immediateCall(...args: Array<unknown>): void;
isPending(): boolean;
$clearTimer(): void;
$invoke(): void;
}
declare function debounce(threshold: number, func: (...args: Array<any>) => void): (...args: Array<any>) => void;
export { Debouncer, debounce };

4
srcts/src_d/time/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
import { Debouncer, debounce } from "./debounce";
import { Invoker } from "./invoke";
import { Throttler, throttle } from "./throttle";
export { Debouncer, debounce, Invoker, Throttler, throttle };

9
srcts/src_d/time/invoke.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import { InputPolicy } from "../inputPolicies";
declare class Invoker {
target: InputPolicy;
func: () => void;
constructor(target: InputPolicy, func: (...args: Array<any>) => void);
normalCall(...args: Array<any>): void;
immediateCall(...args: Array<any>): void;
}
export { Invoker };

16
srcts/src_d/time/throttle.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/// <reference types="node" />
declare class Throttler {
target: any;
func: (...args: Array<any>) => void;
delayMs: number;
timerId: NodeJS.Timeout;
args: Array<any>;
constructor(target: any, func: (...args: Array<any>) => void, delayMs: number);
normalCall(...args: Array<any>): void;
immediateCall(...args: Array<any>): void;
isPending(): boolean;
$clearTimer(): void;
$invoke(): void;
}
declare function throttle(threshold: number, func: (...args: Array<any>) => void): (...args: Array<any>) => void;
export { Throttler, throttle };

2
srcts/src_d/utils/Object.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function hasOwnProperty(x: Record<string, unknown>, y: string): boolean;
export { hasOwnProperty };

3
srcts/src_d/utils/blob.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare function setBlobBuilder(BlobBuilder_: MSBlobBuilder): void;
declare function makeBlob(parts: BlobPart[]): Blob;
export { makeBlob, setBlobBuilder };

7
srcts/src_d/utils/browser.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
declare function setIsQt(isQt: boolean): void;
declare function setIsIE(isIE: boolean): void;
declare function setIEVersion(IEVersion_: number): void;
declare function isQt(): boolean;
declare function isIE(): boolean;
declare function IEVersion(): number;
export { isQt, isIE, IEVersion, setIsQt, setIsIE, setIEVersion };

2
srcts/src_d/utils/eval.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const indirectEval: typeof eval;
export { indirectEval };

25
srcts/src_d/utils/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
import { makeBlob } from "./blob";
import { hasOwnProperty } from "./Object";
declare function escapeHTML(str: string): string;
declare function randomId(): string;
declare function strToBool(str: string): boolean | undefined;
declare function getStyle(el: Element, styleProp: string): string | undefined;
declare function padZeros(n: number, digits: number): string;
declare function roundSignif(x: number, digits?: number): number;
declare function parseDate(dateString: any): Date;
declare function formatDateUTC(date: any): null | string;
declare function makeResizeFilter(el: HTMLElement, func: (width: any, height: any) => any): () => any;
declare function pixelRatio(): number;
declare function scopeExprToFunc(expr: string): (scope: any) => any;
declare function asArray<T>(value: T | Array<T> | null | undefined): Array<T>;
declare function mergeSort<T>(list: Array<T>, sortfunc: (a: any, b: any) => boolean | number): Array<T>;
declare const $escape: (val: string) => string;
declare function mapValues<V, R>(obj: Record<string, V>, f: (value: V, key: string, obj: Record<string, V>) => R): Record<string, R>;
declare function isnan(x: unknown): boolean;
declare function _equal(x: any, y: any): boolean;
declare function equal(...args: any[]): boolean;
declare const compareVersion: (a: string, op: "==" | ">=" | ">" | "<=" | "<", b: string) => boolean;
declare function updateLabel(labelTxt: undefined | string, labelNode: JQuery<HTMLElement>): void;
declare function getComputedLinkColor(el: HTMLElement): string;
declare function isBS3(): boolean;
export { escapeHTML, randomId, strToBool, getStyle, padZeros, roundSignif, parseDate, formatDateUTC, makeResizeFilter, pixelRatio, scopeExprToFunc, asArray, mergeSort, $escape, mapValues, isnan, _equal, equal, compareVersion, updateLabel, getComputedLinkColor, makeBlob, hasOwnProperty, isBS3, };

5
srcts/src_d/utils/userAgent.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
declare type UserAgentType = typeof window.navigator.userAgent;
declare let userAgentVal: UserAgentType;
declare function setUserAgent(userAgent: UserAgentType): void;
export type { UserAgentType };
export { userAgentVal as userAgent, setUserAgent };

2
srcts/src_d/window/blobBuilder.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function windowBlobBuilder(): MSBlobBuilder;
export { windowBlobBuilder };

2
srcts/src_d/window/libraries.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function windowShiny(): any;
export { windowShiny };

2
srcts/src_d/window/pixelRatio.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function windowDevicePixelRatio(): number;
export { windowDevicePixelRatio };

3
srcts/src_d/window/userAgent.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { UserAgentType } from "../utils/userAgent";
declare function windowUserAgent(): UserAgentType;
export { windowUserAgent };

View File

@@ -3,13 +3,17 @@
"compilerOptions": {
"target": "ES5",
"isolatedModules": true,
"esModuleInterop": true
"esModuleInterop": true,
"declaration": true,
"declarationDir": "./src_d",
"emitDeclarationOnly": true
},
"include": [
"src/index.ts",
"src/**/*.ts"
],
"exclude": [
"node_modules"
"node_modules",
"**/__tests__"
]
}

View File

@@ -2637,6 +2637,60 @@ __metadata:
languageName: node
linkType: hard
"@types/shiny@workspace:.":
version: 0.0.0-use.local
resolution: "@types/shiny@workspace:."
dependencies:
"@babel/core": ^7.14.3
"@babel/plugin-proposal-class-properties": ^7.13.0
"@babel/preset-env": ^7.14.2
"@babel/preset-typescript": ^7.13.0
"@babel/runtime": ^7.14.0
"@testing-library/dom": ^7.31.0
"@testing-library/jest-dom": ^5.12.0
"@testing-library/user-event": ^13.1.9
"@types/bootstrap": 3.4.0
"@types/bootstrap-datepicker": 0.0.14
"@types/datatables.net": ^1.10.19
"@types/ion-rangeslider": 2.3.0
"@types/jest": ^26.0.23
"@types/jquery": ^3.5.5
"@types/lodash": ^4.14.170
"@types/node": ^15.6.1
"@types/selectize": 0.12.34
"@typescript-eslint/eslint-plugin": ^4.25.0
"@typescript-eslint/parser": ^4.25.0
bootstrap-datepicker: 1.9.0
browserslist: ^4.16.6
core-js: ^3.13.0
esbuild: ^0.12.4
esbuild-plugin-babel: 0.2.3
esbuild-plugin-globals: ^0.1.1
eslint: ^7.27.0
eslint-config-prettier: ^7.2.0
eslint-plugin-jest: ^24.3.6
eslint-plugin-jest-dom: ^3.9.0
eslint-plugin-prettier: ^3.4.0
ion-rangeslider: 2.3.1
jest: ^26.6.3
jquery: 3.6.0
lodash: ^4.17.21
madge: ^4.0.2
parcel: ^1.12.4
parcel-bundler: ^1.12.5
phantomjs-prebuilt: ^2.1.16
prettier: 2.3.0
readcontrol: ^1.0.0
replace: ^1.2.1
selectize: 0.12.4
strftime: 0.9.2
ts-jest: ^26
type-coverage: ^2.17.5
typescript: ~4.1.5
util-inspect: "https://github.com/deecewan/browser-util-inspect#c0b4350df4378ffd743e8c36dd3898ce3992823e"
languageName: unknown
linkType: soft
"@types/sizzle@npm:*":
version: 2.3.2
resolution: "@types/sizzle@npm:2.3.2"
@@ -10749,60 +10803,6 @@ fsevents@^2.1.2:
languageName: node
linkType: hard
"root-workspace-0b6124@workspace:.":
version: 0.0.0-use.local
resolution: "root-workspace-0b6124@workspace:."
dependencies:
"@babel/core": ^7.14.3
"@babel/plugin-proposal-class-properties": ^7.13.0
"@babel/preset-env": ^7.14.2
"@babel/preset-typescript": ^7.13.0
"@babel/runtime": ^7.14.0
"@testing-library/dom": ^7.31.0
"@testing-library/jest-dom": ^5.12.0
"@testing-library/user-event": ^13.1.9
"@types/bootstrap": 3.4.0
"@types/bootstrap-datepicker": 0.0.14
"@types/datatables.net": ^1.10.19
"@types/ion-rangeslider": 2.3.0
"@types/jest": ^26.0.23
"@types/jquery": ^3.5.5
"@types/lodash": ^4.14.170
"@types/node": ^15.6.1
"@types/selectize": 0.12.34
"@typescript-eslint/eslint-plugin": ^4.25.0
"@typescript-eslint/parser": ^4.25.0
bootstrap-datepicker: 1.9.0
browserslist: ^4.16.6
core-js: ^3.13.0
esbuild: ^0.12.4
esbuild-plugin-babel: 0.2.3
esbuild-plugin-globals: ^0.1.1
eslint: ^7.27.0
eslint-config-prettier: ^7.2.0
eslint-plugin-jest: ^24.3.6
eslint-plugin-jest-dom: ^3.9.0
eslint-plugin-prettier: ^3.4.0
ion-rangeslider: 2.3.1
jest: ^26.6.3
jquery: 3.6.0
lodash: ^4.17.21
madge: ^4.0.2
parcel: ^1.12.4
parcel-bundler: ^1.12.5
phantomjs-prebuilt: ^2.1.16
prettier: 2.3.0
readcontrol: ^1.0.0
replace: ^1.2.1
selectize: 0.12.4
strftime: 0.9.2
ts-jest: ^26
type-coverage: ^2.17.5
typescript: ~4.1.5
util-inspect: "https://github.com/deecewan/browser-util-inspect#c0b4350df4378ffd743e8c36dd3898ce3992823e"
languageName: unknown
linkType: soft
"rsvp@npm:^4.8.4":
version: 4.8.5
resolution: "rsvp@npm:4.8.5"

View File

@@ -1,16 +0,0 @@
#!/bin/bash
set -e
# Run JS build process
(cd "$(dirname "$0")/../srcts" && yarn install --immutable && yarn build)
if [ -n "$(git status --porcelain)" ]
then
git status --porcelain
>&2 echo "Please rebuild the JavaScript and commit the changes."
>&2 echo "The above files changed when we built the JavaScript assets. This most often occurs when a user makes changes to the JavaScript sources but doesn't rebuild and commit them."
exit 1
else
echo "No difference detected; JavaScript build is current."
fi