/* auto-generated by NAPI-RS */
/* eslint-disable */

export declare class ExternalObject<T> {
  readonly '': {
    readonly '': unique symbol
    [K: symbol]: T
  }
}
/**
 * ComponentCompiler is the entry point to the Slint interpreter that can be used
 * to load .slint files or compile them on-the-fly from a string.
 */
export declare class ComponentCompiler {
  /** Returns a new ComponentCompiler. */
  constructor()
  set includePaths(includePaths: Array<string>)
  get includePaths(): Array<string>
  set libraryPaths(paths: Record<string, string>)
  get libraryPaths(): Record<string, string>
  set style(style: string)
  get style(): string | null
  get diagnostics(): Array<Diagnostic>
  get structs(): Record<string, unknown>
  get enums(): Record<string, unknown>
  set fileLoader(callback: DynFunction)
  /**
   * Compile a .slint file into a ComponentDefinition
   *
   * Returns the compiled `ComponentDefinition` if there were no errors.
   */
  buildFromPath(path: string): Record<string, JsComponentDefinition>
  /** Compile some .slint code into a ComponentDefinition */
  buildFromSource(sourceCode: string, path: string): Record<string, JsComponentDefinition>
}
export type JsComponentCompiler = ComponentCompiler

export declare class ComponentDefinition {
  constructor()
  get properties(): Array<JsProperty>
  get callbacks(): Array<string>
  get functions(): Array<string>
  get globals(): Array<string>
  globalProperties(globalName: string): Array<JsProperty> | null
  globalCallbacks(globalName: string): Array<string> | null
  globalFunctions(globalName: string): Array<string> | null
  create(): JsComponentInstance
  get name(): string
  get isWindow(): boolean
}
export type JsComponentDefinition = ComponentDefinition

export declare class ComponentInstance {
  constructor()
  definition(): ComponentDefinition
  getProperty(name: string): unknown
  setProperty(this: object, propName: string, jsValue: unknown): void
  getGlobalProperty(globalName: string, name: string): unknown
  setGlobalProperty(this: object, globalName: string, propName: string, jsValue: unknown): void
  setCallback(this: object, callbackName: string, callback: DynFunction): void
  setGlobalCallback(this: object, globalName: string, callbackName: string, callback: DynFunction): void
  invoke(this: object, callbackName: string, callbackArguments: Array<unknown>): unknown
  invokeGlobal(this: object, globalName: string, callbackName: string, callbackArguments: Array<unknown>): unknown
  sendMouseClick(x: number, y: number): void
  sendKeyboardStringSequence(sequence: string): void
  sendKeyCombo(keys: Array<string>): void
  window(): JsWindow
}
export type JsComponentInstance = ComponentInstance

/**
 * Represents some form of type-indexed possibly-lazy data transfer.
 *
 * Used for accessing the platform clipboard and drag-and-drop APIs.
 */
export declare class DataTransfer {
  /** Constructs an empty `DataTransfer`. */
  constructor()
  /**
   * The plain text representation of this `DataTransfer`, or `null` if no
   * plain text is available.
   */
  get plainText(): string | null
  /**
   * Sets the plain text representation of this `DataTransfer`. Assigning
   * `null`, `undefined`, or the empty string clears any previously-set
   * plain text; assigning any other string overwrites it.
   */
  set plainText(text: string | undefined | null)
  /** `true` if this `DataTransfer` advertises a plain text representation. */
  get hasPlainText(): boolean
  /**
   * The image representation of this `DataTransfer`, or `null` if no
   * image is available.
   */
  get image(): SlintImageData | null
  /**
   * Sets the image representation of this `DataTransfer`. Assigning `null`
   * or `undefined` clears any previously-set image; assigning any other
   * image overwrites it.
   */
  set image(image: SlintImageData | undefined | null)
  /** `true` if this `DataTransfer` advertises an image representation. */
  get hasImage(): boolean
  /**
   * `true` if this `DataTransfer` carries no data: no plain text, no image, and no
   * user data.
   */
  get isEmpty(): boolean
  /**
   * Application-internal user data attached to this `DataTransfer`. Use this
   * when the drag-and-drop or clipboard operation stays inside the current
   * JavaScript application and you want to avoid serializing to plain text or
   * an image.
   *
   * Reading returns the JavaScript value previously assigned, or `null` if
   * none was set (or the user data was set by a non-JavaScript binding).
   * Assigning `null` or `undefined` clears any previously attached JS user
   * data.
   */
  get userData(): unknown
  set userData(value: unknown)
  /**
   * Returns `true` if this `DataTransfer` equals `other`. Two transfers
   * compare equal when one is an unmodified clone of the other; any
   * modification (including overwriting plain text, image, or user data with
   * the same value) makes them unequal.
   */
  equals(other: DataTransfer): boolean
}
export type SlintDataTransfer = DataTransfer

