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

    Class Project

    An interface to represent a Zeplin project.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    colors: Color[]

    Colors in the project's styleguide.

    components: Component[]

    Components in the project's styleguide.

    density: string

    Pixel density used in project's designs.

    densityDivisor: number

    This value is used to obtain actual length from the unit length for a density.

    lengthUnit: string

    The unit of length specific to the project's type. e.g., "px" for web projects.

    linkedStyleguide?: Styleguide

    Linked styleguide of the project.

    name: string

    Name of the project.

    parent?: Styleguide
    remPreferences?: RemPreferences

    Preferences to specify rem usage in the project (web projects only).

    spacingSections: SpacingSection[]

    Spacing sections (with spacing tokens) defined in the project.

    textLengthUnit: string

    The unit of font sizes.

    textStyles: TextStyle[]

    Text styles in the project's styleguide.

    Type of the project, one of "web", "android", "ios", "macos"

    variableCollections: VariableCollection[] = []

    Variable collections in the project's styleguide.

    Accessors

    • get ALLOWED_FIELDS(): string[]

      Returns string[]

    Methods

    • Finds the best match for a text style in the project or in the linked styleguides (if useLinkedStyleguides is true)

      Parameters

      • textStyle: TextStyle

        Text style to find a match for

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

    • Finds any color in the project or in the linked styleguides (if useLinkedStyleguides is true) whose hex and alpha values are equal to values

      Parameters

      • values: { alpha?: number; hex?: string }

        Object containing hex and alpha values

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any color in the project or in the linked styleguides (if useLinkedStyleguides is true) whose name is equal to name

      Parameters

      • name: string

        Name of the color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any color in the project or in the linked styleguides (if useLinkedStyleguides is true) whose sourceId equals to sourceId

      Parameters

      • sourceId: string

        Source ID of the color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Find color by variable color

      Parameters

      • variableColor: Color
      • useLinkedStyleguides: boolean
      • useLinkedVariableSourceId: boolean

      Returns undefined | Color

    • Finds any color in the project or in the linked styleguides (if useLinkedStyleguides is true) which is equal to color

      Parameters

      • color: Color

        Color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any component in the project or in the parent styleguides (if useLinkedStyleguides is true) whose name equals to name

      Parameters

      • name: string

        Name of the component to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Component

      The found component or undefined if not found

    • Finds any component in the project or in the parent styleguides (if useLinkedStyleguides is true) whose sourceId equals to sourceId

      Parameters

      • sourceId: string

        Source ID of the component to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Component

      The found component or undefined if not found

    • Finds any color variable in the project or in the linked styleguides (if useLinkedStyleguides is true) which is equal to color

      Parameters

      • color: Color

        Color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Find resource in barrel

      Type Parameters

      • T

      Parameters

      • searchFn: (b: Barrel) => undefined | T
      • useLinkedStyleguides: boolean

      Returns undefined | T

    • Finds any spacing token in the project or in the parent styleguides (if useLinkedStyleguides is true) whose name is equal to name

      Parameters

      • name: string

        Name of the spacing token to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | SpacingToken

      The found spacing token or undefined if not found

    • Finds any spacing token in the project or in the parent styleguides (if useLinkedStyleguides is true) whose value is equal to value

      Parameters

      • value: number

        Value of the spacing token to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | SpacingToken

      The found spacing token or undefined if not found

    • Finds any text style in the project or in the linked styleguides (if useLinkedStyleguides is true) whose name is equal to name

      Parameters

      • name: string

        Name of the text style to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

    • Finds any text style in the project or in the linked styleguides (if useLinkedStyleguides is true) which is equal to textStyle

      Parameters

      • textStyle: TextStyle

        Text style to find

      • useLinkedStyleguides: boolean = true

        Whether to search in linked styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

    • Creates a Project instance from a JSON string

      Parameters

      • json: string

        JSON string representing a project

      Returns Project

      A new Project instance

    • Get variable color

      Parameters

      • variable: undefined | Variable
      • variableName: string
      • variableSourceId: string
      • variableBySourceId: Record<string, Variable>
      • projectType: string

      Returns undefined | Color