Skip to content

Commit

Permalink
Add layoutPositioning attribute to exported types
Browse files Browse the repository at this point in the history
  • Loading branch information
ccouzens committed May 8, 2023
1 parent ae8d318 commit 6bf1e54
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions definitions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ enum class CounterAxisAlignItems(val string: String) {
Baseline("BASELINE"),
}

@Serializable
enum class LayoutPositioning(val string: String) {
@SerialName("ABSOLUTE")
Absolute("ABSOLUTE"),
}

@Serializable
enum class LayoutMode(val string: String) {
@SerialName("NONE")
Expand Down Expand Up @@ -405,6 +411,8 @@ data class Node (
val counterAxisAlignItems: CounterAxisAlignItems? = null,
/// The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames.
val itemSpacing: Double? = null,
/// Determines whether a layer's size and position should be determined by auto-layout settings or manually adjustable.
val layoutPositioning: LayoutPositioning? = null,
/// Whether this layer uses auto-layout to position its children.
val layoutMode: LayoutMode? = null,
/// The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames.
Expand Down
9 changes: 8 additions & 1 deletion definitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public enum CounterAxisAlignItems: String, Codable {
case baseline = "BASELINE"
}

public enum LayoutPositioning: String, Codable {
case absolute = "ABSOLUTE"
}

public enum LayoutMode: String, Codable {
case none = "NONE"
case horizontal = "HORIZONTAL"
Expand Down Expand Up @@ -364,6 +368,8 @@ public struct Node: Codable {
public let counterAxisAlignItems: CounterAxisAlignItems?
/// The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames.
public let itemSpacing: Double?
/// Determines whether a layer's size and position should be determined by auto-layout settings or manually adjustable.
public let layoutPositioning: LayoutPositioning?
/// Whether this layer uses auto-layout to position its children.
public let layoutMode: LayoutMode?
/// The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames.
Expand All @@ -387,7 +393,7 @@ public struct Node: Codable {
/// This property is applicable only for direct children of auto-layout frames, ignored otherwise. Determines whether a layer should stretch along the parent’s primary axis. A 0 corresponds to a fixed size and 1 corresponds to stretch
public let layoutGrow: Double?

public init(id: String, name: String, visible: Bool?, type: NodeType, children: [Node]?, backgroundColor: Color?, fills: [Paint]?, strokes: [Paint]?, strokeWeight: Double?, individualStrokeWeights: StrokeWeights?, strokeAlign: StrokeAlign?, strokeDashes: [Double]?, cornerRadius: Double?, rectangleCornerRadii: [Double]?, transitionDuration: Double?, transitionEasing: EasingType?, opacity: Double?, absoluteBoundingBox: Rectangle?, absoluteRenderBounds: Rectangle?, primaryAxisSizingMode: AxisSizingMode?, counterAxisSizingMode: AxisSizingMode?, primaryAxisAlignItems: PrimaryAxisAlignItems?, counterAxisAlignItems: CounterAxisAlignItems?, itemSpacing: Double?, layoutMode: LayoutMode?, paddingLeft: Double?, paddingRight: Double?, paddingTop: Double?, paddingBottom: Double?, effects: [Effect]?, styles: Styles?, characters: String?, style: TypeStyle?, layoutAlign: LayoutAlign?, layoutGrow: Double?) {
public init(id: String, name: String, visible: Bool?, type: NodeType, children: [Node]?, backgroundColor: Color?, fills: [Paint]?, strokes: [Paint]?, strokeWeight: Double?, individualStrokeWeights: StrokeWeights?, strokeAlign: StrokeAlign?, strokeDashes: [Double]?, cornerRadius: Double?, rectangleCornerRadii: [Double]?, transitionDuration: Double?, transitionEasing: EasingType?, opacity: Double?, absoluteBoundingBox: Rectangle?, absoluteRenderBounds: Rectangle?, primaryAxisSizingMode: AxisSizingMode?, counterAxisSizingMode: AxisSizingMode?, primaryAxisAlignItems: PrimaryAxisAlignItems?, counterAxisAlignItems: CounterAxisAlignItems?, itemSpacing: Double?, layoutPositioning: LayoutPositioning?, layoutMode: LayoutMode?, paddingLeft: Double?, paddingRight: Double?, paddingTop: Double?, paddingBottom: Double?, effects: [Effect]?, styles: Styles?, characters: String?, style: TypeStyle?, layoutAlign: LayoutAlign?, layoutGrow: Double?) {
self.id = id
self.name = name
self.visible = visible
Expand All @@ -412,6 +418,7 @@ public struct Node: Codable {
self.primaryAxisAlignItems = primaryAxisAlignItems
self.counterAxisAlignItems = counterAxisAlignItems
self.itemSpacing = itemSpacing
self.layoutPositioning = layoutPositioning
self.layoutMode = layoutMode
self.paddingLeft = paddingLeft
self.paddingRight = paddingRight
Expand Down
6 changes: 6 additions & 0 deletions typescript/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ export enum CounterAxisAlignItems {
Baseline = "BASELINE",
}

export enum LayoutPositioning {
Absolute = "ABSOLUTE",
}

export enum LayoutMode {
None = "NONE",
Horizontal = "HORIZONTAL",
Expand Down Expand Up @@ -306,6 +310,8 @@ export interface Node {
counterAxisAlignItems?: CounterAxisAlignItems;
/** The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames. */
itemSpacing?: number;
/** Determines whether a layer's size and position should be determined by auto-layout settings or manually adjustable. */
layoutPositioning?: LayoutPositioning;
/** Whether this layer uses auto-layout to position its children. */
layoutMode?: LayoutMode;
/** The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames. */
Expand Down

0 comments on commit 6bf1e54

Please sign in to comment.