/**
 * `Keys` represent a key combined with a list of modifiers (the `keys` type in the Slint language).
 *
 * To construct a `Keys` instance from JavaScript, use the `Keys.fromParts()` method.
 *
 * Use `toString()` to get a platform-native representation of the key binding
 * (e.g. "Ctrl+A" on Linux/Windows, "⌘A" on macOS).
 */
export declare class Keys {
  /**
   * Create a `Keys` from a list of string parts, e.g. `["Control", "Shift?", "Z"]`.
   *
   * Each element is either a modifier name or a key name. Throws an error on parse failure.
   */
  static fromParts(parts: Array<string>): Keys
  /** Returns the platform-native string representation of this key binding. */
  toString(): string
  /** Returns `true` if this key binding is equal to `other`. */
  equals(other: Keys): boolean
}
export type SlintKeys = Keys

export declare class ModelIterator {
  next(): unknown
}

export declare class Property {
  name: string
  valueType: ValueType
}
export type JsProperty = Property

export declare class ReadOnlyRustModel {
  rowCount(): number
  rowData(row: number): unknown
  setRowData(row: number, data: unknown): void
}

export declare class SharedModelNotify {

}

/** SlintBrush implements {@link Brush}. */
export declare class SlintBrush {
  constructor(color: RgbaColor)
  static fromBrush(brush: Brush): SlintBrush
  get color(): RgbaColor
  /** @hidden */
  get slintColor(): SlintRgbaColor
  /** Returns true if this brush contains a fully transparent color (alpha value is zero) */
  get isTransparent(): boolean
  /** Returns true if this brush is fully opaque. */
  get isOpaque(): boolean
  /**
   * Returns a new version of this brush that has the brightness increased
   * by the specified factor. This is done by calling [`Color::brighter`] on
   * all the colors of this brush.
   */
  brighter(factor: number): SlintBrush
  /**
   * Returns a new version of this brush that has the brightness decreased
   * by the specified factor. This is done by calling [`Color::darker`] on
   * all the color of this brush.
   */
  darker(factor: number): SlintBrush
  /**
   * Returns a new version of this brush with the opacity decreased by `factor`.
   *
   * The transparency is obtained by multiplying the alpha channel by `(1 - factor)`.
   */
  transparentize(amount: number): SlintBrush
  /**
   * Returns a new version of this brush with the related color's opacities
   * set to `alpha`.
   */
  withAlpha(alpha: number): SlintBrush
  /** @hidden */
  get brush(): ExternalObject<Brush>
  /**
   * Returns the color as string in hex representation e.g. `#000000` for black.
   * It is only implemented for solid color brushes.
   */
  toString(): string
}

/** SlintPoint implements {@link ImageData}. */
export declare class SlintImageData {
  /**
   * Constructs a new image with the given width and height.
   * Each pixel will set to red = 0, green = 0, blue = 0 and alpha = 0.
   */
  constructor(width: number, height: number)
  /** Returns the width of the image in pixels. */
  get width(): number
  /** Returns the height of the image in pixels. */
  get height(): number
  /**
   * Returns the image as buffer.
   * A Buffer is a subclass of Uint8Array.
   */
  get data(): Buffer
  get path(): unknown
  /** @hidden */
  get image(): ExternalObject<ImageData>
}

/** SlintPoint implements {@link Point}. */
export declare class SlintPoint {
  x: number
  y: number
  /** Constructs new point from x and y. */
  constructor(x: number, y: number)
}

