ink

  • Version 6.7.0
  • Published
  • 418 kB
  • 25 dependencies
  • MIT license

Install

npm i ink
yarn add ink
pnpm add ink

Overview

React for CLI

Index

Classes

class Ink

class Ink {}

    constructor

    constructor(options: Options);

      property calculateLayout

      calculateLayout: () => void;

        property getTerminalWidth

        getTerminalWidth: () => number;

          property isConcurrent

          readonly isConcurrent: boolean;
          • Whether this instance is using concurrent rendering mode.

          property onRender

          onRender: () => void;

            property rejectExitPromise

            rejectExitPromise: (reason?: Error) => void;

              property resized

              resized: () => void;

                property resolveExitPromise

                resolveExitPromise: () => void;

                  property restoreLastOutput

                  restoreLastOutput: () => void;

                    property setCursorPosition

                    setCursorPosition: (position: CursorPosition | undefined) => void;

                      property unsubscribeExit

                      unsubscribeExit: () => void;

                        method clear

                        clear: () => void;

                          method patchConsole

                          patchConsole: () => void;

                            method render

                            render: (node: ReactNode) => void;

                              method unmount

                              unmount: (error?: Error | number | null) => void;

                                method waitUntilExit

                                waitUntilExit: () => Promise<void>;

                                  method writeToStderr

                                  writeToStderr: (data: string) => void;

                                    method writeToStdout

                                    writeToStdout: (data: string) => void;

                                      Type Aliases

                                      type Options

                                      type Options = {
                                      stdout: NodeJS.WriteStream;
                                      stdin: NodeJS.ReadStream;
                                      stderr: NodeJS.WriteStream;
                                      debug: boolean;
                                      exitOnCtrlC: boolean;
                                      patchConsole: boolean;
                                      onRender?: (metrics: RenderMetrics) => void;
                                      isScreenReaderEnabled?: boolean;
                                      waitUntilExit?: () => Promise<void>;
                                      maxFps?: number;
                                      incrementalRendering?: boolean;
                                      /**
                                      Enable React Concurrent Rendering mode.
                                      When enabled:
                                      - Suspense boundaries work correctly with async data
                                      - `useTransition` and `useDeferredValue` are fully functional
                                      - Updates can be interrupted for higher priority work
                                      Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes effect on the first render for a given stdout. If you need to change the rendering mode, call `unmount()` first.
                                      @default false
                                      @experimental
                                      */
                                      concurrent?: boolean;
                                      kittyKeyboard?: KittyKeyboardOptions;
                                      };

                                        type RenderMetrics

                                        type RenderMetrics = {
                                        /**
                                        Time spent rendering in milliseconds.
                                        */
                                        renderTime: number;
                                        };
                                        • Performance metrics for a render operation.

                                        Package Files (1)

                                        Dependencies (25)

                                        Dev Dependencies (30)

                                        Peer Dependencies (3)

                                        Badge

                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ink.

                                        • Markdown
                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ink)
                                        • HTML
                                          <a href="https://www.jsdocs.io/package/ink"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>