Skip to content

Commit 5bd47f2

Browse files
V22: Introduce pinning layer inputs (#89)
2 parents b3e7b23 + b2ff473 commit 5bd47f2

94 files changed

Lines changed: 5531 additions & 97 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Sources/StitchSchemaKit/SchemaVersions.swift

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -9,90 +9,91 @@ import Foundation
99
import SwiftUI
1010

1111
// MARK: - UPDATE VERSION NUMBERS HERE
12-
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V21
13-
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V21
14-
public typealias CurrentCameraSettings = CameraSettings_V21
15-
public typealias CurrentCommentBoxData = CommentBoxData_V21
16-
public typealias CurrentCustomShape = CustomShape_V21
17-
public typealias CurrentDataType = DataType_V21
18-
public typealias CurrentDelayStyle = DelayStyle_V21
19-
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V21
20-
public typealias CurrentExpansionDirection = ExpansionDirection_V21
21-
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V21
22-
public typealias CurrentPatch = Patch_V21
23-
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V21
24-
public typealias CurrentLayerDimension = LayerDimension_V21
25-
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V21
26-
public typealias CurrentLayerNodeId = LayerNodeId_V21
27-
public typealias CurrentNodeEntity = NodeEntity_V21
28-
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V21
29-
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V21
30-
public typealias CurrentSplitterType = SplitterType_V21
31-
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V21
32-
public typealias CurrentJSONCurveTo = JSONCurveTo_V21
33-
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V21
34-
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V21
35-
public typealias CurrentSidebarLayerData = SidebarLayerData_V21
36-
public typealias CurrentNodeKind = NodeKind_V21
37-
public typealias CurrentAnchoring = Anchoring_V21
38-
public typealias CurrentCameraDirection = CameraDirection_V21
39-
public typealias CurrentLayer = Layer_V21
40-
public typealias CurrentLayerSize = LayerSize_V21
41-
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V21
42-
public typealias CurrentLayerStroke = LayerStroke_V21
43-
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V21
44-
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V21
45-
public typealias CurrentLightType = LightType_V21
46-
public typealias CurrentMediaKey = MediaKey_V21
47-
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V21
48-
public typealias CurrentNetworkRequestType = NetworkRequestType_V21
49-
public typealias CurrentPathPoint = PathPoint_V21
50-
public typealias CurrentPlane = Plane_V21
51-
public typealias CurrentPoint3D = Point3D_V21
52-
public typealias CurrentPoint4D = Point4D_V21
53-
public typealias CurrentPortValueComparable = PortValueComparable_V21
54-
public typealias CurrentPreviewSize = PreviewSize_V21
55-
public typealias CurrentRGBA = RGBA_V21
56-
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V21
57-
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V21
58-
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V21
59-
public typealias CurrentScrollMode = ScrollMode_V21
60-
public typealias CurrentShapeCommand = ShapeCommand_V21
61-
public typealias CurrentShapeCommandType = ShapeCommandType_V21
62-
public typealias CurrentShapeCoordinates = ShapeCoordinates_V21
63-
public typealias CurrentShapeAndRect = ShapeAndRect_V21
64-
public typealias CurrentStitchDocument = StitchDocument_V21
65-
public typealias CurrentStitchBlendMode = StitchBlendMode_V21
66-
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V21
67-
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V21
68-
public typealias CurrentStitchMapType = StitchMapType_V21
69-
public typealias CurrentStitchFont = StitchFont_V21
70-
public typealias CurrentStitchFontChoice = StitchFontChoice_V21
71-
public typealias CurrentStitchFontWeight = StitchFontWeight_V21
72-
public typealias CurrentStitchJSON = StitchJSON_V21
73-
public typealias CurrentStitchOrientation = StitchOrientation_V21
74-
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V21
75-
public typealias CurrentTextTransform = TextTransform_V21
76-
public typealias CurrentTriangleData = TriangleData_V21
77-
public typealias CurrentPortValue = PortValue_V21
78-
public typealias CurrentUserVisibleType = UserVisibleType_V21
79-
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V21
80-
public typealias CurrentNodeConnectionType = NodeConnectionType_V21
81-
public typealias CurrentLayerInputType = LayerInputType_V21
82-
public typealias CurrentNodeIOPortType = NodeIOPortType_V21
83-
public typealias CurrentStrokeLineCap = StrokeLineCap_V21
84-
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V21
85-
public typealias CurrentStitchStringValue = StitchStringValue_V21
86-
public typealias CurrentStitchContentMode = StitchContentMode_V21
87-
public typealias CurrentStitchSpacing = StitchSpacing_V21
88-
public typealias CurrentStitchPadding = StitchPadding_V21
89-
public typealias CurrentSizingScenario = SizingScenario_V21
90-
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V21
91-
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V21
92-
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V21
93-
public typealias CurrentCanvasItemId = CanvasItemId_V21
94-
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V21
95-
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V21
12+
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V22
13+
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V22
14+
public typealias CurrentCameraSettings = CameraSettings_V22
15+
public typealias CurrentCommentBoxData = CommentBoxData_V22
16+
public typealias CurrentCustomShape = CustomShape_V22
17+
public typealias CurrentDataType = DataType_V22
18+
public typealias CurrentDelayStyle = DelayStyle_V22
19+
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V22
20+
public typealias CurrentExpansionDirection = ExpansionDirection_V22
21+
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V22
22+
public typealias CurrentPatch = Patch_V22
23+
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V22
24+
public typealias CurrentLayerDimension = LayerDimension_V22
25+
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V22
26+
public typealias CurrentLayerNodeId = LayerNodeId_V22
27+
public typealias CurrentNodeEntity = NodeEntity_V22
28+
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V22
29+
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V22
30+
public typealias CurrentSplitterType = SplitterType_V22
31+
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V22
32+
public typealias CurrentJSONCurveTo = JSONCurveTo_V22
33+
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V22
34+
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V22
35+
public typealias CurrentSidebarLayerData = SidebarLayerData_V22
36+
public typealias CurrentNodeKind = NodeKind_V22
37+
public typealias CurrentAnchoring = Anchoring_V22
38+
public typealias CurrentCameraDirection = CameraDirection_V22
39+
public typealias CurrentLayer = Layer_V22
40+
public typealias CurrentLayerSize = LayerSize_V22
41+
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V22
42+
public typealias CurrentLayerStroke = LayerStroke_V22
43+
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V22
44+
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V22
45+
public typealias CurrentLightType = LightType_V22
46+
public typealias CurrentMediaKey = MediaKey_V22
47+
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V22
48+
public typealias CurrentNetworkRequestType = NetworkRequestType_V22
49+
public typealias CurrentPathPoint = PathPoint_V22
50+
public typealias CurrentPlane = Plane_V22
51+
public typealias CurrentPoint3D = Point3D_V22
52+
public typealias CurrentPoint4D = Point4D_V22
53+
public typealias CurrentPortValueComparable = PortValueComparable_V22
54+
public typealias CurrentPreviewSize = PreviewSize_V22
55+
public typealias CurrentRGBA = RGBA_V22
56+
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V22
57+
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V22
58+
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V22
59+
public typealias CurrentScrollMode = ScrollMode_V22
60+
public typealias CurrentShapeCommand = ShapeCommand_V22
61+
public typealias CurrentShapeCommandType = ShapeCommandType_V22
62+
public typealias CurrentShapeCoordinates = ShapeCoordinates_V22
63+
public typealias CurrentShapeAndRect = ShapeAndRect_V22
64+
public typealias CurrentStitchDocument = StitchDocument_V22
65+
public typealias CurrentStitchBlendMode = StitchBlendMode_V22
66+
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V22
67+
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V22
68+
public typealias CurrentStitchMapType = StitchMapType_V22
69+
public typealias CurrentStitchFont = StitchFont_V22
70+
public typealias CurrentStitchFontChoice = StitchFontChoice_V22
71+
public typealias CurrentStitchFontWeight = StitchFontWeight_V22
72+
public typealias CurrentStitchJSON = StitchJSON_V22
73+
public typealias CurrentStitchOrientation = StitchOrientation_V22
74+
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V22
75+
public typealias CurrentTextTransform = TextTransform_V22
76+
public typealias CurrentTriangleData = TriangleData_V22
77+
public typealias CurrentPortValue = PortValue_V22
78+
public typealias CurrentUserVisibleType = UserVisibleType_V22
79+
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V22
80+
public typealias CurrentNodeConnectionType = NodeConnectionType_V22
81+
public typealias CurrentLayerInputType = LayerInputType_V22
82+
public typealias CurrentNodeIOPortType = NodeIOPortType_V22
83+
public typealias CurrentStrokeLineCap = StrokeLineCap_V22
84+
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V22
85+
public typealias CurrentStitchStringValue = StitchStringValue_V22
86+
public typealias CurrentStitchContentMode = StitchContentMode_V22
87+
public typealias CurrentStitchSpacing = StitchSpacing_V22
88+
public typealias CurrentStitchPadding = StitchPadding_V22
89+
public typealias CurrentSizingScenario = SizingScenario_V22
90+
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V22
91+
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V22
92+
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V22
93+
public typealias CurrentCanvasItemId = CanvasItemId_V22
94+
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V22
95+
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V22
96+
public typealias CurrentPinToId = PinToId_V22
9697

9798
// MARK: - end
9899

@@ -182,6 +183,7 @@ public typealias LayerInputDataEntity = CurrentLayerInputDataEntity.LayerInputDa
182183
public typealias CanvasItemId = CurrentCanvasItemId.CanvasItemId
183184
public typealias LayerInputCoordinate = CurrentLayerInputCoordinate.LayerInputCoordinate
184185
public typealias LayerOutputCoordinate = CurrentLayerOutputCoordinate.LayerOutputCoordinate
186+
public typealias PinToId = CurrentPinToId.PinToId
185187

186188
public enum StitchSchemaVersion: Int, VersionType {
187189
case _V1 = 1
@@ -205,6 +207,7 @@ public enum StitchSchemaVersion: Int, VersionType {
205207
case _V19 = 19
206208
case _V20 = 20
207209
case _V21 = 21
210+
case _V22 = 22
208211
}
209212

210213
public protocol VersionType: CaseIterable, Codable, Comparable, RawRepresentable {}
@@ -270,6 +273,8 @@ extension StitchDocumentVersion {
270273
return StitchDocument_V20.StitchDocument.self
271274
case ._V21:
272275
return StitchDocument_V21.StitchDocument.self
276+
case ._V22:
277+
return StitchDocument_V22.StitchDocument.self
273278
}
274279
}
275280
}