/** SlintRgbaColor implements {@link RgbaColor}. */
export declare class SlintRgbaColor {
  /** Creates a new transparent color. */
  constructor()
  /**
   * Construct a color from the red, green and blue color channel parameters. The alpha
   * channel will have the value 255.
   */
  static fromRgb(red: number, green: number, blue: number): SlintRgbaColor
  /** Construct a color from the alpha, red, green and blue color channel parameters. */
  static fromArgb(alpha: number, red: number, green: number, blue: number): SlintRgbaColor
  /** Returns the red channel of the color as number in the range 0..255. */
  get red(): number
  /** Returns the green channel of the color as number in the range 0..255. */
  get green(): number
  /** Returns the blue channel of the color as number in the range 0..255. */
  get blue(): number
  /** Returns the alpha channel of the color as number in the range 0..255. */
  get alpha(): number
  /**
   * by the specified factor. This is done by converting the color to the HSV
   * color space and multiplying the brightness (value) with (1 + factor).
   * The result is converted back to RGB and the alpha channel is unchanged.
   * So for example `brighter(0.2)` will increase the brightness by 20%, and
   * calling `brighter(-0.5)` will return a color that's 50% darker.
   */
  brighter(factor: number): SlintRgbaColor
  /**
   * Returns a new version of this color that has the brightness decreased
   * by the specified factor. This is done by converting the color to the HSV
   * color space and dividing the brightness (value) by (1 + factor). The
   * result is converted back to RGB and the alpha channel is unchanged.
   * So for example `darker(0.3)` will decrease the brightness by 30%.
   */
  darker(factor: number): SlintRgbaColor
  /**
   * Returns a new version of this color with the opacity decreased by `factor`.
   *
   * The transparency is obtained by multiplying the alpha channel by `(1 - factor)`.
   */
  transparentize(amount: number): SlintRgbaColor
  /**
   *  Returns a new color that is a mix of `this` color and `other`. The specified factor is
   *  clamped to be between `0.0` and `1.0` and then applied to `this` color, while `1.0 - factor`
   * is applied to `other`.
   */
  mix(other: SlintRgbaColor, factor: number): SlintRgbaColor
  /** Returns a new version of this color with the opacity set to `alpha`. */
  withAlpha(alpha: number): SlintRgbaColor
  /** Returns the color as string in hex representation e.g. `#000000` for black. */
  toString(): string
}

/** SlintSize implements {@link Size}. */
export declare class SlintSize {
  width: number
  height: number
  /** Constructs a size from the given width and height. */
  constructor(width: number, height: number)
}

/**
 * Styled text parsed from markdown or plain text.
 *
 * Use `StyledText.fromMarkdown()` or `StyledText.fromPlainText()` to create instances.
 * Assign the result to a `styled-text` property in a Slint component to display it.
 */
export declare class StyledText {
  /** Creates styled text from plain text without applying markdown parsing. */
  static fromPlainText(text: string): StyledText
  /**
   * Parses markdown into styled text.
   *
   * @throws {Error} if the markdown contains unsupported syntax.
   */
  static fromMarkdown(markdown: string): StyledText
  /** Returns `true` if this styled text is equal to `other`. */
  equals(other: StyledText): boolean
}
export type SlintStyledText = StyledText

/**
 * This type represents a window towards the windowing system, that's used to render the
 * scene of a component. It provides API to control windowing system specific aspects such
 * as the position on the screen.
 */
export declare class Window {
  /** @hidden */
  constructor()
  /**
   * Shows the window on the screen. An additional strong reference on the
   * associated component is maintained while the window is visible.
   */
  show(): void
  /** Hides the window, so that it is not visible anymore. */
  hide(): void
  /**
   * Returns the visibility state of the window. This function can return false even if you previously called show()
   * on it, for example if the user minimized the window.
   */
  get visible(): boolean
  /** Returns the logical position of the window on the screen. */
  get logicalPosition(): SlintPoint
  /** Sets the logical position of the window on the screen. */
  set logicalPosition(position: SlintPoint)
  /** Returns the physical position of the window on the screen. */
  get physicalPosition(): SlintPoint
  /** Sets the physical position of the window on the screen. */
  set physicalPosition(position: SlintPoint)
  /** Returns the logical size of the window on the screen, */
  get logicalSize(): SlintSize
  /** Sets the logical size of the window on the screen, */
  set logicalSize(size: SlintSize)
  /** Returns the physical size of the window on the screen, */
  get physicalSize(): SlintSize
  /** Sets the logical size of the window on the screen, */
  set physicalSize(size: SlintSize)
  /** Issues a request to the windowing system to re-render the contents of the window. */
  requestRedraw(): void
  /** Returns if the window is currently fullscreen */
  get fullscreen(): boolean
  /** Set or unset the window to display fullscreen. */
  set fullscreen(enable: boolean)
  /** Returns if the window is currently maximized */
  get maximized(): boolean
  /** Maximize or unmaximize the window. */
  set maximized(maximized: boolean)
  /** Returns if the window is currently minimized */
  get minimized(): boolean
  /** Minimize or unminimize the window. */
  set minimized(minimized: boolean)
}
export type JsWindow = Window

