version 1.0

This commit is contained in:
Nils Burghardt
2025-07-12 19:06:23 +02:00
parent d3af3b6433
commit 61d4a3a1ca
115 changed files with 185766 additions and 95 deletions

View File

@@ -0,0 +1,16 @@
import { ServerMessage } from "./vaadin-dev-tools";
export interface Product {
name: string;
version: string;
}
export interface ProductAndMessage {
message: string;
messageHtml?: string;
product: Product;
}
export declare const findAll: (element: Element | ShadowRoot | Document, tags: string[]) => Element[];
export declare const licenseCheckOk: (data: Product) => void;
export declare const licenseCheckFailed: (data: ProductAndMessage) => void;
export declare const licenseCheckNoKey: (data: ProductAndMessage) => void;
export declare const handleLicenseMessage: (message: ServerMessage) => boolean;
export declare const licenseInit: () => void;

View File

@@ -0,0 +1,15 @@
export declare enum ConnectionStatus {
ACTIVE = "active",
INACTIVE = "inactive",
UNAVAILABLE = "unavailable",
ERROR = "error"
}
export declare abstract class Connection {
static HEARTBEAT_INTERVAL: number;
status: ConnectionStatus;
onHandshake(): void;
onConnectionError(_: string): void;
onStatusChange(_: ConnectionStatus): void;
setActive(yes: boolean): void;
setStatus(status: ConnectionStatus): void;
}

View File

@@ -0,0 +1,8 @@
import { Connection } from './connection.js';
export declare class LiveReloadConnection extends Connection {
webSocket?: WebSocket;
constructor(url: string);
onReload(_strategy: string): void;
handleMessage(msg: any): void;
handleError(msg: any): void;
}

View File

@@ -0,0 +1,99 @@
import { LitElement } from 'lit';
import { Product } from './License';
import { ConnectionStatus } from './connection';
/**
* Plugin API for the dev tools window.
*/
export interface DevToolsInterface {
send(command: string, data: any): void;
}
export interface MessageHandler {
handleMessage(message: ServerMessage): boolean;
}
export interface ServerMessage {
/**
* The command
*/
command: string;
/**
* the data for the command
*/
data: any;
}
/**
* To create and register a plugin, use e.g.
* @example
* export class MyTab extends LitElement implements MessageHandler {
* render() {
* return html`<div>Here I am</div>`;
* }
* }
* customElements.define('my-tab', MyTab);
*
* const plugin: DevToolsPlugin = {
* init: function (devToolsInterface: DevToolsInterface): void {
* devToolsInterface.addTab('Tab title', 'my-tab')
* }
* };
*
* (window as any).Vaadin.devToolsPlugins.push(plugin);
*/
export interface DevToolsPlugin {
/**
* Called once to initialize the plugin.
*
* @param devToolsInterface provides methods to interact with the dev tools
*/
init(devToolsInterface: DevToolsInterface): void;
}
export declare enum MessageType {
LOG = "log",
INFORMATION = "information",
WARNING = "warning",
ERROR = "error"
}
type DevToolsConf = {
enable: boolean;
url: string;
backend?: string;
liveReloadPort: number;
token?: string;
};
export declare class VaadinDevTools extends LitElement {
unhandledMessages: ServerMessage[];
conf: DevToolsConf;
static get styles(): import("lit").CSSResult[];
static DISMISSED_NOTIFICATIONS_IN_LOCAL_STORAGE: string;
static ACTIVE_KEY_IN_SESSION_STORAGE: string;
static TRIGGERED_KEY_IN_SESSION_STORAGE: string;
static TRIGGERED_COUNT_KEY_IN_SESSION_STORAGE: string;
static AUTO_DEMOTE_NOTIFICATION_DELAY: number;
static HOTSWAP_AGENT: string;
static JREBEL: string;
static SPRING_BOOT_DEVTOOLS: string;
static BACKEND_DISPLAY_NAME: Record<string, string>;
static get isActive(): boolean;
frontendStatus: ConnectionStatus;
javaStatus: ConnectionStatus;
private root;
componentPickActive: boolean;
private javaConnection?;
private frontendConnection?;
private nextMessageId;
private transitionDuration;
elementTelemetry(): void;
openWebSocketConnection(): void;
tabHandleMessage(tabElement: HTMLElement, message: ServerMessage): boolean;
handleFrontendMessage(message: ServerMessage): void;
handleHmrMessage(message: ServerMessage): boolean;
getDedicatedWebSocketUrl(): string | undefined;
getSpringBootWebSocketUrl(location: any): string;
connectedCallback(): void;
initPlugin(plugin: DevToolsPlugin): Promise<void>;
format(o: any): string;
checkLicense(productInfo: Product): void;
setActive(yes: boolean): void;
render(): import("lit-html").TemplateResult<1>;
setJavaLiveReloadActive(active: boolean): void;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
import { Connection } from './connection';
export declare class WebSocketConnection extends Connection {
static HEARTBEAT_INTERVAL: number;
socket?: any;
canSend: boolean;
constructor(url: string);
onReload(_strategy: string): void;
onUpdate(_path: string, _content: string): void;
onMessage(_message: any): void;
handleMessage(msg: any): void;
handleError(msg: any): void;
send(command: string, data: any): void;
}