Skip to content

Build your personal knowledge base with Trilium Notes

refactor(codemirror/autocomplete): use common setup for Preact API

Elian Doran975b6366f7ea
diff --git a/apps/client/src/services/frontend_script_api_preact.ts b/apps/client/src/services/frontend_script_api_preact.ts
index 9ce7a52e72..32c0847f13 100644
--- a/apps/client/src/services/frontend_script_api_preact.ts
+++ b/apps/client/src/services/frontend_script_api_preact.ts
@@ -100,3 +100,15 @@ export const preactAPI = Object.freeze({
...hooks,
...triliumHooks
});
+
+// --- Drift guard ------------------------------------------------------------
+// The shared `trilium:preact` component surface lives in @triliumnext/commons
+// (self-contained, consumed by the in-editor language service and the
+// script-deployer). This fails to compile — naming the offending member — if
+// that surface declares a component/helper that's no longer exposed by the real
+// `preactAPI` here. (Preact core + hooks are re-exported straight from `preact`,
+// so they aren't part of the shared surface and aren't checked.)
+type _PublicPreactExports = keyof typeof import("@triliumnext/commons/src/lib/script_api_preact.js");
+type _MissingPreactMembers = Exclude<_PublicPreactExports, keyof typeof preactAPI>;
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+const _preactDriftGuard: [_MissingPreactMembers] extends [never] ? true : _MissingPreactMembers = true;
diff --git a/apps/script-deployer/src/trilium-env.d.ts b/apps/script-deployer/src/trilium-env.d.ts
index 674c3dc8e4..b6c9efa6cd 100644
--- a/apps/script-deployer/src/trilium-env.d.ts
+++ b/apps/script-deployer/src/trilium-env.d.ts
@@ -16,7 +16,6 @@
*/
type FrontendApi = import("@triliumnext/commons/src/lib/script_api").FrontendApi;
-type PreactApi = typeof import("@triliumnext/client/src/services/frontend_script_api_preact").preactAPI;
/**
* `trilium:api` — destructured members of the frontend script API.
@@ -52,61 +51,19 @@ declare module "trilium:api" {
}
/**
- * `trilium:preact` — destructured members of the Preact API surface.
+ * `trilium:preact` — the Preact API surface.
*
- * At runtime the server rewrites `require("trilium:preact")` to
- * `api.preact`, which is the frozen preactAPI object. Scripts
- * destructure from it: `import { useState, h } from "trilium:preact"`.
+ * At runtime the server rewrites `require("trilium:preact")` to `api.preact`
+ * (the frozen `preactAPI` object). Scripts destructure from it:
+ * `import { useState, h, Button } from "trilium:preact"`. Preact core + hooks
+ * come straight from the real `preact` package; the Trilium components and
+ * `defineWidget` come from the shared, drift-guarded surface in commons — the
+ * same definition the in-editor language service uses.
*/
declare module "trilium:preact" {
- export const {
- // Core
- h,
- Fragment,
- createContext,
- defineWidget,
- defineLauncherWidget,
-
- // Hooks
- useCallback,
- useContext,
- useEffect,
- useLayoutEffect,
- useMemo,
- useReducer,
- useRef,
- useState,
-
- // Built-in components
- ActionButton,
- Admonition,
- Button,
- CKEditor,
- Collapsible,
- Dropdown,
- FormCheckbox,
- FormDropdownList,
- FormFileUploadButton,
- FormFileUploadActionButton,
- FormGroup,
- FormListItem,
- FormDropdownDivider,
- FormDropdownSubmenu,
- FormRadioGroup,
- FormText,
- FormTextArea,
- FormTextBox,
- FormToggle,
- Icon,
- LinkButton,
- LoadingSpinner,
- Modal,
- NoteAutocomplete,
- NoteLink,
- RawHtml,
- Slider,
- RightPanelWidget,
- }: PreactApi;
+ export * from "preact";
+ export * from "preact/hooks";
+ export * from "@triliumnext/commons/src/lib/script_api_preact";
}
/**
diff --git a/packages/codemirror/src/type_completion/preact_types.ts b/packages/codemirror/src/type_completion/preact_types.ts
index e0518aac2d..250121788e 100644
--- a/packages/codemirror/src/type_completion/preact_types.ts
+++ b/packages/codemirror/src/type_completion/preact_types.ts
@@ -18,6 +18,10 @@ import jsxRuntime from "../../../../node_modules/preact/jsx-runtime/src/index.d.
import preactDom from "../../../../node_modules/preact/src/dom.d.ts?raw";
import preactIndex from "../../../../node_modules/preact/src/index.d.ts?raw";
import preactJsx from "../../../../node_modules/preact/src/jsx.d.ts?raw";
+// The Trilium-specific `trilium:preact` surface (components + defineWidget) is the
+// shared single source of truth in commons — the same definition the script-deployer
+// uses, drift-guarded against the real `preactAPI`.
+import triliumPreactSurface from "../../../commons/src/lib/script_api_preact.ts?raw";
/**
* Minimal `package.json` shims so the vfs's node10 module resolution finds each
@@ -46,375 +50,22 @@ export const preactVfsFiles: Record<string, string> = {
"/node_modules/preact/jsx-runtime/src/index.d.ts": jsxRuntime
};
+// The shared surface uses `export declare const`/`function` (valid as a standalone
+// module). Inside an ambient `declare module` block the `declare` modifier is
+// redundant and disallowed, so strip it when wrapping.
+const triliumPreactBody = triliumPreactSurface.replace(/^export declare /gm, "export ");
+
/**
- * Ambient declarations for the bare-specifier imports a JSX render note uses.
- *
- * - `trilium:preact` mirrors the runtime `api.preact` surface: it re-exports
- * Preact core + all hooks, plus Trilium's `defineWidget`/`defineLauncherWidget`
- * and the bundled UI components with curated prop types. Following
- * `script_api.ts`'s philosophy, the genuinely useful props (enums, flags,
- * callbacks) are typed precisely while references into the heavy client widget
- * graph (editor instances, bootstrap options, note view scopes, …) are
- * loosened to `unknown`/`Record` rather than dragging in their real types.
+ * Ambient declarations for the bare-specifier imports a JSX render note uses:
+ * - `trilium:preact` re-exports Preact core + all hooks from the real package,
+ * plus the shared Trilium component surface (`@triliumnext/commons`).
* - `trilium:api` exposes the same object as the `api` global.
*/
export const triliumModulesDts = `
declare module "trilium:preact" {
- import type { ComponentChild, ComponentChildren, FunctionComponent, RefObject, VNode } from "preact";
export * from "preact";
export * from "preact/hooks";
-
- /** A CSS style object (loose: property names are not validated). */
- type Css = Record<string, string | number>;
- /** A Trilium command name (loosened from the client's \`CommandNames\` union). */
- type Cmd = string;
-
- export interface WidgetDefinition {
- parent: "right-pane";
- render: () => VNode;
- position?: number;
- }
- export function defineWidget(definition: WidgetDefinition): WidgetDefinition & { type: "preact-widget" };
- export function defineLauncherWidget(definition: { render: () => VNode }): { type: "preact-launcher-widget"; render: () => VNode };
-
- export interface ActionButtonProps {
- text: string;
- icon: string;
- className?: string;
- titlePosition?: "top" | "right" | "bottom" | "left";
- triggerCommand?: Cmd;
- noIconActionClass?: boolean;
- frame?: boolean;
- active?: boolean;
- disabled?: boolean;
- onClick?: (e: MouseEvent) => void;
- onAuxClick?: (e: MouseEvent) => void;
- onContextMenu?: (e: MouseEvent) => void;
- style?: Css;
- }
- export const ActionButton: FunctionComponent<ActionButtonProps>;
-
- export interface AdmonitionProps {
- type: "warning" | "note" | "caution";
- children?: ComponentChildren;
- className?: string;
- style?: Css;
- }
- export const Admonition: FunctionComponent<AdmonitionProps>;
-
- export interface ButtonProps {
- text: string;
- name?: string;
- buttonRef?: RefObject<HTMLButtonElement>;
- className?: string;
- icon?: string;
- keyboardShortcut?: string;
- onClick?: () => void;
- kind?: "primary" | "secondary" | "lowProfile";
- disabled?: boolean;
- size?: "normal" | "small" | "micro";
- style?: Css;
- triggerCommand?: Cmd;
- title?: string;
- }
- export const Button: FunctionComponent<ButtonProps>;
-
- export interface CKEditorApi {
- focus(): void;
- setText(text: string): void;
- }
- export interface CKEditorProps {
- apiRef: RefObject<CKEditorApi | undefined>;
- currentValue?: string;
- className: string;
- tabIndex?: number;
- config: unknown;
- editor: unknown;
- disableNewlines?: boolean;
- disableSpellcheck?: boolean;
- onChange?: (newValue?: string) => void;
- onClick?: (e: MouseEvent, pos?: unknown) => void;
- onKeyDown?: (e: KeyboardEvent) => void;
- onBlur?: () => void;
- onInitialized?: (editorInstance: unknown) => void;
- }
- export const CKEditor: FunctionComponent<CKEditorProps>;
-
- export interface CollapsibleProps {
- title: string;
- children?: ComponentChildren;
- initiallyExpanded?: boolean;
- className?: string;
- }
- export const Collapsible: FunctionComponent<CollapsibleProps>;
-
- export interface DropdownProps {
- id?: string;
- className?: string;
- buttonClassName?: string;
- buttonProps?: Record<string, unknown>;
- isStatic?: boolean;
- children?: ComponentChildren;
- title?: string;
- dropdownContainerStyle?: Css;
- dropdownContainerClassName?: string;
- dropdownContainerRef?: RefObject<HTMLDivElement | null>;
- hideToggleArrow?: boolean;
- iconAction?: boolean;
- noSelectButtonStyle?: boolean;
- noDropdownListStyle?: boolean;
- disabled?: boolean;
- text?: ComponentChildren;
- forceShown?: boolean;
- onShown?: () => void;
- onHidden?: () => void;
- dropdownOptions?: Record<string, unknown>;
- dropdownRef?: RefObject<unknown>;
- titlePosition?: "top" | "right" | "bottom" | "left";
- titleOptions?: Record<string, unknown>;
- mobileBackdrop?: boolean;
- }
- export const Dropdown: FunctionComponent<DropdownProps>;
-
- export interface FormCheckboxProps {
- name?: string;
- label: ComponentChildren;
- hint?: string;
- currentValue: boolean;
- disabled?: boolean;
- onChange(newValue: boolean): void;
- containerStyle?: Css;
- }
- export const FormCheckbox: FunctionComponent<FormCheckboxProps>;
-
- export interface FormDropdownListProps<T> extends Omit<DropdownProps, "children"> {
- values: T[];
- keyProperty: keyof T;
- titleProperty: keyof T;
- titleSuffixProperty?: keyof T;
- descriptionProperty?: keyof T;
- currentValue: string;
- onChange(newValue: string): void;
- }
- export function FormDropdownList<T>(props: FormDropdownListProps<T>): VNode<any>;
-
- export const FormFileUploadButton: FunctionComponent<Omit<ButtonProps, "onClick"> & { onChange: (files: FileList | null) => void }>;
- export const FormFileUploadActionButton: FunctionComponent<Omit<ActionButtonProps, "onClick"> & { onChange: (files: FileList | null) => void }>;
-
- export interface FormGroupProps {
- name: string;
- labelRef?: RefObject<HTMLLabelElement>;
- label?: string;
- title?: string;
- className?: string;
- error?: string;
- children: VNode<any>;
- description?: ComponentChildren;
- disabled?: boolean;
- style?: Css;
- }
- export const FormGroup: FunctionComponent<FormGroupProps>;
-
- export interface FormListItemProps {
- children?: ComponentChildren;
- icon?: string;
- value?: string;
- title?: string;
- active?: boolean;
- badges?: unknown[];
- disabled?: boolean;
- disabledTooltip?: string;
- checked?: boolean | null;
- selected?: boolean;
- container?: boolean;
- onClick?: (e: MouseEvent) => void;
- triggerCommand?: Cmd;
- description?: string;
- className?: string;
- rtl?: boolean;
- postContent?: ComponentChildren;
- itemRef?: RefObject<HTMLLIElement>;
- }
- export const FormListItem: FunctionComponent<FormListItemProps>;
-
- export const FormDropdownDivider: FunctionComponent<{}>;
-
- export interface FormDropdownSubmenuProps {
- icon: string;
- title: ComponentChildren;
- children?: ComponentChildren;
- onDropdownToggleClicked?: () => void;
- dropStart?: boolean;
- }
- export const FormDropdownSubmenu: FunctionComponent<FormDropdownSubmenuProps>;
-
- export interface FormRadioGroupProps {
- name: string;
- currentValue?: string;
- values: ({ value: string; label: ComponentChildren; inlineDescription?: ComponentChildren } | false)[];
- onChange(newValue: string): void;
- }
- export const FormRadioGroup: FunctionComponent<FormRadioGroupProps>;
-
- export const FormText: FunctionComponent<{ children?: ComponentChildren }>;
-
- export interface FormTextAreaProps {
- id?: string;
- currentValue: string;
- onChange?(newValue: string): void;
- onBlur?(newValue: string): void;
- inputRef?: RefObject<HTMLTextAreaElement>;
- className?: string;
- placeholder?: string;
- rows?: number;
- disabled?: boolean;
- readOnly?: boolean;
- }
- export const FormTextArea: FunctionComponent<FormTextAreaProps>;
-
- export interface FormTextBoxProps {
- id?: string;
- currentValue?: string;
- onChange?(newValue: string, validity: ValidityState): void;
- onBlur?(newValue: string): void;
- inputRef?: RefObject<HTMLInputElement>;
- type?: string;
- className?: string;
- placeholder?: string;
- disabled?: boolean;
- readOnly?: boolean;
- autoFocus?: boolean;
- name?: string;
- }
- export const FormTextBox: FunctionComponent<FormTextBoxProps>;
-
- export interface FormToggleProps {
- currentValue: boolean | null;
- onChange(newValue: boolean): void;
- switchOnName?: string;
- switchOnTooltip?: string;
- switchOffName?: string;
- switchOffTooltip?: string;
- helpPage?: string;
- disabled?: boolean;
- afterName?: ComponentChildren;
- id?: string;
- }
- export const FormToggle: FunctionComponent<FormToggleProps>;
-
- export interface IconProps {
- icon?: string;
- className?: string;
- onClick?: (e: MouseEvent) => void;
- title?: string;
- style?: Css;
- }
- export const Icon: FunctionComponent<IconProps>;
-
- export interface LinkButtonProps {
- onClick?: () => void;
- text: ComponentChild;
- triggerCommand?: Cmd;
- }
- export const LinkButton: FunctionComponent<LinkButtonProps>;
-
- export const LoadingSpinner: FunctionComponent<{}>;
-
- export interface ModalProps {
- className: string;
- title?: ComponentChildren;
- customTitleBarButtons?: ({ title: string; iconClassName: string; onClick: (e: MouseEvent) => void } | null)[];
- size: "xl" | "lg" | "md" | "sm";
- children?: ComponentChildren;
- header?: ComponentChildren;
- footer?: ComponentChildren;
- footerStyle?: Css;
- footerAlignment?: "right" | "between";
- minWidth?: string;
- maxWidth?: number;
- zIndex?: number;
- scrollable?: boolean;
- onSubmit?: () => void;
- onShown?: () => void;
- onHidden: () => void;
- helpPageId?: string;
- modalRef?: RefObject<HTMLDivElement>;
- formRef?: RefObject<HTMLFormElement>;
- bodyStyle?: Css;
- show: boolean;
- stackable?: boolean;
- keepInDom?: boolean;
- noFocus?: boolean;
- sidebar?: ComponentChildren;
- isFullPageOnMobile?: boolean;
- }
- export const Modal: FunctionComponent<ModalProps>;
-
- export interface NoteAutocompleteProps {
- id?: string;
- inputRef?: RefObject<HTMLInputElement>;
- text?: string;
- placeholder?: string;
- container?: RefObject<HTMLElement | null | undefined>;
- containerStyle?: Css;
- opts?: Record<string, unknown>;
- onChange?: (suggestion: unknown) => void;
- onTextChange?: (text: string) => void;
- onKeyDown?: (e: KeyboardEvent) => void;
- onBlur?: (newValue: string) => void;
- noteIdChanged?: (noteId: string) => void;
- noteId?: string;
- }
- export const NoteAutocomplete: FunctionComponent<NoteAutocompleteProps>;
-
- export interface NoteLinkProps {
- className?: string;
- containerClassName?: string;
- notePath: string | string[];
- showNotePath?: boolean;
- showNoteIcon?: boolean;
- style?: Css;
- noPreview?: boolean;
- noTnLink?: boolean;
- highlightedTokens?: string[] | null;
- title?: string;
- viewScope?: unknown;
- noContextMenu?: boolean;
- onContextMenu?: (e: MouseEvent) => void;
- }
- export const NoteLink: FunctionComponent<NoteLinkProps>;
-
- export interface RawHtmlProps {
- className?: string;
- html?: string | HTMLElement;
- style?: Css;
- onClick?: (e: MouseEvent) => void;
- tabindex?: number;
- dir?: string;
- containerRef?: RefObject<HTMLSpanElement>;
- }
- export const RawHtml: FunctionComponent<RawHtmlProps>;
-
- export interface SliderProps {
- value: number;
- onChange(newValue: number): void;
- min?: number;
- max?: number;
- step?: number;
- title?: string;
- }
- export const Slider: FunctionComponent<SliderProps>;
-
- export interface RightPanelWidgetProps {
- id: string;
- title: string;
- children?: ComponentChildren;
- buttons?: ComponentChildren;
- containerRef?: RefObject<HTMLDivElement>;
- contextMenuItems?: unknown[];
- grow?: boolean;
- }
- export const RightPanelWidget: FunctionComponent<RightPanelWidgetProps>;
+${triliumPreactBody}
}
declare module "trilium:api" {
diff --git a/packages/commons/package.json b/packages/commons/package.json
index fe6fdc3585..1076168675 100644
--- a/packages/commons/package.json
+++ b/packages/commons/package.json
@@ -21,5 +21,8 @@
"marked": "18.0.4",
"marked-footnote": "1.4.0",
"numfmt": "3.2.6"
+ },
+ "devDependencies": {
+ "preact": "10.29.2"
}
}
\ No newline at end of file
diff --git a/packages/commons/src/lib/script_api_preact.ts b/packages/commons/src/lib/script_api_preact.ts
new file mode 100644
index 0000000000..18679fc13c
--- /dev/null
+++ b/packages/commons/src/lib/script_api_preact.ts
@@ -0,0 +1,374 @@
+/**
+ * Public type surface for the **Preact API** available to JSX render notes via
+ * `import { … } from "trilium:preact"` (which the server rewrites to `api.preact`
+ * at runtime).
+ *
+ * Single source of truth shared by the in-editor language service and the
+ * `script-deployer`, mirroring `script_api.ts`. Following the same philosophy,
+ * the genuinely useful props (enums, flags, callbacks) are typed precisely while
+ * references into the heavy client widget graph (editor instances, bootstrap
+ * options, note view scopes, …) are loosened to `unknown`/`Record`.
+ *
+ * Preact core (`h`, `Fragment`, …) and the hooks are NOT declared here — the
+ * consumers re-export them straight from the real `preact` / `preact/hooks`
+ * packages. This module only declares the Trilium-specific surface
+ * (`defineWidget` + the bundled UI components), kept honest against the real
+ * `preactAPI` by a drift guard in `frontend_script_api_preact.ts`.
+ *
+ * Components are `export declare const` (ambient — no runtime value); prop types
+ * are intentionally module-private so the only *value* exports are the runtime
+ * members, which keeps the drift guard's `keyof typeof` clean.
+ */
+import type { ComponentChild, ComponentChildren, FunctionComponent, RefObject, VNode } from "preact";
+
+/** A CSS style object (loose: property names are not validated). */
+type Css = Record<string, string | number>;
+/** A Trilium command name (loosened from the client's `CommandNames` union). */
+type Cmd = string;
+
+interface WidgetDefinition {
+ parent: "right-pane";
+ render: () => VNode;
+ position?: number;
+}
+export declare function defineWidget(definition: WidgetDefinition): WidgetDefinition & { type: "preact-widget" };
+export declare function defineLauncherWidget(definition: { render: () => VNode }): { type: "preact-launcher-widget"; render: () => VNode };
+
+interface ActionButtonProps {
+ text: string;
+ icon: string;
+ className?: string;
+ titlePosition?: "top" | "right" | "bottom" | "left";
+ triggerCommand?: Cmd;
+ noIconActionClass?: boolean;
+ frame?: boolean;
+ active?: boolean;
+ disabled?: boolean;
+ onClick?: (e: MouseEvent) => void;
+ onAuxClick?: (e: MouseEvent) => void;
+ onContextMenu?: (e: MouseEvent) => void;
+ style?: Css;
+}
+export declare const ActionButton: FunctionComponent<ActionButtonProps>;
+
+interface AdmonitionProps {
+ type: "warning" | "note" | "caution";
+ children?: ComponentChildren;
+ className?: string;
+ style?: Css;
+}
+export declare const Admonition: FunctionComponent<AdmonitionProps>;
+
+interface ButtonProps {
+ text: string;
+ name?: string;
+ buttonRef?: RefObject<HTMLButtonElement>;
+ className?: string;
+ icon?: string;
+ keyboardShortcut?: string;
+ onClick?: () => void;
+ kind?: "primary" | "secondary" | "lowProfile";
+ disabled?: boolean;
+ size?: "normal" | "small" | "micro";
+ style?: Css;
+ triggerCommand?: Cmd;
+ title?: string;
+}
+export declare const Button: FunctionComponent<ButtonProps>;
+
+interface CKEditorApi {
+ focus(): void;
+ setText(text: string): void;
+}
+interface CKEditorProps {
+ apiRef: RefObject<CKEditorApi | undefined>;
+ currentValue?: string;
+ className: string;
+ tabIndex?: number;
+ config: unknown;
+ editor: unknown;
+ disableNewlines?: boolean;
+ disableSpellcheck?: boolean;
+ onChange?: (newValue?: string) => void;
+ onClick?: (e: MouseEvent, pos?: unknown) => void;
+ onKeyDown?: (e: KeyboardEvent) => void;
+ onBlur?: () => void;
+ onInitialized?: (editorInstance: unknown) => void;
+}
+export declare const CKEditor: FunctionComponent<CKEditorProps>;
+
+interface CollapsibleProps {
+ title: string;
+ children?: ComponentChildren;
+ initiallyExpanded?: boolean;
+ className?: string;
+}
+export declare const Collapsible: FunctionComponent<CollapsibleProps>;
+
+interface DropdownProps {
+ id?: string;
+ className?: string;
+ buttonClassName?: string;
+ buttonProps?: Record<string, unknown>;
+ isStatic?: boolean;
+ children?: ComponentChildren;
+ title?: string;
+ dropdownContainerStyle?: Css;
+ dropdownContainerClassName?: string;
+ dropdownContainerRef?: RefObject<HTMLDivElement | null>;
+ hideToggleArrow?: boolean;
+ iconAction?: boolean;
+ noSelectButtonStyle?: boolean;
+ noDropdownListStyle?: boolean;
+ disabled?: boolean;
+ text?: ComponentChildren;
+ forceShown?: boolean;
+ onShown?: () => void;
+ onHidden?: () => void;
+ dropdownOptions?: Record<string, unknown>;
+ dropdownRef?: RefObject<unknown>;
+ titlePosition?: "top" | "right" | "bottom" | "left";
+ titleOptions?: Record<string, unknown>;
+ mobileBackdrop?: boolean;
+}
+export declare const Dropdown: FunctionComponent<DropdownProps>;
+
+interface FormCheckboxProps {
+ name?: string;
+ label: ComponentChildren;
+ hint?: string;
+ currentValue: boolean;
+ disabled?: boolean;
+ onChange(newValue: boolean): void;
+ containerStyle?: Css;
+}
+export declare const FormCheckbox: FunctionComponent<FormCheckboxProps>;
+
+interface FormDropdownListProps<T> extends Omit<DropdownProps, "children"> {
+ values: T[];
+ keyProperty: keyof T;
+ titleProperty: keyof T;
+ titleSuffixProperty?: keyof T;
+ descriptionProperty?: keyof T;
+ currentValue: string;
+ onChange(newValue: string): void;
+}
+export declare function FormDropdownList<T>(props: FormDropdownListProps<T>): VNode<any>;
+
+export declare const FormFileUploadButton: FunctionComponent<Omit<ButtonProps, "onClick"> & { onChange: (files: FileList | null) => void }>;
+export declare const FormFileUploadActionButton: FunctionComponent<Omit<ActionButtonProps, "onClick"> & { onChange: (files: FileList | null) => void }>;
+
+interface FormGroupProps {
+ name: string;
+ labelRef?: RefObject<HTMLLabelElement>;
+ label?: string;
+ title?: string;
+ className?: string;
+ error?: string;
+ children: VNode<any>;
+ description?: ComponentChildren;
+ disabled?: boolean;
+ style?: Css;
+}
+export declare const FormGroup: FunctionComponent<FormGroupProps>;
+
+interface FormListItemProps {
+ children?: ComponentChildren;
+ icon?: string;
+ value?: string;
+ title?: string;
+ active?: boolean;
+ badges?: unknown[];
+ disabled?: boolean;
+ disabledTooltip?: string;
+ checked?: boolean | null;
+ selected?: boolean;
+ container?: boolean;
+ onClick?: (e: MouseEvent) => void;
+ triggerCommand?: Cmd;
+ description?: string;
+ className?: string;
+ rtl?: boolean;
+ postContent?: ComponentChildren;
+ itemRef?: RefObject<HTMLLIElement>;
+}
+export declare const FormListItem: FunctionComponent<FormListItemProps>;
+
+export declare const FormDropdownDivider: FunctionComponent<{}>;
+
+interface FormDropdownSubmenuProps {
+ icon: string;
+ title: ComponentChildren;
+ children?: ComponentChildren;
+ onDropdownToggleClicked?: () => void;
+ dropStart?: boolean;
+}
+export declare const FormDropdownSubmenu: FunctionComponent<FormDropdownSubmenuProps>;
+
+interface FormRadioGroupProps {
+ name: string;
+ currentValue?: string;
+ values: ({ value: string; label: ComponentChildren; inlineDescription?: ComponentChildren } | false)[];
+ onChange(newValue: string): void;
+}
+export declare const FormRadioGroup: FunctionComponent<FormRadioGroupProps>;
+
+export declare const FormText: FunctionComponent<{ children?: ComponentChildren }>;
+
+interface FormTextAreaProps {
+ id?: string;
+ currentValue: string;
+ onChange?(newValue: string): void;
+ onBlur?(newValue: string): void;
+ inputRef?: RefObject<HTMLTextAreaElement>;
+ className?: string;
+ placeholder?: string;
+ rows?: number;
+ disabled?: boolean;
+ readOnly?: boolean;
+}
+export declare const FormTextArea: FunctionComponent<FormTextAreaProps>;
+
+interface FormTextBoxProps {
+ id?: string;
+ currentValue?: string;
+ onChange?(newValue: string, validity: ValidityState): void;
+ onBlur?(newValue: string): void;
+ inputRef?: RefObject<HTMLInputElement>;
+ type?: string;
+ className?: string;
+ placeholder?: string;
+ disabled?: boolean;
+ readOnly?: boolean;
+ autoFocus?: boolean;
+ name?: string;
+}
+export declare const FormTextBox: FunctionComponent<FormTextBoxProps>;
+
+interface FormToggleProps {
+ currentValue: boolean | null;
+ onChange(newValue: boolean): void;
+ switchOnName?: string;
+ switchOnTooltip?: string;
+ switchOffName?: string;
+ switchOffTooltip?: string;
+ helpPage?: string;
+ disabled?: boolean;
+ afterName?: ComponentChildren;
+ id?: string;
+}
+export declare const FormToggle: FunctionComponent<FormToggleProps>;
+
+interface IconProps {
+ icon?: string;
+ className?: string;
+ onClick?: (e: MouseEvent) => void;
+ title?: string;
+ style?: Css;
+}
+export declare const Icon: FunctionComponent<IconProps>;
+
+interface LinkButtonProps {
+ onClick?: () => void;
+ text: ComponentChild;
+ triggerCommand?: Cmd;
+}
+export declare const LinkButton: FunctionComponent<LinkButtonProps>;
+
+export declare const LoadingSpinner: FunctionComponent<{}>;
+
+interface ModalProps {
+ className: string;
+ title?: ComponentChildren;
+ customTitleBarButtons?: ({ title: string; iconClassName: string; onClick: (e: MouseEvent) => void } | null)[];
+ size: "xl" | "lg" | "md" | "sm";
+ children?: ComponentChildren;
+ header?: ComponentChildren;
+ footer?: ComponentChildren;
+ footerStyle?: Css;
+ footerAlignment?: "right" | "between";
+ minWidth?: string;
+ maxWidth?: number;
+ zIndex?: number;
+ scrollable?: boolean;
+ onSubmit?: () => void;
+ onShown?: () => void;
+ onHidden: () => void;
+ helpPageId?: string;
+ modalRef?: RefObject<HTMLDivElement>;
+ formRef?: RefObject<HTMLFormElement>;
+ bodyStyle?: Css;
+ show: boolean;
+ stackable?: boolean;
+ keepInDom?: boolean;
+ noFocus?: boolean;
+ sidebar?: ComponentChildren;
+ isFullPageOnMobile?: boolean;
+}
+export declare const Modal: FunctionComponent<ModalProps>;
+
+interface NoteAutocompleteProps {
+ id?: string;
+ inputRef?: RefObject<HTMLInputElement>;
+ text?: string;
+ placeholder?: string;
+ container?: RefObject<HTMLElement | null | undefined>;
+ containerStyle?: Css;
+ opts?: Record<string, unknown>;
+ onChange?: (suggestion: unknown) => void;
+ onTextChange?: (text: string) => void;
+ onKeyDown?: (e: KeyboardEvent) => void;
+ onBlur?: (newValue: string) => void;
+ noteIdChanged?: (noteId: string) => void;
+ noteId?: string;
+}
+export declare const NoteAutocomplete: FunctionComponent<NoteAutocompleteProps>;
+
+interface NoteLinkProps {
+ className?: string;
+ containerClassName?: string;
+ notePath: string | string[];
+ showNotePath?: boolean;
+ showNoteIcon?: boolean;
+ style?: Css;
+ noPreview?: boolean;
+ noTnLink?: boolean;
+ highlightedTokens?: string[] | null;
+ title?: string;
+ viewScope?: unknown;
+ noContextMenu?: boolean;
+ onContextMenu?: (e: MouseEvent) => void;
+}
+export declare const NoteLink: FunctionComponent<NoteLinkProps>;
+
+interface RawHtmlProps {
+ className?: string;
+ html?: string | HTMLElement;
+ style?: Css;
+ onClick?: (e: MouseEvent) => void;
+ tabindex?: number;
+ dir?: string;
+ containerRef?: RefObject<HTMLSpanElement>;
+}
+export declare const RawHtml: FunctionComponent<RawHtmlProps>;
+
+interface SliderProps {
+ value: number;
+ onChange(newValue: number): void;
+ min?: number;
+ max?: number;
+ step?: number;
+ title?: string;
+}
+export declare const Slider: FunctionComponent<SliderProps>;
+
+interface RightPanelWidgetProps {
+ id: string;
+ title: string;
+ children?: ComponentChildren;
+ buttons?: ComponentChildren;
+ containerRef?: RefObject<HTMLDivElement>;
+ contextMenuItems?: unknown[];
+ grow?: boolean;
+}
+export declare const RightPanelWidget: FunctionComponent<RightPanelWidgetProps>;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e87308924e..b5e83327dd 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1550,6 +1550,10 @@ importers:
numfmt:
specifier: 3.2.6
version: 3.2.6
+ devDependencies:
+ preact:
+ specifier: 10.29.2
+ version: 10.29.2
packages/express-partial-content: {}