TypeScript

Use the copied component source in a TypeScript project and type the application code you add.

React and Vue

Save React snippets as .tsx. In Vue single-file components that need typed script, use <script setup lang="ts">. The foundation currently provides CSS and a side-effect JavaScript module.

If your TypeScript project checks side-effect imports and reports the Dialog module as missing, declare the module in an application .d.ts file.

declare module "*inlay-assets/dialog.js";

Type a Dialog handler

Give the dialog a known ID, then use a typed DOM query to read the native returnValue. Replace the log with your application action.

const dialog = document.querySelector<HTMLDialogElement>("#ilui-archive-dialog");

dialog?.addEventListener("close", () => {
  if (dialog.returnValue === "archive") {
    console.log("Archive confirmed");
  }
});