lean4monaco 1.1.3 → 1.1.4

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.
Files changed (88) hide show
  1. package/README.md +1 -3
  2. package/dist/vscode-lean4/vscode-lean4/src/utils/depInstaller.d.ts +81 -0
  3. package/dist/vscode-lean4/vscode-lean4/src/utils/depInstaller.js +372 -0
  4. package/package.json +1 -1
  5. package/dist/JuliaMono-Regular.ttf +0 -0
  6. package/dist/lean4-infoview/codicon.ttf +0 -0
  7. package/dist/lean4-infoview/esm-shims/react-dom.d.ts +0 -5
  8. package/dist/lean4-infoview/esm-shims/react-jsx-runtime.d.ts +0 -5
  9. package/dist/lean4-infoview/esm-shims/react.d.ts +0 -5
  10. package/dist/lean4-infoview/index.css +0 -4161
  11. package/dist/lean4-infoview/index.d.ts +0 -16
  12. package/dist/lean4-infoview/index.development.js +0 -37312
  13. package/dist/lean4-infoview/index.production.min.js +0 -1528
  14. package/dist/lean4-infoview/infoview/collapsing.d.ts +0 -12
  15. package/dist/lean4-infoview/infoview/contexts.d.ts +0 -10
  16. package/dist/lean4-infoview/infoview/editorConnection.d.ts +0 -22
  17. package/dist/lean4-infoview/infoview/errors.d.ts +0 -14
  18. package/dist/lean4-infoview/infoview/event.d.ts +0 -33
  19. package/dist/lean4-infoview/infoview/goalLocation.d.ts +0 -61
  20. package/dist/lean4-infoview/infoview/goals.d.ts +0 -46
  21. package/dist/lean4-infoview/infoview/info.d.ts +0 -18
  22. package/dist/lean4-infoview/infoview/infos.d.ts +0 -2
  23. package/dist/lean4-infoview/infoview/interactiveCode.d.ts +0 -19
  24. package/dist/lean4-infoview/infoview/main.d.ts +0 -13
  25. package/dist/lean4-infoview/infoview/messages.d.ts +0 -19
  26. package/dist/lean4-infoview/infoview/rpcSessions.d.ts +0 -11
  27. package/dist/lean4-infoview/infoview/serverVersion.d.ts +0 -10
  28. package/dist/lean4-infoview/infoview/tooltips.d.ts +0 -32
  29. package/dist/lean4-infoview/infoview/traceExplorer.d.ts +0 -11
  30. package/dist/lean4-infoview/infoview/userWidget.d.ts +0 -39
  31. package/dist/lean4-infoview/infoview/util.d.ts +0 -144
  32. package/dist/lean4-infoview/loader.d.ts +0 -20
  33. package/dist/lean4-infoview/loader.development.js +0 -1006
  34. package/dist/lean4-infoview/loader.production.min.js +0 -1
  35. package/dist/lean4-infoview/react-dom.development.js +0 -30537
  36. package/dist/lean4-infoview/react-dom.production.min.js +0 -21
  37. package/dist/lean4-infoview/react-jsx-runtime.development.js +0 -1362
  38. package/dist/lean4-infoview/react-jsx-runtime.production.min.js +0 -1
  39. package/dist/lean4-infoview/react.development.js +0 -2823
  40. package/dist/lean4-infoview/react.production.min.js +0 -1
  41. package/dist/monaco-lean4/vscode-lean4/package.json +0 -944
  42. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +0 -9
  43. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +0 -20
  44. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.d.ts +0 -12
  45. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.js +0 -40
  46. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +0 -20
  47. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +0 -79
  48. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.d.ts +0 -13
  49. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.js +0 -29
  50. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +0 -28
  51. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +0 -124
  52. package/dist/monaco-lean4/vscode-lean4/src/config.d.ts +0 -33
  53. package/dist/monaco-lean4/vscode-lean4/src/config.js +0 -119
  54. package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +0 -27
  55. package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +0 -133
  56. package/dist/monaco-lean4/vscode-lean4/src/infoview.d.ts +0 -69
  57. package/dist/monaco-lean4/vscode-lean4/src/infoview.js +0 -711
  58. package/dist/monaco-lean4/vscode-lean4/src/leanclient.d.ts +0 -67
  59. package/dist/monaco-lean4/vscode-lean4/src/leanclient.js +0 -443
  60. package/dist/monaco-lean4/vscode-lean4/src/rpc.d.ts +0 -16
  61. package/dist/monaco-lean4/vscode-lean4/src/rpc.js +0 -102
  62. package/dist/monaco-lean4/vscode-lean4/src/taskgutter.d.ts +0 -11
  63. package/dist/monaco-lean4/vscode-lean4/src/taskgutter.js +0 -130
  64. package/dist/monaco-lean4/vscode-lean4/src/utils/batch.d.ts +0 -37
  65. package/dist/monaco-lean4/vscode-lean4/src/utils/batch.js +0 -203
  66. package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.d.ts +0 -41
  67. package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.js +0 -205
  68. package/dist/monaco-lean4/vscode-lean4/src/utils/converters.d.ts +0 -16
  69. package/dist/monaco-lean4/vscode-lean4/src/utils/converters.js +0 -129
  70. package/dist/monaco-lean4/vscode-lean4/src/utils/elan.d.ts +0 -3
  71. package/dist/monaco-lean4/vscode-lean4/src/utils/elan.js +0 -4
  72. package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.d.ts +0 -21
  73. package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.js +0 -53
  74. package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.d.ts +0 -35
  75. package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.js +0 -136
  76. package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.d.ts +0 -17
  77. package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.js +0 -36
  78. package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +0 -37
  79. package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.js +0 -210
  80. package/dist/monaco-lean4/vscode-lean4/src/utils/logger.d.ts +0 -7
  81. package/dist/monaco-lean4/vscode-lean4/src/utils/logger.js +0 -20
  82. package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.d.ts +0 -24
  83. package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.js +0 -110
  84. package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.d.ts +0 -9
  85. package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.js +0 -125
  86. package/dist/useragent.d.ts +0 -1
  87. package/dist/useragent.js +0 -31
  88. package/dist/vscode.css +0 -7
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- /** Returns `[node, isVisible]`. Attach `node` to the dom element you care about as `<div ref={node}>...</div>` and
3
- * `isVisible` will change depending on whether the node is visible in the viewport or not. */
4
- export declare function useIsVisible(): [(element: HTMLElement) => void, boolean];
5
- interface DetailsProps {
6
- initiallyOpen?: boolean;
7
- children: [React.ReactNode, ...React.ReactNode[]];
8
- setOpenRef?: (_: React.Dispatch<React.SetStateAction<boolean>>) => void;
9
- }
10
- /** Like `<details>` but can be programatically revealed using `setOpenRef`. */
11
- export declare function Details({ initiallyOpen, children: [summary, ...children], setOpenRef }: DetailsProps): JSX.Element;
12
- export {};
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import type { Diagnostic } from 'vscode-languageserver-protocol';
3
- import { InfoviewConfig, LeanFileProgressProcessingInfo } from '@leanprover/infoview-api';
4
- import { EditorConnection } from './editorConnection';
5
- import { ServerVersion } from './serverVersion';
6
- export declare const EditorContext: React.Context<EditorConnection>;
7
- export declare const VersionContext: React.Context<ServerVersion | undefined>;
8
- export declare const ConfigContext: React.Context<InfoviewConfig>;
9
- export declare const LspDiagnosticsContext: React.Context<Map<string, Diagnostic[]>>;
10
- export declare const ProgressContext: React.Context<Map<string, LeanFileProgressProcessingInfo[]>>;
@@ -1,22 +0,0 @@
1
- import type { Location } from 'vscode-languageserver-protocol';
2
- import { EditorApi, InfoviewAction, InfoviewActionKind, InfoviewApi, PlainGoal, PlainTermGoal } from '@leanprover/infoview-api';
3
- import { EventEmitter, Eventify } from './event';
4
- import { DocumentPosition } from './util';
5
- export type EditorEvents = Omit<Eventify<InfoviewApi>, 'requestedAction' | 'goToDefinition'> & {
6
- requestedAction: EventEmitter<InfoviewAction, InfoviewActionKind>;
7
- goToDefinition: EventEmitter<string, string>;
8
- };
9
- /** Provides higher-level wrappers around functionality provided by the editor,
10
- * e.g. to insert a comment. See also {@link EditorApi}. */
11
- export declare class EditorConnection {
12
- readonly api: EditorApi;
13
- readonly events: EditorEvents;
14
- constructor(api: EditorApi, events: EditorEvents);
15
- /** Highlights the given range in a document in the editor. */
16
- revealLocation(loc: Location): Promise<void>;
17
- revealPosition(pos: DocumentPosition): Promise<void>;
18
- /** Copies the text to a comment at the cursor position. */
19
- copyToComment(text: string): Promise<void>;
20
- requestPlainGoal(pos: DocumentPosition): Promise<PlainGoal | undefined>;
21
- requestPlainTermGoal(pos: DocumentPosition): Promise<PlainTermGoal | undefined>;
22
- }
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- /** Error boundary as described in https://reactjs.org/docs/error-boundaries.html */
3
- export declare class ErrorBoundary extends React.Component<{
4
- children?: React.ReactNode;
5
- }, {
6
- error: string | undefined;
7
- }> {
8
- constructor(props: {});
9
- static getDerivedStateFromError(error: any): {
10
- error: any;
11
- };
12
- componentDidCatch(error: any, errorInfo: any): void;
13
- render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
14
- }
@@ -1,33 +0,0 @@
1
- import type { Disposable } from 'vscode-languageserver-protocol';
2
- export declare class EventEmitter<E, in out K> {
3
- private freshId;
4
- private handlers;
5
- private handlersWithKey;
6
- current?: E;
7
- /**
8
- * Register a handler that will receive events from this emitter
9
- * and return a closure that removes the handler registration.
10
- *
11
- * If `key` is specified, only events fired with that key
12
- * will be propagated to this handler.
13
- */
14
- on(handler: (_: E) => void, key?: K): Disposable;
15
- /**
16
- * Propagate the event to registered handlers.
17
- *
18
- * The event is propagated to all keyless handlers.
19
- * Furthermore if `key` is provided,
20
- * the event is also propagated to handlers registered with that key.
21
- */
22
- fire(event: E, key?: K): void;
23
- }
24
- type ExcludeNonEvent<T, U> = T extends (...args: any) => Promise<void> ? U : never;
25
- /**
26
- * Turn all fields in `T` which extend `(...args: As) => Promise<void>`
27
- * into event emitter fields `f: EventEmitter<As>`.
28
- * Other fields are removed.
29
- */
30
- export type Eventify<T> = {
31
- [P in keyof T as ExcludeNonEvent<T[P], P>]: T[P] extends (arg: infer A) => Promise<void> ? EventEmitter<A, never> : T[P] extends (...args: infer As) => Promise<void> ? EventEmitter<As, never> : never;
32
- };
33
- export {};
@@ -1,61 +0,0 @@
1
- import { FVarId, MVarId, SubexprPos } from '@leanprover/infoview-api';
2
- import * as React from 'react';
3
- import { HoverState } from './tooltips';
4
- /**
5
- * A location within a goal. It is either:
6
- * - one of the hypotheses; or
7
- * - (a subexpression of) the type of one of the hypotheses; or
8
- * - (a subexpression of) the value of one of the let-bound hypotheses; or
9
- * - (a subexpression of) the goal type. */
10
- export type GoalLocation = {
11
- hyp: FVarId;
12
- } | {
13
- hypType: [FVarId, SubexprPos];
14
- } | {
15
- hypValue: [FVarId, SubexprPos];
16
- } | {
17
- target: SubexprPos;
18
- };
19
- export declare namespace GoalLocation {
20
- function isEqual(l1: GoalLocation, l2: GoalLocation): boolean;
21
- function withSubexprPos(l: GoalLocation, p: SubexprPos): GoalLocation;
22
- }
23
- /**
24
- * A location within a goal state. It identifies a specific goal together with a {@link GoalLocation}
25
- * within it. */
26
- export interface GoalsLocation {
27
- /** Which goal the location is in. */
28
- mvarId: MVarId;
29
- loc: GoalLocation;
30
- }
31
- export declare namespace GoalsLocation {
32
- function isEqual(l1: GoalsLocation, l2: GoalsLocation): boolean;
33
- function withSubexprPos(l: GoalsLocation, p: SubexprPos): GoalsLocation;
34
- }
35
- /**
36
- * An interface available through a React context in components where selecting subexpressions
37
- * makes sense. Currently this is only the goal state display. There, {@link GoalLocation}s can be
38
- * selected. */
39
- export interface Locations {
40
- isSelected: (l: GoalsLocation) => boolean;
41
- setSelected: (l: GoalsLocation, fn: React.SetStateAction<boolean>) => void;
42
- /**
43
- * A template for the location of the current component. It is defined if and only if the current
44
- * component is a subexpression of a selectable expression. We use
45
- * {@link GoalsLocation.withSubexprPos} to map this template to a complete location. */
46
- subexprTemplate?: GoalsLocation;
47
- }
48
- export declare const LocationsContext: React.Context<Locations | undefined>;
49
- type SelectableLocationProps = React.PropsWithoutRef<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>> & {
50
- locs?: Locations;
51
- loc?: GoalsLocation;
52
- alwaysHighlight: boolean;
53
- setHoverState?: React.Dispatch<React.SetStateAction<HoverState>>;
54
- };
55
- /**
56
- * A `<span>` with a corresponding {@link GoalsLocation} which can be (un)selected using shift-click.
57
- * If `locs` or `loc` is `undefined`, selection functionality is turned off. The element is also
58
- * highlighted when hovered over if `alwaysHighlight` is `true` or `locs` and `loc` are both defined.
59
- * `setHoverState` is passed through to {@link DetectHoverSpan}. */
60
- export declare function SelectableLocation(props_: SelectableLocationProps): JSX.Element;
61
- export {};
@@ -1,46 +0,0 @@
1
- import { InfoviewActionKind, InteractiveGoal, InteractiveGoals } from '@leanprover/infoview-api';
2
- import * as React from 'react';
3
- export declare function goalsToString(goals: InteractiveGoals): string;
4
- interface GoalFilterState {
5
- /** If true reverse the list of hypotheses, if false present the order received from LSP. */
6
- reverse: boolean;
7
- /** If true show hypotheses that have isType=True, otherwise hide them. */
8
- showType: boolean;
9
- /** If true show hypotheses that have isInstance=True, otherwise hide them. */
10
- showInstance: boolean;
11
- /** If true show hypotheses that contain a dagger in the name, otherwise hide them. */
12
- showHiddenAssumption: boolean;
13
- /** If true show the bodies of let-values, otherwise hide them. */
14
- showLetValue: boolean;
15
- }
16
- interface GoalProps {
17
- goal: InteractiveGoal;
18
- filter: GoalFilterState;
19
- additionalClassNames: string;
20
- }
21
- /**
22
- * Displays the hypotheses, target type and optional case label of a goal according to the
23
- * provided `filter`. */
24
- export declare const Goal: React.MemoExoticComponent<(props: GoalProps) => import("react/jsx-runtime").JSX.Element>;
25
- interface FilteredGoalsProps {
26
- /** Components to render in the header. */
27
- headerChildren: React.ReactNode;
28
- /**
29
- * When this is `undefined`, the component will not appear at all but will remember its state
30
- * by virtue of still being mounted in the React tree. When it does appear again, the filter
31
- * settings and collapsed state will be as before. */
32
- goals?: InteractiveGoals;
33
- /** Whether or not to display the number of goals. */
34
- displayCount: boolean;
35
- /** Whether the list of goals should be expanded on first render. */
36
- initiallyOpen: boolean;
37
- /** If specified, the display will be toggled (collapsed/expanded) when this action is requested
38
- * by the user. */
39
- togglingAction?: InfoviewActionKind;
40
- }
41
- /**
42
- * Display goals together with a header containing the provided children as well as buttons
43
- * to control how the goals are displayed.
44
- */
45
- export declare const FilteredGoals: React.MemoExoticComponent<({ headerChildren, goals, displayCount, initiallyOpen, togglingAction }: FilteredGoalsProps) => import("react/jsx-runtime").JSX.Element>;
46
- export {};
@@ -1,18 +0,0 @@
1
- import { DocumentPosition } from './util';
2
- type InfoKind = 'cursor' | 'pin';
3
- interface InfoPinnable {
4
- kind: InfoKind;
5
- /** Takes an argument for caching reasons, but should only ever (un)pin itself. */
6
- onPin: (pos: DocumentPosition) => void;
7
- }
8
- /**
9
- * Note: in the cursor view, we have to keep the cursor position as part of the component state
10
- * to avoid flickering when the cursor moved. Otherwise, the component is re-initialised and the
11
- * goal states reset to `undefined` on cursor moves.
12
- */
13
- export type InfoProps = InfoPinnable & {
14
- pos?: DocumentPosition;
15
- };
16
- /** Fetches info from the server and renders an {@link InfoDisplay}. */
17
- export declare function Info(props: InfoProps): import("react/jsx-runtime").JSX.Element;
18
- export {};
@@ -1,2 +0,0 @@
1
- /** Manages and displays pinned infos, as well as info for the current location. */
2
- export declare function Infos(): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +0,0 @@
1
- /// <reference types="react" />
2
- import { SubexprInfo, TaggedText } from '@leanprover/infoview-api';
3
- export interface InteractiveTextComponentProps<T> {
4
- fmt: TaggedText<T>;
5
- }
6
- export interface InteractiveTagProps<T> extends InteractiveTextComponentProps<T> {
7
- tag: T;
8
- }
9
- export interface InteractiveTaggedTextProps<T> extends InteractiveTextComponentProps<T> {
10
- InnerTagUi: (_: InteractiveTagProps<T>) => JSX.Element;
11
- }
12
- /**
13
- * Core loop to display {@link TaggedText} objects. Invokes `InnerTagUi` on `tag` nodes in order to support
14
- * various embedded information, for example subexpression information stored in {@link CodeWithInfos}.
15
- * */
16
- export declare function InteractiveTaggedText<T>({ fmt, InnerTagUi }: InteractiveTaggedTextProps<T>): import("react/jsx-runtime").JSX.Element;
17
- export type InteractiveCodeProps = InteractiveTextComponentProps<SubexprInfo>;
18
- /** Displays a {@link CodeWithInfos} obtained via RPC from the Lean server. */
19
- export declare function InteractiveCode(props: InteractiveCodeProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +0,0 @@
1
- import '@vscode/codicons/dist/codicon.css';
2
- import '@vscode/codicons/dist/codicon.ttf';
3
- import 'tachyons/css/tachyons.css';
4
- import './index.css';
5
- import { EditorApi, InfoviewApi } from '@leanprover/infoview-api';
6
- /**
7
- * Render the Lean infoview into the DOM element `uiElement`.
8
- *
9
- * @param editorApi is a collection of methods which the infoview needs to be able to invoke
10
- * on the editor in order to function correctly (such as inserting text or moving the cursor).
11
- * @returns a collection of methods which must be invoked when the relevant editor events occur.
12
- */
13
- export declare function renderInfoview(editorApi: EditorApi, uiElement: HTMLElement): InfoviewApi;
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
- import { Diagnostic, DocumentUri } from 'vscode-languageserver-protocol';
3
- import { InteractiveDiagnostic } from '@leanprover/infoview-api';
4
- /** Shows the given messages assuming they are for the given file. */
5
- export declare const MessagesList: React.MemoExoticComponent<({ uri, messages }: {
6
- uri: DocumentUri;
7
- messages: InteractiveDiagnostic[];
8
- }) => import("react/jsx-runtime").JSX.Element>;
9
- /** Displays all messages for the specified file. Can be paused. */
10
- export declare function AllMessages({ uri: uri0 }: {
11
- uri: DocumentUri;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- /**
14
- * Provides a `LspDiagnosticsContext` which stores the latest version of the
15
- * diagnostics as sent by the publishDiagnostics notification.
16
- */
17
- export declare function WithLspDiagnosticsContext({ children }: React.PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
18
- /** Embeds a non-interactive diagnostic into the type `InteractiveDiagnostic`. */
19
- export declare function lspDiagToInteractive(diag: Diagnostic): InteractiveDiagnostic;
@@ -1,11 +0,0 @@
1
- import { RpcSessionAtPos } from '@leanprover/infoview-api';
2
- import * as React from 'react';
3
- import type { TextDocumentPositionParams } from 'vscode-languageserver-protocol';
4
- import { DocumentPosition } from './util';
5
- /** Manages a Lean RPC connection by providing an {@link RpcSessionsContext} to the children. */
6
- export declare function WithRpcSessions({ children }: {
7
- children: React.ReactNode;
8
- }): import("react/jsx-runtime").JSX.Element;
9
- export declare function useRpcSessionAtTdpp(pos: TextDocumentPositionParams): RpcSessionAtPos;
10
- export declare function useRpcSessionAtPos(pos: DocumentPosition): RpcSessionAtPos;
11
- export declare const RpcContext: React.Context<RpcSessionAtPos>;
@@ -1,10 +0,0 @@
1
- /**
2
- * Keeps track of the Lean server version and available features.
3
- * @module
4
- */
5
- export declare class ServerVersion {
6
- major: number;
7
- minor: number;
8
- patch: number;
9
- constructor(version: string);
10
- }
@@ -1,32 +0,0 @@
1
- import * as React from 'react';
2
- export type TooltipProps = React.PropsWithChildren<React.HTMLProps<HTMLDivElement>> & {
3
- reference: HTMLElement | null;
4
- };
5
- export declare function Tooltip(props_: TooltipProps): React.ReactPortal;
6
- export declare const WithToggleableTooltip: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLSpanElement> & {
7
- isTooltipShown: boolean;
8
- hideTooltip: () => void;
9
- tooltipChildren: React.ReactNode;
10
- }, "ref"> & React.RefAttributes<HTMLSpanElement>>;
11
- /** Hover state of an element. The pointer can be
12
- * - elsewhere (`off`)
13
- * - over the element (`over`)
14
- * - over the element with Ctrl or Meta (⌘ on Mac) held (`ctrlOver`)
15
- */
16
- export type HoverState = 'off' | 'over' | 'ctrlOver';
17
- /** An element which calls `setHoverState` when the hover state of its DOM children changes.
18
- *
19
- * It is implemented with JS rather than CSS in order to allow nesting of these elements. When nested,
20
- * only the smallest (deepest in the DOM tree) {@link DetectHoverSpan} has an enabled hover state. */
21
- export declare const DetectHoverSpan: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement> & {
22
- setHoverState: React.Dispatch<React.SetStateAction<HoverState>>;
23
- }, "ref"> & React.RefAttributes<HTMLSpanElement>>;
24
- /** Shows a tooltip when the children are hovered over or clicked.
25
- *
26
- * An `onClick` middleware can optionally be given in order to control what happens when the
27
- * hoverable area is clicked. The middleware can invoke `next` to execute the default action
28
- * which is to pin the tooltip open. */
29
- export declare const WithTooltipOnHover: React.ForwardRefExoticComponent<Omit<Omit<React.HTMLProps<HTMLSpanElement>, "onClick"> & {
30
- tooltipChildren: React.ReactNode;
31
- onClick?: ((event: React.MouseEvent<HTMLSpanElement>, next: React.MouseEventHandler<HTMLSpanElement>) => void) | undefined;
32
- }, "ref"> & React.RefAttributes<HTMLSpanElement>>;
@@ -1,11 +0,0 @@
1
- /**
2
- * Traces of any substantial compilation or elaboration process are usually extremely verbose,
3
- * which makes them slow (or even infeasible) to pretty-print and difficult to understand.
4
- * Instead, we provide a "TraceExplorer" UI which allows users to lazily expand trace subtrees,
5
- * and (TODO) execute search queries.
6
- *
7
- * @module
8
- */
9
- import { MsgEmbed } from '@leanprover/infoview-api';
10
- import { InteractiveTextComponentProps } from './interactiveCode';
11
- export declare function InteractiveMessage({ fmt }: InteractiveTextComponentProps<MsgEmbed>): import("react/jsx-runtime").JSX.Element;
@@ -1,39 +0,0 @@
1
- import * as React from 'react';
2
- import { InteractiveGoal, InteractiveTermGoal, RpcSessionAtPos, UserWidgetInstance } from '@leanprover/infoview-api';
3
- import { GoalsLocation } from './goalLocation';
4
- import { DocumentPosition } from './util';
5
- /**
6
- * Fetch source code from Lean and dynamically import it as a JS module.
7
- *
8
- * The source must hash to `hash` (in Lean) and must have been annotated with `@[widget]`
9
- * or `@[widget_module]` at some point before `pos`. */
10
- export declare function importWidgetModule(rs: RpcSessionAtPos, pos: DocumentPosition, hash: string): Promise<any>;
11
- export interface DynamicComponentProps {
12
- pos: DocumentPosition;
13
- hash: string;
14
- props: any;
15
- }
16
- /**
17
- * Use {@link importWidgetModule} to import a module which must `export default` a React component,
18
- * and render that with `props`. Errors in the component are caught in an error boundary. */
19
- export declare function DynamicComponent(props_: React.PropsWithChildren<DynamicComponentProps>): import("react/jsx-runtime").JSX.Element;
20
- interface PanelWidgetDisplayProps {
21
- pos: DocumentPosition;
22
- goals: InteractiveGoal[];
23
- termGoal?: InteractiveTermGoal;
24
- selectedLocations: GoalsLocation[];
25
- widget: UserWidgetInstance;
26
- }
27
- /** Props that every infoview panel widget receives as input to its `default` export. */
28
- export interface PanelWidgetProps {
29
- /** Cursor position in the file at which the widget is being displayed. */
30
- pos: DocumentPosition;
31
- /** The current tactic-mode goals. */
32
- goals: InteractiveGoal[];
33
- /** The current term-mode goal, if any. */
34
- termGoal?: InteractiveTermGoal;
35
- /** Locations currently selected in the goal state. */
36
- selectedLocations: GoalsLocation[];
37
- }
38
- export declare function PanelWidgetDisplay({ pos, goals, termGoal, selectedLocations, widget }: PanelWidgetDisplayProps): import("react/jsx-runtime").JSX.Element;
39
- export {};
@@ -1,144 +0,0 @@
1
- import * as React from 'react';
2
- import type { DocumentUri, Position, Range, TextDocumentPositionParams } from 'vscode-languageserver-protocol';
3
- import { EventEmitter } from './event';
4
- /** A document URI and a position in that document. */
5
- export interface DocumentPosition extends Position {
6
- uri: DocumentUri;
7
- }
8
- export declare namespace DocumentPosition {
9
- function isEqual(p1: DocumentPosition, p2: DocumentPosition): boolean;
10
- function toTdpp(p: DocumentPosition): TextDocumentPositionParams;
11
- function toString(p: DocumentPosition): string;
12
- }
13
- export declare namespace PositionHelpers {
14
- function isLessThanOrEqual(p1: Position, p2: Position): boolean;
15
- }
16
- export declare namespace RangeHelpers {
17
- function contains(range: Range, pos: Position, ignoreCharacter?: boolean): boolean;
18
- }
19
- export declare function escapeHtml(s: string): string;
20
- /** @deprecated (unused) */
21
- export declare function colorizeMessage(goal: string): string;
22
- export declare function basename(path: string): string;
23
- /**
24
- * A specialization of {@link React.useEffect} which executes `f` with the event data
25
- * whenever `ev` fires.
26
- * If `key` is provided, `f` is only invoked on events fired with that key.
27
- */
28
- export declare function useEvent<E, K>(ev: EventEmitter<E, K>, f: (_: E) => void, dependencies?: React.DependencyList, key?: K): void;
29
- /**
30
- * A piece of React {@link React.useState} which returns the data that `ev` most recently fired with.
31
- * If `f` is provided, the data is mapped through `f` first. */
32
- export declare function useEventResult<E, K>(ev: EventEmitter<E, K>): E | undefined;
33
- export declare function useEventResult<E, K, T>(ev: EventEmitter<E, K>, f: (newVal: E) => T): T | undefined;
34
- export declare function useServerNotificationEffect<T>(method: string, f: (params: T) => void, deps?: React.DependencyList): void;
35
- /**
36
- * Returns the same tuple as `setState` such that whenever a server notification with `method`
37
- * arrives at the editor, the state will be updated according to `f`.
38
- */
39
- export declare function useServerNotificationState<S, T>(method: string, initial: S, f: (params: T) => Promise<(state: S) => S>, deps?: React.DependencyList): [S, React.Dispatch<React.SetStateAction<S>>];
40
- export declare function useClientNotificationEffect<T>(method: string, f: (params: T) => void, deps?: React.DependencyList): void;
41
- /**
42
- * Like {@link useServerNotificationState} but for client->server notifications sent by the editor.
43
- */
44
- export declare function useClientNotificationState<S, T>(method: string, initial: S, f: (state: S, params: T) => S, deps?: React.DependencyList): [S, React.Dispatch<React.SetStateAction<S>>];
45
- /** Useful for controlling {@link usePausableState} from child components. */
46
- export interface PausableProps {
47
- isPaused: boolean;
48
- setPaused: React.Dispatch<React.SetStateAction<boolean>>;
49
- }
50
- /**
51
- * Returns `[{ isPaused, setPaused }, tPausable, tRef]` s.t.
52
- * - `[isPaused, setPaused]` are the paused status state
53
- * - for as long as `isPaused` is set, `tPausable` holds its initial value (the `t` passed before pausing)
54
- * rather than updates with changes to `t`.
55
- * - `tRef` can be used to overwrite the paused state
56
- *
57
- * To pause child components, `startPaused` can be passed in their props.
58
- */
59
- export declare function usePausableState<T>(startPaused: boolean, t: T): [PausableProps, T, React.MutableRefObject<T>];
60
- export type Keyed<T> = T & {
61
- key: string;
62
- };
63
- /**
64
- * Adds a unique `key` property to each element in `elems` using
65
- * the values of (possibly non-injective) `getId`.
66
- */
67
- export declare function addUniqueKeys<T>(elems: T[], getId: (el: T) => string): Keyed<T>[];
68
- /** Like `React.forwardRef`, but also allows reading the ref inside the forwarding component.
69
- * Adapted from https://itnext.io/reusing-the-ref-from-forwardref-with-react-hooks-4ce9df693dd */
70
- export declare function forwardAndUseRef<T, P>(render: (props: P, ref: React.RefObject<T>, setRef: (_: T | null) => void) => React.ReactElement | null): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
71
- /** Like `forwardAndUseRef`, but the ref is stored in state so that setting it triggers a render.
72
- * Should only be used if re-rendering is necessary. */
73
- export declare function forwardAndUseStateRef<T, P>(render: (props: P, ref: T | null, setRef: (_: T | null) => void) => React.ReactElement | null): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
74
- export interface LogicalDomElement {
75
- contains(el: Node): boolean;
76
- }
77
- export interface LogicalDomStorage {
78
- /** Registers a descendant in the logical DOM.
79
- * Returns a function which disposes of the registration. */
80
- registerDescendant(el: LogicalDomElement): () => void;
81
- }
82
- export declare const LogicalDomContext: React.Context<LogicalDomStorage>;
83
- /** Suppose a component B appears as a React descendant of the component A. For layout reasons,
84
- * we sometimes don't want B to appear as a descendant of A in the DOM, so we use `createPortal`.
85
- * We may still however want to carry out `contains` checks as if B were there, i.e. according to
86
- * the React tree structure rather than the DOM structure. While React already correctly propagates
87
- * DOM events up the React tree, other functionality such as `contains` is not provided. We provide
88
- * it in this hook.
89
- *
90
- * Accepts a ref to the observed {@link HTMLElement} (A in the example). Returns:
91
- * - a {@link LogicalDomElement} which provides `contains` checks for that {@link HTMLElement}; and
92
- * - a {@link LogicalDomStorage} which MUST be passed to a {@link LogicalDomContext} enclosing
93
- * the observed {@link HTMLElement}.
94
- *
95
- * Additionally, any component which introduces a portal MUST call `registerDescendant` in the
96
- * {@link LogicalDomContext} with a ref to the portalled component (B in the example). */
97
- export declare function useLogicalDomObserver(elt: React.RefObject<HTMLElement>): [LogicalDomElement, LogicalDomStorage];
98
- /**
99
- * An effect which calls `onClickOutside` whenever an element not logically descending from `ld`
100
- * (see {@link useLogicalDomObserver}) is clicked. Note that `onClickOutside` is not called on clicks
101
- * on the scrollbar since these should usually not impact the app's state. */
102
- export declare function useOnClickOutside(ld: LogicalDomElement, onClickOutside: (_: PointerEvent) => void): void;
103
- /** Sends an exception object to a throwable error.
104
- * Maps JSON Rpc errors to throwable errors.
105
- */
106
- export declare function mapRpcError(err: unknown): Error;
107
- /** Catch handler for RPC methods that just returns undefined if the method is not found.
108
- * This is useful for compatibility with versions of Lean that do not yet have the given RPC method.
109
- */
110
- export declare function discardMethodNotFound(e: unknown): undefined;
111
- export type AsyncState<T> = {
112
- state: 'loading';
113
- } | {
114
- state: 'resolved';
115
- value: T;
116
- } | {
117
- state: 'rejected';
118
- error: any;
119
- };
120
- export type AsyncWithTriggerState<T> = {
121
- state: 'notStarted';
122
- } | AsyncState<T>;
123
- export declare function useAsyncWithTrigger<T>(fn: () => Promise<T>, deps?: React.DependencyList): [AsyncWithTriggerState<T>, () => Promise<void>];
124
- /** This React hook will run the given promise function `fn` whenever the deps change
125
- * and use it to update the status and result when the promise resolves.
126
- *
127
- * This function prevents race conditions if the requests resolve in a
128
- * different order to that which they were requested in:
129
- *
130
- * - Request 1 is sent with, say, line=42.
131
- * - Request 2 is sent with line=90.
132
- * - Request 2 returns with diags=[].
133
- * - Request 1 returns with diags=['error'].
134
- *
135
- * Without `useAsync` we would now return the diagnostics for line 42 even though we're at line 90.
136
- *
137
- * When the deps change, the function immediately returns `{ state: 'loading' }`.
138
- */
139
- export declare function useAsync<T>(fn: () => Promise<T>, deps?: React.DependencyList): AsyncState<T>;
140
- /** Like {@link useAsync} but never transitions from `resolved` to `loading` by internally storing
141
- * the latest `resolved` state and continuing to return it while an update is in flight. The lower
142
- * amount of re-renders tends to be less visually jarring.
143
- */
144
- export declare function useAsyncPersistent<T>(fn: () => Promise<T>, deps?: React.DependencyList): AsyncState<T>;
@@ -1,20 +0,0 @@
1
- import 'es-module-shims';
2
- import type { renderInfoview } from './index';
3
- /**
4
- * Dynamically load the infoview module, execute `renderInfoview` with the provided `args`,
5
- * and pass its return value to `next`. See `README.md` for why this is needed.
6
- *
7
- * @param imports is the `imports` section of an [`importmap`](https://github.com/WICG/import-maps).
8
- * It must contain URLs for `@leanprover/infoview`, `react`, `react/jsx-runtime`, `react-dom`,
9
- * It may include additional URLs. The listed libraries become `import`able
10
- * from user widgets. Note that `dist/` already includes these files, so the following works:
11
- * ```js
12
- * {
13
- * '@leanprover/infoview': 'https://unpkg.com/@leanprover/infoview/dist/index.production.min.js',
14
- * 'react': 'https://unpkg.com/@leanprover/infoview/dist/react.production.min.js',
15
- * 'react/jsx-runtime': 'https://unpkg.com/@leanprover/infoview/dist/react-jsx-runtime.production.min.js',
16
- * 'react-dom': 'https://unpkg.com/@leanprover/infoview/dist/react-dom.production.min.js',
17
- * }
18
- * ```
19
- */
20
- export declare function loadRenderInfoview(imports: Record<string, string>, args: Parameters<typeof renderInfoview>, next: (_: ReturnType<typeof renderInfoview>) => void): void;