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

    Class Styleguide

    An interface to represent a Zeplin styleguide.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    colors: Color[]

    Colors in the styleguide.

    components: Component[]

    Components in the styleguide.

    density: string

    Pixel density used in styleguide'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 styleguide's type. e.g., "px" for web styleguides.

    linkedStyleguide?: Styleguide
    name: string

    Name of the styleguide.

    parent?: Styleguide

    Parent of the styleguide.

    remPreferences?: RemPreferences

    Preferences to specify rem usage in the styleguide (web styleguides only).

    spacingSections: SpacingSection[]

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

    textLengthUnit: string

    The unit of font sizes.

    textStyles: TextStyle[]

    Text styles in the styleguide.

    Type of the styleguide, one of "web", "android", "ios", "macos", "base"

    variableCollections: VariableCollection[] = []

    Variable collections in the styleguide.

    Accessors

    Methods

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

      Parameters

      • textStyle: TextStyle

        Text style to find a match for

      • useLinkedStyleguides: boolean = true

        Whether to search in parent styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

    • Finds any color in the styleguide or in the parent 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 parent styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any color in the styleguide or in the parent 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 parent styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any color in the styleguide or in the parent 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 parent 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 styleguide or in the parent styleguides (if useLinkedStyleguides is true) which is equal to color

      Parameters

      • color: Color

        Color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in parent styleguides (defaults to true)

      Returns undefined | Color

      The found color or undefined if not found

    • Finds any component in the styleguide 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 parent styleguides (defaults to true)

      Returns undefined | Component

      The found component or undefined if not found

    • Finds any component in the styleguide 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 parent styleguides (defaults to true)

      Returns undefined | Component

      The found component or undefined if not found

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

      Parameters

      • color: Color

        Color to find

      • useLinkedStyleguides: boolean = true

        Whether to search in parent 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 styleguide 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 parent styleguides (defaults to true)

      Returns undefined | SpacingToken

      The found spacing token or undefined if not found

    • Finds any spacing token in the styleguide 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 parent styleguides (defaults to true)

      Returns undefined | SpacingToken

      The found spacing token or undefined if not found

    • Finds any text style in the styleguide or in the parent 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 parent styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

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

      Parameters

      • textStyle: TextStyle

        Text style to find

      • useLinkedStyleguides: boolean = true

        Whether to search in parent styleguides (defaults to true)

      Returns undefined | TextStyle

      The found text style or undefined if not found

    • Creates a Styleguide instance from a JSON string

      Parameters

      • json: string

        JSON string representing a styleguide

      Returns Styleguide

      A new Styleguide instance

    • Get variable color

      Parameters

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

      Returns undefined | Color