@zeplin/extension-model
    Preparing search index...

    Interface Extension

    Interface for Zeplin extension. A Zeplin extension is a module which can hook into the code generation logic in Zeplin. Plugins implement all or some subset of the capabilities that Zeplin expects, such as generating code for colors in project's styleguide or for any selected layer in designs.

    interface Extension {
        colors(context: Context): CodeObject;
        comment(context: Context, text: string): string;
        component(
            context: Context,
            selectedVersion: Version,
            selectedComponent: Component,
        ): CodeObject;
        exportColors(context: Context): CodeExportObject | CodeExportObject[];
        exportSpacing(context: Context): CodeExportObject | CodeExportObject[];
        exportStyleguideColors(
            context: Context,
            colors?: Color[],
        ): CodeExportObject | CodeExportObject[];
        exportStyleguideTextStyles(
            context: Context,
            textStyles?: TextStyle[],
        ): CodeExportObject | CodeExportObject[];
        exportTextStyles(context: Context): CodeExportObject | CodeExportObject[];
        layer(context: Context, selectedLayer: Layer, version: Version): CodeObject;
        screen(
            context: Context,
            selectedVersion: Version,
            selectedScreen: Screen,
        ): CodeObject;
        spacing(context: Context): CodeObject;
        styleguideColors(context: Context, colors: Color[]): CodeObject;
        styleguideTextStyles(context: Context, textStyles: TextStyle[]): CodeObject;
        textStyles(context: Context): CodeObject;
    }
    Index

    Methods

    • Generates comment in the extensions target language.

      Parameters

      • context: Context

        Context object

      • text: string

        Text to be commented

      Returns string

      Input string as a proper comment in the extension's target language.

    • This function is called whenever a component is selected. It generates code for the selected component.

      Parameters

      • context: Context

        Context object

      • selectedVersion: Version

        Selected version

      • selectedComponent: Component

        Selected component

      Returns CodeObject

      Generated code object for the selected component.

    • This function is called whenever a layer is selected. It generates code for the selected layer.

      Parameters

      • context: Context

        Context object

      • selectedLayer: Layer

        Selected layer

      • version: Version

        Selected layer's last version

      Returns CodeObject

      Generated code object for the selected layer.

    • This function is called whenever a version of a screen is opened. It generates code for the selected version of the screen.

      Parameters

      • context: Context

        Context object

      • selectedVersion: Version

        Selected version

      • selectedScreen: Screen

        Selected screen

      Returns CodeObject

      Generated code object for the selected version of the screen.

    • Generate code for the spacing tokens in project styleguide or linked styleguide.

      Parameters

      Returns CodeObject

      Generated code object for the spacing tokens.

    • Generate code for the text styles in project styleguide or linked styleguide.

      Parameters

      Returns CodeObject

      Generated code object for the text styles.