Skip to content

Commit 6e0c936

Browse files
authored
v27: sidebar support for group expansion (#110)
1 parent 0e64588 commit 6e0c936

107 files changed

Lines changed: 6289 additions & 114 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: 100 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -9,105 +9,105 @@ import Foundation
99
import SwiftUI
1010

1111
// MARK: - UPDATE VERSION NUMBERS HERE
12-
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V26
13-
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V26
14-
public typealias CurrentCameraSettings = CameraSettings_V26
15-
public typealias CurrentCommentBoxData = CommentBoxData_V26
16-
public typealias CurrentCustomShape = CustomShape_V26
17-
public typealias CurrentDataType = DataType_V26
18-
public typealias CurrentDelayStyle = DelayStyle_V26
19-
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V26
20-
public typealias CurrentExpansionDirection = ExpansionDirection_V26
21-
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V26
22-
public typealias CurrentPatch = Patch_V26
23-
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V26
24-
public typealias CurrentLayerDimension = LayerDimension_V26
25-
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V26
26-
public typealias CurrentLayerNodeId = LayerNodeId_V26
27-
public typealias CurrentNodeEntity = NodeEntity_V26
28-
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V26
29-
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V26
30-
public typealias CurrentSplitterType = SplitterType_V26
31-
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V26
32-
public typealias CurrentJSONCurveTo = JSONCurveTo_V26
33-
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V26
34-
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V26
35-
public typealias CurrentSidebarLayerData = SidebarLayerData_V26
36-
public typealias CurrentNodeKind = NodeKind_V26
37-
public typealias CurrentAnchoring = Anchoring_V26
38-
public typealias CurrentCameraDirection = CameraDirection_V26
39-
public typealias CurrentLayer = Layer_V26
40-
public typealias CurrentLayerSize = LayerSize_V26
41-
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V26
42-
public typealias CurrentLayerStroke = LayerStroke_V26
43-
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V26
44-
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V26
45-
public typealias CurrentLightType = LightType_V26
46-
public typealias CurrentMediaKey = MediaKey_V26
47-
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V26
48-
public typealias CurrentNetworkRequestType = NetworkRequestType_V26
49-
public typealias CurrentPathPoint = PathPoint_V26
50-
public typealias CurrentPlane = Plane_V26
51-
public typealias CurrentPoint3D = Point3D_V26
52-
public typealias CurrentPoint4D = Point4D_V26
53-
public typealias CurrentPortValueComparable = PortValueComparable_V26
54-
public typealias CurrentPreviewSize = PreviewSize_V26
55-
public typealias CurrentRGBA = RGBA_V26
56-
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V26
57-
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V26
58-
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V26
59-
public typealias CurrentScrollMode = ScrollMode_V26
60-
public typealias CurrentShapeCommand = ShapeCommand_V26
61-
public typealias CurrentShapeCommandType = ShapeCommandType_V26
62-
public typealias CurrentShapeCoordinates = ShapeCoordinates_V26
63-
public typealias CurrentShapeAndRect = ShapeAndRect_V26
64-
public typealias CurrentStitchDocument = StitchDocument_V26
65-
public typealias CurrentStitchBlendMode = StitchBlendMode_V26
66-
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V26
67-
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V26
68-
public typealias CurrentStitchMapType = StitchMapType_V26
69-
public typealias CurrentStitchFont = StitchFont_V26
70-
public typealias CurrentStitchFontChoice = StitchFontChoice_V26
71-
public typealias CurrentStitchFontWeight = StitchFontWeight_V26
72-
public typealias CurrentStitchJSON = StitchJSON_V26
73-
public typealias CurrentStitchOrientation = StitchOrientation_V26
74-
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V26
75-
public typealias CurrentTextTransform = TextTransform_V26
76-
public typealias CurrentTriangleData = TriangleData_V26
77-
public typealias CurrentPortValue = PortValue_V26
78-
public typealias CurrentUserVisibleType = UserVisibleType_V26
79-
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V26
80-
public typealias CurrentNodeConnectionType = NodeConnectionType_V26
81-
public typealias CurrentLayerInputType = LayerInputType_V26
82-
public typealias CurrentNodeIOPortType = NodeIOPortType_V26
83-
public typealias CurrentStrokeLineCap = StrokeLineCap_V26
84-
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V26
85-
public typealias CurrentStitchStringValue = StitchStringValue_V26
86-
public typealias CurrentStitchContentMode = StitchContentMode_V26
87-
public typealias CurrentStitchSpacing = StitchSpacing_V26
88-
public typealias CurrentStitchPadding = StitchPadding_V26
89-
public typealias CurrentSizingScenario = SizingScenario_V26
90-
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V26
91-
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V26
92-
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V26
93-
public typealias CurrentCanvasItemId = CanvasItemId_V26
94-
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V26
95-
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V26
96-
public typealias CurrentPinToId = PinToId_V26
97-
public typealias CurrentLayerInputEntity = LayerInputEntity_V26
98-
public typealias CurrentLayerInputPort = LayerInputPort_V26
99-
public typealias CurrentLayerInputKeyPathType = LayerInputKeyPathType_V26
100-
public typealias CurrentUnpackedPortType = UnpackedPortType_V26
101-
public typealias CurrentStitchTransform = StitchTransform_V26
102-
public typealias CurrentStitchComponent = StitchComponent_V26
103-
public typealias CurrentComponentEntity = ComponentEntity_V26
104-
public typealias CurrentGraphEntity = GraphEntity_V26
105-
public typealias CurrentGraphSaveLocation = GraphSaveLocation_V26
106-
public typealias CurrentGraphDocumentPath = GraphDocumentPath_V26
107-
public typealias CurrentStitchSystemType = StitchSystemType_V26
108-
public typealias CurrentStitchSystem = StitchSystem_V26
109-
public typealias CurrentDeviceAppearance = DeviceAppearance_V26
110-
public typealias CurrentMaterialThickness = MaterialThickness_V26
12+
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V27
13+
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V27
14+
public typealias CurrentCameraSettings = CameraSettings_V27
15+
public typealias CurrentCommentBoxData = CommentBoxData_V27
16+
public typealias CurrentCustomShape = CustomShape_V27
17+
public typealias CurrentDataType = DataType_V27
18+
public typealias CurrentDelayStyle = DelayStyle_V27
19+
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V27
20+
public typealias CurrentExpansionDirection = ExpansionDirection_V27
21+
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V27
22+
public typealias CurrentPatch = Patch_V27
23+
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V27
24+
public typealias CurrentLayerDimension = LayerDimension_V27
25+
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V27
26+
public typealias CurrentLayerNodeId = LayerNodeId_V27
27+
public typealias CurrentNodeEntity = NodeEntity_V27
28+
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V27
29+
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V27
30+
public typealias CurrentSplitterType = SplitterType_V27
31+
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V27
32+
public typealias CurrentJSONCurveTo = JSONCurveTo_V27
33+
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V27
34+
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V27
35+
public typealias CurrentSidebarLayerData = SidebarLayerData_V27
36+
public typealias CurrentNodeKind = NodeKind_V27
37+
public typealias CurrentAnchoring = Anchoring_V27
38+
public typealias CurrentCameraDirection = CameraDirection_V27
39+
public typealias CurrentLayer = Layer_V27
40+
public typealias CurrentLayerSize = LayerSize_V27
41+
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V27
42+
public typealias CurrentLayerStroke = LayerStroke_V27
43+
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V27
44+
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V27
45+
public typealias CurrentLightType = LightType_V27
46+
public typealias CurrentMediaKey = MediaKey_V27
47+
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V27
48+
public typealias CurrentNetworkRequestType = NetworkRequestType_V27
49+
public typealias CurrentPathPoint = PathPoint_V27
50+
public typealias CurrentPlane = Plane_V27
51+
public typealias CurrentPoint3D = Point3D_V27
52+
public typealias CurrentPoint4D = Point4D_V27
53+
public typealias CurrentPortValueComparable = PortValueComparable_V27
54+
public typealias CurrentPreviewSize = PreviewSize_V27
55+
public typealias CurrentRGBA = RGBA_V27
56+
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V27
57+
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V27
58+
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V27
59+
public typealias CurrentScrollMode = ScrollMode_V27
60+
public typealias CurrentShapeCommand = ShapeCommand_V27
61+
public typealias CurrentShapeCommandType = ShapeCommandType_V27
62+
public typealias CurrentShapeCoordinates = ShapeCoordinates_V27
63+
public typealias CurrentShapeAndRect = ShapeAndRect_V27
64+
public typealias CurrentStitchDocument = StitchDocument_V27
65+
public typealias CurrentStitchBlendMode = StitchBlendMode_V27
66+
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V27
67+
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V27
68+
public typealias CurrentStitchMapType = StitchMapType_V27
69+
public typealias CurrentStitchFont = StitchFont_V27
70+
public typealias CurrentStitchFontChoice = StitchFontChoice_V27
71+
public typealias CurrentStitchFontWeight = StitchFontWeight_V27
72+
public typealias CurrentStitchJSON = StitchJSON_V27
73+
public typealias CurrentStitchOrientation = StitchOrientation_V27
74+
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V27
75+
public typealias CurrentTextTransform = TextTransform_V27
76+
public typealias CurrentTriangleData = TriangleData_V27
77+
public typealias CurrentPortValue = PortValue_V27
78+
public typealias CurrentUserVisibleType = UserVisibleType_V27
79+
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V27
80+
public typealias CurrentNodeConnectionType = NodeConnectionType_V27
81+
public typealias CurrentLayerInputType = LayerInputType_V27
82+
public typealias CurrentNodeIOPortType = NodeIOPortType_V27
83+
public typealias CurrentStrokeLineCap = StrokeLineCap_V27
84+
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V27
85+
public typealias CurrentStitchStringValue = StitchStringValue_V27
86+
public typealias CurrentStitchContentMode = StitchContentMode_V27
87+
public typealias CurrentStitchSpacing = StitchSpacing_V27
88+
public typealias CurrentStitchPadding = StitchPadding_V27
89+
public typealias CurrentSizingScenario = SizingScenario_V27
90+
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V27
91+
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V27
92+
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V27
93+
public typealias CurrentCanvasItemId = CanvasItemId_V27
94+
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V27
95+
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V27
96+
public typealias CurrentPinToId = PinToId_V27
97+
public typealias CurrentLayerInputEntity = LayerInputEntity_V27
98+
public typealias CurrentLayerInputPort = LayerInputPort_V27
99+
public typealias CurrentLayerInputKeyPathType = LayerInputKeyPathType_V27
100+
public typealias CurrentUnpackedPortType = UnpackedPortType_V27
101+
public typealias CurrentStitchTransform = StitchTransform_V27
102+
public typealias CurrentStitchComponent = StitchComponent_V27
103+
public typealias CurrentComponentEntity = ComponentEntity_V27
104+
public typealias CurrentGraphEntity = GraphEntity_V27
105+
public typealias CurrentGraphSaveLocation = GraphSaveLocation_V27
106+
public typealias CurrentGraphDocumentPath = GraphDocumentPath_V27
107+
public typealias CurrentStitchSystemType = StitchSystemType_V27
108+
public typealias CurrentStitchSystem = StitchSystem_V27
109+
public typealias CurrentDeviceAppearance = DeviceAppearance_V27
110+
public typealias CurrentMaterialThickness = MaterialThickness_V27
111111

112112
// MARK: - end
113113

@@ -138,4 +138,5 @@ public enum StitchSchemaVersion: Int, VersionType {
138138
case _V24 = 24
139139
case _V25 = 25
140140
case _V26 = 26
141+
case _V27 = 27
141142
}

Sources/StitchSchemaKit/V26/Document/StitchComponent_V26.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public enum StitchComponent_V26: StitchSchemaVersionable {
3232

3333
extension StitchComponent_V26.StitchComponent {
3434
public init(previousInstance: StitchComponent_V26.PreviousInstance) {
35-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
36-
fatalError()
35+
self = .init(saveLocation: .init(previousInstance: previousInstance.saveLocation),
36+
graph: .init(previousInstance: previousInstance.graph))
3737
}
3838
}

Sources/StitchSchemaKit/V26/Graph/GraphDocumentPath_V26.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public enum GraphDocumentPath_V26: StitchSchemaVersionable {
3131

3232
extension GraphDocumentPath_V26.GraphDocumentPath {
3333
public init(previousInstance: GraphDocumentPath_V26.PreviousInstance) {
34-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
35-
fatalError()
34+
self = .init(docId: previousInstance.docId,
35+
componentId: previousInstance.componentId,
36+
componentsPath: previousInstance.componentsPath)
3637
}
3738
}

Sources/StitchSchemaKit/V26/Graph/GraphEntity_V26.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ public enum GraphEntity_V26: StitchSchemaVersionable {
4040

4141
extension GraphEntity_V26.GraphEntity: StitchVersionedCodable {
4242
public init(previousInstance: GraphEntity_V26.PreviousInstance) {
43-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
44-
fatalError()
43+
self = .init(id: previousInstance.id,
44+
name: previousInstance.name,
45+
nodes: .init(previousElements: previousInstance.nodes),
46+
orderedSidebarLayers: .init(previousElements: previousInstance.orderedSidebarLayers),
47+
commentBoxes: .init(previousElements: previousInstance.commentBoxes))
4548
}
4649
}

Sources/StitchSchemaKit/V26/Graph/GraphSaveLocation_V26.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ public enum GraphSaveLocation_V26: StitchSchemaVersionable {
2626

2727
extension GraphSaveLocation_V26.GraphSaveLocation {
2828
public init(previousInstance: GraphSaveLocation_V26.PreviousInstance) {
29-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
30-
fatalError()
29+
switch previousInstance {
30+
case .document(let uuid):
31+
self = .document(uuid)
32+
case .localComponent(let path):
33+
self = .localComponent(.init(previousInstance: path))
34+
case .systemComponent(let type, let uuid):
35+
self = .systemComponent(.init(previousInstance: type), uuid)
36+
case .system(let type):
37+
self = .system(.init(previousInstance: type))
38+
}
3139
}
3240
}

Sources/StitchSchemaKit/V26/Graph/StitchSystem_V26.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public enum StitchSystem_V26: StitchSchemaVersionable {
2929

3030
extension StitchSystem_V26.StitchSystem {
3131
public init(previousInstance: StitchSystem_V26.PreviousInstance) {
32-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
33-
fatalError()
34-
}
32+
self = .init(id: .init(previousInstance: previousInstance.id),
33+
name: previousInstance.name) }
3534
}

Sources/StitchSchemaKit/V26/Graph/SystemType_V26.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ extension StitchSystemType_V26.StitchSystemType {
4040

4141
extension StitchSystemType_V26.StitchSystemType {
4242
public init(previousInstance: StitchSystemType_V26.PreviousInstance) {
43-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
44-
fatalError()
43+
switch previousInstance {
44+
case .userLibrary:
45+
self = .userLibrary
46+
case .system(let id):
47+
self = .system(id)
48+
}
4549
}
4650
}

Sources/StitchSchemaKit/V26/Node/Component/ComponentEntity_V26.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public enum ComponentEntity_V26: StitchSchemaVersionable {
3131

3232
extension ComponentEntity_V26.ComponentEntity: StitchVersionedCodable {
3333
public init(previousInstance: ComponentEntity_V26.PreviousInstance) {
34-
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
35-
fatalError()
34+
self = .init(componentId: previousInstance.componentId,
35+
inputs: .init(previousElements: previousInstance.inputs),
36+
canvasEntity: .init(previousInstance: previousInstance.canvasEntity))
3637
}
3738
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// CommentBoxData_V27.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_V27: StitchSchemaVersionable {
12+
// MARK: - ensure versions are correct
13+
public static let version: StitchSchemaVersion = StitchSchemaVersion._V27
14+
public typealias PreviousInstance = CommentBoxData_V26.CommentBoxData
15+
public typealias CanvasItemId = CanvasItemId_V27.CanvasItemId
16+
// MARK: - endif
17+
18+
public struct CommentBoxData: 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_V27.CommentBoxData: StitchVersionedCodable {
59+
public init(previousInstance: CommentBoxData_V27.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 V23, 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)