/**
 * A brush is a data structure that is used to describe how
 * a shape, such as a rectangle, path or even text, shall be filled.
 * A brush can also be applied to the outline of a shape, that means
 * the fill of the outline itself.
 */
export interface Brush {
  /**
   * Defines a solid color brush from rgba.
   *
   * If no color is set it defaults to transparent.
   */
  color?: RgbaColor
}

/**
 * Returns the list of optional capabilities that were compiled into the loaded
 * native binary. This is how JavaScript can tell whether the "dev" binary
 * (with system-testing and MCP support) was loaded, or just the default one.
 */
export declare function buildFeatures(): Array<string>

/**
 * This structure represent a diagnostic emitted while compiling .slint code.
 *
 * It is basically a message, a level (warning or error), attached to a
 * position in the code.
 */
export interface Diagnostic {
  /** The level for this diagnostic. */
  level: DiagnosticLevel
  /** Message for this diagnostic. */
  message: string
  /** The line number in the .slint source file. The line number starts with 1. */
  lineNumber: number
  columnNumber: number
  /** The path of the source file where this diagnostic occurred. */
  fileName?: string
}

/** This enum describes the level or severity of a diagnostic message produced by the compiler. */
export declare const enum DiagnosticLevel {
  /** The diagnostic found is an error that prevents successful compilation. */
  Error = 0,
  /** The diagnostic found is a warning. */
  Warning = 1,
  /** The diagnostic is a note to further help with the error or warning. */
  Note = 2
}

export declare function getMockedTime(): number

export declare function hasIntegratedEventLoop(): boolean

export declare function initTesting(): void

export declare function initTranslations(domain: string, dirName: string): void

export declare function invokeFromEventLoop(callback: DynFunction): void

export declare function jsModelNotifyNew(): ExternalObject<SharedModelNotify>

export declare function jsModelNotifyReset(notify: ExternalObject<SharedModelNotify>): void

export declare function jsModelNotifyRowAdded(notify: ExternalObject<SharedModelNotify>, row: number, count: number): void

export declare function jsModelNotifyRowDataChanged(notify: ExternalObject<SharedModelNotify>, row: number): void

export declare function jsModelNotifyRowRemoved(notify: ExternalObject<SharedModelNotify>, row: number, count: number): void

export declare function mockElapsedTime(ms: number): void

export declare function processEvents(): ProcessEventsResult

export declare const enum ProcessEventsResult {
  Continue = 0,
  Exited = 1
}

export declare function quitEventLoop(): void

/** RgbaColor represents a color in the Slint run-time, represented using 8-bit channels for red, green, blue and the alpha (opacity). */
export interface RgbaColor {
  /** Represents the red channel of the color as u8 in the range 0..255. */
  red: number
  /** Represents the green channel of the color as u8 in the range 0..255. */
  green: number
  /** Represents the blue channel of the color as u8 in the range 0..255. */
  blue: number
  /** Represents the alpha channel of the color as u8 in the range 0..255. */
  alpha?: number
}

export declare function setQuitOnLastWindowClosed(quitOnLastWindowClosed: boolean): void

export declare function setXdgAppId(appId: string): void

export declare function startIntegratedEventLoop(onExit: DynFunction): void

export declare const enum ValueType {
  Void = 0,
  Number = 1,
  String = 2,
  Bool = 3,
  Model = 4,
  Struct = 5,
  Brush = 6,
  Image = 7,
  Keys = 8
}
