Skip to content

Commit 0e64588

Browse files
Introduce v26 (#109)
2 parents 43ddf22 + c1d53cf commit 0e64588

100 files changed

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

1111
// MARK: - UPDATE VERSION NUMBERS HERE
12-
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V25
13-
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V25
14-
public typealias CurrentCameraSettings = CameraSettings_V25
15-
public typealias CurrentCommentBoxData = CommentBoxData_V25
16-
public typealias CurrentCustomShape = CustomShape_V25
17-
public typealias CurrentDataType = DataType_V25
18-
public typealias CurrentDelayStyle = DelayStyle_V25
19-
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V25
20-
public typealias CurrentExpansionDirection = ExpansionDirection_V25
21-
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V25
22-
public typealias CurrentPatch = Patch_V25
23-
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V25
24-
public typealias CurrentLayerDimension = LayerDimension_V25
25-
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V25
26-
public typealias CurrentLayerNodeId = LayerNodeId_V25
27-
public typealias CurrentNodeEntity = NodeEntity_V25
28-
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V25
29-
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V25
30-
public typealias CurrentSplitterType = SplitterType_V25
31-
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V25
32-
public typealias CurrentJSONCurveTo = JSONCurveTo_V25
33-
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V25
34-
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V25
35-
public typealias CurrentSidebarLayerData = SidebarLayerData_V25
36-
public typealias CurrentNodeKind = NodeKind_V25
37-
public typealias CurrentAnchoring = Anchoring_V25
38-
public typealias CurrentCameraDirection = CameraDirection_V25
39-
public typealias CurrentLayer = Layer_V25
40-
public typealias CurrentLayerSize = LayerSize_V25
41-
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V25
42-
public typealias CurrentLayerStroke = LayerStroke_V25
43-
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V25
44-
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V25
45-
public typealias CurrentLightType = LightType_V25
46-
public typealias CurrentMediaKey = MediaKey_V25
47-
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V25
48-
public typealias CurrentNetworkRequestType = NetworkRequestType_V25
49-
public typealias CurrentPathPoint = PathPoint_V25
50-
public typealias CurrentPlane = Plane_V25
51-
public typealias CurrentPoint3D = Point3D_V25
52-
public typealias CurrentPoint4D = Point4D_V25
53-
public typealias CurrentPortValueComparable = PortValueComparable_V25
54-
public typealias CurrentPreviewSize = PreviewSize_V25
55-
public typealias CurrentRGBA = RGBA_V25
56-
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V25
57-
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V25
58-
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V25
59-
public typealias CurrentScrollMode = ScrollMode_V25
60-
public typealias CurrentShapeCommand = ShapeCommand_V25
61-
public typealias CurrentShapeCommandType = ShapeCommandType_V25
62-
public typealias CurrentShapeCoordinates = ShapeCoordinates_V25
63-
public typealias CurrentShapeAndRect = ShapeAndRect_V25
64-
public typealias CurrentStitchDocument = StitchDocument_V25
65-
public typealias CurrentStitchBlendMode = StitchBlendMode_V25
66-
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V25
67-
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V25
68-
public typealias CurrentStitchMapType = StitchMapType_V25
69-
public typealias CurrentStitchFont = StitchFont_V25
70-
public typealias CurrentStitchFontChoice = StitchFontChoice_V25
71-
public typealias CurrentStitchFontWeight = StitchFontWeight_V25
72-
public typealias CurrentStitchJSON = StitchJSON_V25
73-
public typealias CurrentStitchOrientation = StitchOrientation_V25
74-
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V25
75-
public typealias CurrentTextTransform = TextTransform_V25
76-
public typealias CurrentTriangleData = TriangleData_V25
77-
public typealias CurrentPortValue = PortValue_V25
78-
public typealias CurrentUserVisibleType = UserVisibleType_V25
79-
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V25
80-
public typealias CurrentNodeConnectionType = NodeConnectionType_V25
81-
public typealias CurrentLayerInputType = LayerInputType_V25
82-
public typealias CurrentNodeIOPortType = NodeIOPortType_V25
83-
public typealias CurrentStrokeLineCap = StrokeLineCap_V25
84-
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V25
85-
public typealias CurrentStitchStringValue = StitchStringValue_V25
86-
public typealias CurrentStitchContentMode = StitchContentMode_V25
87-
public typealias CurrentStitchSpacing = StitchSpacing_V25
88-
public typealias CurrentStitchPadding = StitchPadding_V25
89-
public typealias CurrentSizingScenario = SizingScenario_V25
90-
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V25
91-
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V25
92-
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V25
93-
public typealias CurrentCanvasItemId = CanvasItemId_V25
94-
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V25
95-
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V25
96-
public typealias CurrentPinToId = PinToId_V25
97-
public typealias CurrentLayerInputEntity = LayerInputEntity_V25
98-
public typealias CurrentLayerInputPort = LayerInputPort_V25
99-
public typealias CurrentLayerInputKeyPathType = LayerInputKeyPathType_V25
100-
public typealias CurrentUnpackedPortType = UnpackedPortType_V25
101-
public typealias CurrentStitchTransform = StitchTransform_V25
102-
public typealias CurrentStitchComponent = StitchComponent_V25
103-
public typealias CurrentComponentEntity = ComponentEntity_V25
104-
public typealias CurrentGraphEntity = GraphEntity_V25
105-
public typealias CurrentGraphSaveLocation = GraphSaveLocation_V25
106-
public typealias CurrentGraphDocumentPath = GraphDocumentPath_V25
107-
public typealias CurrentStitchSystemType = StitchSystemType_V25
108-
public typealias CurrentStitchSystem = StitchSystem_V25
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
109111

110112
// MARK: - end
111113

@@ -135,4 +137,5 @@ public enum StitchSchemaVersion: Int, VersionType {
135137
case _V23 = 23
136138
case _V24 = 24
137139
case _V25 = 25
140+
case _V26 = 26
138141
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// CommentBoxData_V26.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_V26: StitchSchemaVersionable {
12+
// MARK: - ensure versions are correct
13+
public static let version: StitchSchemaVersion = StitchSchemaVersion._V26
14+
public typealias PreviousInstance = CommentBoxData_V25.CommentBoxData
15+
public typealias CanvasItemId = CanvasItemId_V26.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_V26.CommentBoxData: StitchVersionedCodable {
59+
public init(previousInstance: CommentBoxData_V26.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+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Elliot Boschwitz on 8/17/24.
6+
//
7+
8+
import Foundation
9+
10+
public enum StitchComponent_V26: StitchSchemaVersionable {
11+
12+
// MARK: - ensure versions are correct
13+
public static let version = StitchSchemaVersion._V26
14+
public typealias PreviousInstance = StitchComponent_V25.StitchComponent
15+
public typealias GraphEntity = GraphEntity_V26.GraphEntity
16+
public typealias GraphSaveLocation = GraphSaveLocation_V26.GraphSaveLocation
17+
public typealias SidebarLayerList = [SidebarLayerData_V26.SidebarLayerData]
18+
// MARK: - end
19+
20+
public struct StitchComponent: StitchVersionedCodable, Hashable, Sendable {
21+
// Share location, saved here due to static helpers for sharing
22+
public var saveLocation: GraphSaveLocation
23+
public var graph: GraphEntity
24+
25+
public init(saveLocation: GraphSaveLocation,
26+
graph: GraphEntity) {
27+
self.saveLocation = saveLocation
28+
self.graph = graph
29+
}
30+
}
31+
}
32+
33+
extension StitchComponent_V26.StitchComponent {
34+
public init(previousInstance: StitchComponent_V26.PreviousInstance) {
35+
// TODO: not migrating during V25 -> V26 because has not yet been released as feature
36+
fatalError()
37+
}
38+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// StitchDocument.swift
3+
// Stitch
4+
//
5+
// Created by Elliot Boschwitz on 10/19/23.
6+
//
7+
8+
import Foundation
9+
import SwiftUI
10+
11+
public enum StitchDocument_V26: StitchSchemaVersionable {
12+
13+
// MARK: - ensure versions are correct
14+
public static let version = StitchSchemaVersion._V26
15+
public typealias PreviousInstance = StitchDocument_V25.StitchDocument
16+
public typealias GraphEntity = GraphEntity_V26.GraphEntity
17+
public typealias PreviewSize = PreviewSize_V26.PreviewSize
18+
public typealias CameraSettings = CameraSettings_V26.CameraSettings
19+
// MARK: - end
20+
21+
public struct StitchDocument: StitchVersionedCodable, Equatable, Sendable {
22+
// Node data
23+
public var graph: GraphEntity
24+
25+
// Preview window
26+
public let previewWindowSize: CGSize
27+
public let previewSizeDevice: PreviewSize
28+
public let previewWindowBackgroundColor: Color
29+
30+
// Graph positioning data
31+
public let localPosition: CGPoint
32+
public let zoomData: CGFloat
33+
34+
public let cameraSettings: CameraSettings
35+
36+
public init(graph: GraphEntity,
37+
previewWindowSize: CGSize,
38+
previewSizeDevice: PreviewSize,
39+
previewWindowBackgroundColor: Color,
40+
localPosition: CGPoint,
41+
zoomData: CGFloat,
42+
cameraSettings: CameraSettings) {
43+
self.graph = graph
44+
self.previewWindowSize = previewWindowSize
45+
self.previewSizeDevice = previewSizeDevice
46+
self.previewWindowBackgroundColor = previewWindowBackgroundColor
47+
self.localPosition = localPosition
48+
self.zoomData = zoomData
49+
self.cameraSettings = cameraSettings
50+
}
51+
}
52+
}
53+
54+
extension StitchDocument_V26.StitchDocument {
55+
public init(previousInstance: StitchDocument_V26.PreviousInstance) {
56+
self.init(graph: .init(id: previousInstance.graph.id,
57+
name: previousInstance.graph.name,
58+
nodes: .init(previousElements: previousInstance.graph.nodes),
59+
orderedSidebarLayers: .init(previousElements: previousInstance.graph.orderedSidebarLayers),
60+
commentBoxes: .init(previousElements: previousInstance.graph.commentBoxes)),
61+
previewWindowSize: previousInstance.previewWindowSize,
62+
previewSizeDevice: .init(previousInstance: previousInstance.previewSizeDevice),
63+
previewWindowBackgroundColor: previousInstance.previewWindowBackgroundColor,
64+
localPosition: previousInstance.localPosition,
65+
zoomData: previousInstance.zoomData,
66+
cameraSettings: .init(previousInstance: previousInstance.cameraSettings))
67+
}
68+
}

0 commit comments

Comments
 (0)