Sources/StitchSchemaKit/V16/NodePort/NodeIOPortType_V16.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public enum NodeIOPortType_V16: StitchSchemaVersionable {
1111
// MARK: - ensure versions are correct
1212
static var version: StitchSchemaVersion = StitchSchemaVersion._V16
13-
public typealias PreviousInstance = Self.NodeIOPortType
13+
public typealias PreviousInstance = NodeIOPortType_V15.NodeIOPortType
1414
public typealias LayerInputType = LayerInputType_V16.LayerInputType
1515
// MARK: - endif
1616

Sources/StitchSchemaKit/V17/NodePort/NodeIOPortType_V17.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public enum NodeIOPortType_V17: StitchSchemaVersionable {
1111
// MARK: - ensure versions are correct
1212
static var version: StitchSchemaVersion = StitchSchemaVersion._V17
13-
public typealias PreviousInstance = Self.NodeIOPortType
13+
public typealias PreviousInstance = NodeIOPortType_V16.NodeIOPortType
1414
public typealias LayerInputType = LayerInputType_V17.LayerInputType
1515
// MARK: - endif
1616

Sources/StitchSchemaKit/V18/NodePort/NodeIOPortType_V18.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public enum NodeIOPortType_V18: StitchSchemaVersionable {
1111
// MARK: - ensure versions are correct
1212
static var version: StitchSchemaVersion = StitchSchemaVersion._V18
13-
public typealias PreviousInstance = Self.NodeIOPortType
13+
public typealias PreviousInstance = NodeIOPortType_V17.NodeIOPortType
1414
public typealias LayerInputType = LayerInputType_V18.LayerInputType
1515
// MARK: - endif
1616

Sources/StitchSchemaKit/V19/NodePort/NodeIOPortType_V19.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public enum NodeIOPortType_V19: StitchSchemaVersionable {
1111
// MARK: - ensure versions are correct
1212
static var version: StitchSchemaVersion = StitchSchemaVersion._V19
13-
public typealias PreviousInstance = Self.NodeIOPortType
13+
public typealias PreviousInstance = NodeIOPortType_V18.NodeIOPortType
1414
public typealias LayerInputType = LayerInputType_V19.LayerInputType
1515
// MARK: - endif
1616

Sources/StitchSchemaKit/V20/Node/Group/GroupNodeID_V20.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
public enum GroupNodeID_V20: StitchSchemaVersionable {
1111
// MARK: - ensure versions are correct
1212
static var version: StitchSchemaVersion = StitchSchemaVersion._V20
13-
public typealias PreviousInstance = Self.GroupNodeId
13+
public typealias PreviousInstance = GroupNodeID_V19.GroupNodeId
1414
// MARK: - endif
1515

1616
public struct GroupNodeId: Equatable, Hashable, Identifiable {

Sources/StitchSchemaKit/V21/Node/NodeEntity_V21.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ extension NodeEntity_V21.NodeEntity: StitchVersionedCodable {
3535
public init(previousInstance: NodeEntity_V21.PreviousInstance) {
3636
self.id = previousInstance.id
3737
self.title = previousInstance.title
38+
3839
let migratedPatchNodeEntity = PatchNodeEntity_V21.PatchNodeEntity(previousInstance: previousInstance.patchNodeEntity)
3940
let migratedLayerNodeEntity = LayerNodeEntity_V21.LayerNodeEntity(previousInstance: previousInstance.layerNodeEntity)
4041

42+
4143
let canvasNodeEntity = CanvasNodeEntity_V21
4244
.CanvasNodeEntity(position: previousInstance.position,
4345
zIndex: previousInstance.zIndex,

Sources/StitchSchemaKit/V21/Node/NodeTypeEntity_V21.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ public enum NodeTypeEntity_V21: StitchSchemaVersionable {
1212
// MARK: - ensure versions are correct
1313
static var version = StitchSchemaVersion._V21
1414
public typealias PreviousInstance = Self.NodeTypeEntity
15-
public typealias PatchNodeEnity = PatchNodeEntity_V21.PatchNodeEntity
16-
public typealias LayerNodeEntity = LayerNodeEntity_V21.LayerNodeEntity
17-
public typealias CanvasNodeEntity = CanvasNodeEntity_V21.CanvasNodeEntity
1815
// MARK: - end
1916

2017
public enum NodeTypeEntity: Equatable {
21-
case patch(PatchNodeEntity)
22-
case layer(LayerNodeEntity)
23-
case group(CanvasNodeEntity)
18+
case patch(PatchNodeEntity_V21.PatchNodeEntity)
19+
case layer(LayerNodeEntity_V21.LayerNodeEntity)
20+
case group(CanvasNodeEntity_V21.CanvasNodeEntity)
2421
}
2522
}
2623

Sources/StitchSchemaKit/V21/Node/Patch/PatchNodeEntity_V21.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public enum PatchNodeEntity_V21: StitchSchemaVersionable {
2222
public let id: UUID
2323
public let patch: Patch
2424
public var inputs: NodePortInputEntitySchemas
25-
public var canvasEntity: CanvasNodeEntity
25+
public var canvasEntity: CanvasNodeEntity_V21.CanvasNodeEntity
2626
public let userVisibleType: UserVisibleType?
2727
public let splitterNode: SplitterNodeEntitySchema?
2828
public let mathExpression: String? // only for Math Expression
2929

3030
public init(id: UUID,
3131
patch: Patch,
3232
inputs: NodePortInputEntitySchemas,
33-
canvasEntity: CanvasNodeEntity,
33+
canvasEntity: CanvasNodeEntity_V21.CanvasNodeEntity,
3434
userVisibleType: UserVisibleType?,
3535
splitterNode: SplitterNodeEntitySchema?,
3636
mathExpression: String?) {
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// CommentBoxData_V22.swift
3+
//
4+
//
5+
// Created by Nicholas Arner on 1/27/24.
6+
//
7+
8+
import Foundation
9+
import SwiftUI
10+
11+
public enum CommentBoxData_V22: StitchSchemaVersionable {
12+
// MARK: - ensure versions are correct
13+
static var version: StitchSchemaVersion = StitchSchemaVersion._V22
14+
public typealias PreviousInstance = CommentBoxData_V21.CommentBoxData
15+
public typealias CanvasItemId = CanvasItemId_V22.CanvasItemId
16+
// MARK: - endif
17+
18+
public struct CommentBoxData: Equatable, Hashable {
19+
public var id: UUID
20+
21+
/*
22+
"Which traversal level (group node) does this comment box belong to?"
23+
24+
nil = top level
25+
26+
TODO: implement this properly, but wait until after SwiftData since e.g. VisibleNodesViewModel etc. may be changing.
27+
28+
For now we just make all comment boxes top-level.
29+
*/
30+
public var groupId: UUID?
31+
public var title: String = "Comment"
32+
public var color: Color
33+
public var nodes: Set<CanvasItemId>
34+
public var position: CGPoint
35+
public var size: CGSize
36+
public var zIndex: Double // = .zero
37+
38+
public init(id: CommentBoxId = .init(),
39+
groupId: UUID? = nil,
40+
title: String = "Comment",
41+
color: Color,
42+
nodes: Set<CanvasItemId> = .init(),
43+
position: CGPoint = .zero,
44+
size: CGSize,
45+
zIndex: Double) {
46+
self.id = id
47+
self.groupId = groupId
48+
self.title = title
49+
self.color = color
50+
self.nodes = nodes
51+
self.position = position
52+
self.size = size
53+
self.zIndex = zIndex
54+
}
55+
}
56+
}
57+
58+
extension CommentBoxData_V22.CommentBoxData: StitchVersionedCodable {
59+
public init(previousInstance: CommentBoxData_V22.PreviousInstance) {
60+
self.init(id: previousInstance.id,
61+
groupId: previousInstance.groupId,
62+
title: previousInstance.title,
63+
color: previousInstance.color,
64+
65+
// MARK: just needed for V22, should point to property in future versions
66+
nodes: .init(),
67+
68+
position: previousInstance.position,
69+
size: previousInstance.size,
70+
zIndex: previousInstance.zIndex)
71+
}
72+
}

0 commit comments

Comments
 (0)