diff --git a/Sources/Adwaita/Model/Data Flow/Binding.swift b/Sources/Adwaita/Model/Data Flow/Binding.swift index e05d1ac..31aafb4 100644 --- a/Sources/Adwaita/Model/Data Flow/Binding.swift +++ b/Sources/Adwaita/Model/Data Flow/Binding.swift @@ -146,3 +146,12 @@ extension Binding where Value: MutableCollection, Value.Element: Identifiable { } } + +extension Binding: CustomStringConvertible where Value: CustomStringConvertible { + + /// A textual description of the wrapped value. + public var description: String { + wrappedValue.description + } + +} diff --git a/Sources/Adwaita/Model/Enumerations/Icon.swift b/Sources/Adwaita/Model/Enumerations/Icon.swift index 348751c..41718ac 100644 --- a/Sources/Adwaita/Model/Enumerations/Icon.swift +++ b/Sources/Adwaita/Model/Enumerations/Icon.swift @@ -9,7 +9,7 @@ import Foundation // swiftlint:disable type_body_length file_length /// An icon. -public enum Icon { +public enum Icon: CustomStringConvertible { /// A preinstalled icon. /// - Parameter icon: The default icon. @@ -28,6 +28,9 @@ public enum Icon { } } + /// A textual description of the icon. + public var description: String { string } + /// A preinstalled icon. public enum DefaultIcon: String { // swiftlint:disable missing_docs identifier_name diff --git a/Sources/Adwaita/Model/Extensions/Array.swift b/Sources/Adwaita/Model/Extensions/Array.swift index c11abb0..ca9add2 100644 --- a/Sources/Adwaita/Model/Extensions/Array.swift +++ b/Sources/Adwaita/Model/Extensions/Array.swift @@ -12,6 +12,23 @@ extension Array: AnyView where Element == AnyView { /// The array's view body is the array itself. public var viewContent: Body { self } + /// Get the debug tree for an array of views. + /// - Parameter parameters: Whether the widget parameters should be visible in the tree. + /// - Returns: The tree. + public func getBodyDebugTree(parameters: Bool) -> String { + var description = "" + for view in self { + let viewDescription: String + if let widget = view as? Widget { + viewDescription = widget.getViewDescription(parameters: parameters) + } else { + viewDescription = view.getDebugTree(parameters: parameters) + } + description += viewDescription + } + return description + } + /// Get a widget from a collection of views. /// - Parameter modifiers: Modify views before being updated. /// - Returns: A widget. diff --git a/Sources/Adwaita/Model/Extensions/DefaultStringInterpolation.swift b/Sources/Adwaita/Model/Extensions/DefaultStringInterpolation.swift new file mode 100644 index 0000000..80b264a --- /dev/null +++ b/Sources/Adwaita/Model/Extensions/DefaultStringInterpolation.swift @@ -0,0 +1,35 @@ +// +// DefaultStringInterpolation.swift +// Adwaita +// +// Created by david-swift on 01.05.24. +// +// Thanks to Eneko Alonso, Pyry Jahkola, cukr for the comments in this Swift forum discussion: +// "Multi-line string nested indentation with interpolation" +// https://forums.swift.org/t/multi-line-string-nested-indentation-with-interpolation/36933 +// + +extension DefaultStringInterpolation { + + /// Preserve the indentation in a multi line string. + /// - Parameter string: The string. + /// + /// Use it the following way: + /// """ + /// Hello + /// \(indented: "World\n Test") + /// """ + public mutating func appendInterpolation(indented string: String) { + // swiftlint:disable compiler_protocol_init + let indent = String(stringInterpolation: self).reversed().prefix { " \t".contains($0) } + // swiftlint:enable compiler_protocol_init + if indent.isEmpty { + appendInterpolation(string) + } else { + appendLiteral( + string.split(separator: "\n", omittingEmptySubsequences: false).joined(separator: "\n" + indent) + ) + } + } + +} diff --git a/Sources/Adwaita/Model/Extensions/Optional.swift b/Sources/Adwaita/Model/Extensions/Optional.swift new file mode 100644 index 0000000..6be93fc --- /dev/null +++ b/Sources/Adwaita/Model/Extensions/Optional.swift @@ -0,0 +1,15 @@ +// +// Optional.swift +// Adwaita +// +// Created by david-swift on 01.05.20204. +// + +extension Optional: CustomStringConvertible where Wrapped: CustomStringConvertible { + + /// A textual description of the wrapped value. + public var description: String { + self?.description ?? "nil" + } + +} diff --git a/Sources/Adwaita/Model/User Interface/View/AnyView.swift b/Sources/Adwaita/Model/User Interface/View/AnyView.swift index e779630..6bc4417 100644 --- a/Sources/Adwaita/Model/User Interface/View/AnyView.swift +++ b/Sources/Adwaita/Model/User Interface/View/AnyView.swift @@ -15,6 +15,20 @@ public protocol AnyView { extension AnyView { + /// Get the view's debug tree. + /// - Parameter parameters: Whether the widget parameters should be included in the debug tree. + /// - Returns: A textual description. + public func getDebugTree(parameters: Bool) -> String { + if let body = self as? Body { + return body.getBodyDebugTree(parameters: parameters) + } + return """ + \(Self.self) { + \(indented: viewContent.getBodyDebugTree(parameters: parameters)) + } + """ + } + func getModified(modifiers: [(AnyView) -> AnyView]) -> AnyView { var modified: AnyView = self for modifier in modifiers { diff --git a/Sources/Adwaita/Model/User Interface/View/Widget.swift b/Sources/Adwaita/Model/User Interface/View/Widget.swift index af21c52..dc59fad 100644 --- a/Sources/Adwaita/Model/User Interface/View/Widget.swift +++ b/Sources/Adwaita/Model/User Interface/View/Widget.swift @@ -8,6 +8,10 @@ /// A widget is a view that know about its GTUI widget. public protocol Widget: AnyView { + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { get } + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { get } /// The view storage. /// - Parameter modifiers: Modify views before being updated. func container(modifiers: [(AnyView) -> AnyView]) -> ViewStorage @@ -25,4 +29,29 @@ extension Widget { /// A widget's view is empty. public var viewContent: Body { [] } + /// A description of the view. + public func getViewDescription(parameters: Bool) -> String { + var content = "" + for element in debugTreeContent { + if content.isEmpty { + content += """ + { + \(indented: element.body.getDebugTree(parameters: parameters)) + } + """ + } else { + content += """ + \(element.0): { + \(indented: element.body.getDebugTree(parameters: parameters)) + } + """ + } + } + if parameters { + let parametersString = debugTreeParameters.map { "\($0.0): \($0.value)" }.joined(separator: ", ") + return "\(Self.self)(\(parametersString))\(content)" + } + return "\(Self.self)\(content)" + } + } diff --git a/Sources/Adwaita/View/Dialogs/AboutDialog.swift b/Sources/Adwaita/View/Dialogs/AboutDialog.swift index f4a247d..7978b46 100644 --- a/Sources/Adwaita/View/Dialogs/AboutDialog.swift +++ b/Sources/Adwaita/View/Dialogs/AboutDialog.swift @@ -29,6 +29,24 @@ struct AboutDialog: Widget { /// The link for opening issues. var issues: URL? + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("visible", value: visible), + ("appName", value: appName), + ("developer", value: developer), + ("version", value: version), + ("icon", value: icon), + ("website", value: website), + ("issues", value: issues) + ] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("child", body: [child])] + } + /// The ID for the dialog's storage. let dialogID = "dialog" diff --git a/Sources/Adwaita/View/Dialogs/AlertDialog.swift b/Sources/Adwaita/View/Dialogs/AlertDialog.swift index 5aa4e8a..9b91baf 100644 --- a/Sources/Adwaita/View/Dialogs/AlertDialog.swift +++ b/Sources/Adwaita/View/Dialogs/AlertDialog.swift @@ -33,6 +33,22 @@ public struct AlertDialog: Widget { /// The child view. var child: AnyView + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("visible", value: visible), + ("id", value: id), + ("heading", value: heading), + ("body", value: body), + ("responses", value: responses) + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [("child", body: [child])] + } + /// Information about a response. struct Response: Identifiable { diff --git a/Sources/Adwaita/View/Dialogs/Dialog.swift b/Sources/Adwaita/View/Dialogs/Dialog.swift index b633efe..2d6ff71 100644 --- a/Sources/Adwaita/View/Dialogs/Dialog.swift +++ b/Sources/Adwaita/View/Dialogs/Dialog.swift @@ -30,6 +30,22 @@ struct Dialog: Widget { /// The ID for the content's storage. let contentID = "content" + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("visible", value: visible), + ("id", value: id), + ("title", value: title), + ("width", value: width), + ("height", value: height) + ] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("child", body: [child]), ("content", body: content)] + } + /// Get the container of the child. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The view storage. diff --git a/Sources/Adwaita/View/ForEach.swift b/Sources/Adwaita/View/ForEach.swift index d0985e4..1722382 100644 --- a/Sources/Adwaita/View/ForEach.swift +++ b/Sources/Adwaita/View/ForEach.swift @@ -18,6 +18,21 @@ public struct ForEach: Widget where Element: Identifiable { /// Whether the list is horizontal. var horizontal: Bool + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("elements", value: elements), + ("horizontal", value: horizontal) + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + elements.map { element in + ("\(element)", body: content(element)) + } + } + /// Initialize `ForEach`. public init(_ elements: [Element], horizontal: Bool = false, @ViewBuilder content: @escaping (Element) -> Body) { self.elements = elements diff --git a/Sources/Adwaita/View/Generated/ActionRow.swift b/Sources/Adwaita/View/Generated/ActionRow.swift index f8f2ba8..342fba7 100644 --- a/Sources/Adwaita/View/Generated/ActionRow.swift +++ b/Sources/Adwaita/View/Generated/ActionRow.swift @@ -2,7 +2,7 @@ // ActionRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -104,6 +104,20 @@ public struct ActionRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("iconName", value: "\(iconName)"), ("subtitle", value: "\(subtitle)"), ("subtitleLines", value: "\(subtitleLines)"), ("subtitleSelectable", value: "\(subtitleSelectable)"), ("title", value: "\(title)"), ("titleLines", value: "\(titleLines)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("activated", value: "\(activated)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("activatableWidget", body: self.activatableWidget?() ?? []),] + + content.append(("suffix", body: self.suffix())) + content.append(("prefix", body: self.prefix())) + return content + } + /// Initialize `ActionRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Avatar.swift b/Sources/Adwaita/View/Generated/Avatar.swift index dadf8dc..c84705f 100644 --- a/Sources/Adwaita/View/Generated/Avatar.swift +++ b/Sources/Adwaita/View/Generated/Avatar.swift @@ -2,7 +2,7 @@ // Avatar.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -55,6 +55,18 @@ public struct Avatar: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("iconName", value: "\(iconName)"), ("showInitials", value: "\(showInitials)"), ("size", value: "\(size)"), ("text", value: "\(text)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `Avatar`. public init(showInitials: Bool, size: Int) { self.showInitials = showInitials diff --git a/Sources/Adwaita/View/Generated/Banner.swift b/Sources/Adwaita/View/Generated/Banner.swift index 4408715..6ce9383 100644 --- a/Sources/Adwaita/View/Generated/Banner.swift +++ b/Sources/Adwaita/View/Generated/Banner.swift @@ -2,7 +2,7 @@ // Banner.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -60,6 +60,18 @@ public struct Banner: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("buttonLabel", value: "\(buttonLabel)"), ("revealed", value: "\(revealed)"), ("title", value: "\(title)"), ("useMarkup", value: "\(useMarkup)"), ("buttonClicked", value: "\(buttonClicked)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `Banner`. public init(title: String) { self.title = title diff --git a/Sources/Adwaita/View/Generated/Bin.swift b/Sources/Adwaita/View/Generated/Bin.swift index 3effc51..42c46e3 100644 --- a/Sources/Adwaita/View/Generated/Bin.swift +++ b/Sources/Adwaita/View/Generated/Bin.swift @@ -2,7 +2,7 @@ // Bin.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -31,6 +31,18 @@ public struct Bin: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `Bin`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Box.swift b/Sources/Adwaita/View/Generated/Box.swift index 9811f08..d1c7804 100644 --- a/Sources/Adwaita/View/Generated/Box.swift +++ b/Sources/Adwaita/View/Generated/Box.swift @@ -2,7 +2,7 @@ // Box.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -68,6 +68,20 @@ public struct Box: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("baselineChild", value: "\(baselineChild)"), ("homogeneous", value: "\(homogeneous)"), ("spacing", value: "\(spacing)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + content.append(("append", body: self.append())) + content.append(("prepend", body: self.prepend())) + return content + } + /// Initialize `Box`. public init(spacing: Int) { self.spacing = spacing diff --git a/Sources/Adwaita/View/Generated/Button.swift b/Sources/Adwaita/View/Generated/Button.swift index 238b578..31436bd 100644 --- a/Sources/Adwaita/View/Generated/Button.swift +++ b/Sources/Adwaita/View/Generated/Button.swift @@ -2,7 +2,7 @@ // Button.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -85,6 +85,18 @@ public struct Button: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("actionName", value: "\(actionName)"), ("canShrink", value: "\(canShrink)"), ("hasFrame", value: "\(hasFrame)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("useUnderline", value: "\(useUnderline)"), ("activate", value: "\(activate)"), ("clicked", value: "\(clicked)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `Button`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ButtonContent.swift b/Sources/Adwaita/View/Generated/ButtonContent.swift index 6631550..94c9a64 100644 --- a/Sources/Adwaita/View/Generated/ButtonContent.swift +++ b/Sources/Adwaita/View/Generated/ButtonContent.swift @@ -2,7 +2,7 @@ // ButtonContent.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -74,6 +74,18 @@ public struct ButtonContent: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("canShrink", value: "\(canShrink)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("useUnderline", value: "\(useUnderline)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `ButtonContent`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Carousel.swift b/Sources/Adwaita/View/Generated/Carousel.swift index 1192fce..1691c5e 100644 --- a/Sources/Adwaita/View/Generated/Carousel.swift +++ b/Sources/Adwaita/View/Generated/Carousel.swift @@ -2,7 +2,7 @@ // Carousel.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -70,6 +70,20 @@ public struct Carousel: Widget where Element: Identifiable { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("allowLongSwipes", value: "\(allowLongSwipes)"), ("allowMouseDrag", value: "\(allowMouseDrag)"), ("allowScrollWheel", value: "\(allowScrollWheel)"), ("interactive", value: "\(interactive)"), ("nPages", value: "\(nPages)"), ("revealDuration", value: "\(revealDuration)"), ("spacing", value: "\(spacing)"), ("pageChanged", value: "\(pageChanged)"), ("elements", value: "\(elements)"),("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + content += elements.map { element in + ("\(element)", body: self.content(element)) + } + return content + } + /// Initialize `Carousel`. public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) { self.elements = elements diff --git a/Sources/Adwaita/View/Generated/CenterBox.swift b/Sources/Adwaita/View/Generated/CenterBox.swift index 931ff04..f80e769 100644 --- a/Sources/Adwaita/View/Generated/CenterBox.swift +++ b/Sources/Adwaita/View/Generated/CenterBox.swift @@ -2,7 +2,7 @@ // CenterBox.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -81,6 +81,18 @@ public struct CenterBox: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("shrinkCenterLast", value: "\(shrinkCenterLast)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("centerWidget", body: self.centerWidget?() ?? []), ("endWidget", body: self.endWidget?() ?? []), ("startWidget", body: self.startWidget?() ?? []),] + + return content + } + /// Initialize `CenterBox`. public init() { } diff --git a/Sources/Adwaita/View/Generated/CheckButton.swift b/Sources/Adwaita/View/Generated/CheckButton.swift index e710b0d..2701332 100644 --- a/Sources/Adwaita/View/Generated/CheckButton.swift +++ b/Sources/Adwaita/View/Generated/CheckButton.swift @@ -2,7 +2,7 @@ // CheckButton.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -114,6 +114,18 @@ public struct CheckButton: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("actionName", value: "\(actionName)"), ("active", value: "\(active)"), ("inconsistent", value: "\(inconsistent)"), ("label", value: "\(label)"), ("useUnderline", value: "\(useUnderline)"), ("activate", value: "\(activate)"), ("toggled", value: "\(toggled)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `CheckButton`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Clamp.swift b/Sources/Adwaita/View/Generated/Clamp.swift index 565b174..c26abc4 100644 --- a/Sources/Adwaita/View/Generated/Clamp.swift +++ b/Sources/Adwaita/View/Generated/Clamp.swift @@ -2,7 +2,7 @@ // Clamp.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -59,6 +59,18 @@ public struct Clamp: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("maximumSize", value: "\(maximumSize)"), ("tighteningThreshold", value: "\(tighteningThreshold)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `Clamp`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ComboRow.swift b/Sources/Adwaita/View/Generated/ComboRow.swift index 6c574f6..8196872 100644 --- a/Sources/Adwaita/View/Generated/ComboRow.swift +++ b/Sources/Adwaita/View/Generated/ComboRow.swift @@ -2,7 +2,7 @@ // ComboRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -128,6 +128,18 @@ public struct ComboRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("enableSearch", value: "\(enableSearch)"), ("iconName", value: "\(iconName)"), ("selected", value: "\(selected)"), ("subtitle", value: "\(subtitle)"), ("subtitleLines", value: "\(subtitleLines)"), ("subtitleSelectable", value: "\(subtitleSelectable)"), ("title", value: "\(title)"), ("titleLines", value: "\(titleLines)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useSubtitle", value: "\(useSubtitle)"), ("useUnderline", value: "\(useUnderline)"), ("activated", value: "\(activated)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("activatableWidget", body: self.activatableWidget?() ?? []),] + + return content + } + /// Initialize `ComboRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/EntryRow.swift b/Sources/Adwaita/View/Generated/EntryRow.swift index 72000af..32e9f8f 100644 --- a/Sources/Adwaita/View/Generated/EntryRow.swift +++ b/Sources/Adwaita/View/Generated/EntryRow.swift @@ -2,7 +2,7 @@ // EntryRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -96,6 +96,20 @@ public struct EntryRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("activatesDefault", value: "\(activatesDefault)"), ("enableEmojiCompletion", value: "\(enableEmojiCompletion)"), ("showApplyButton", value: "\(showApplyButton)"), ("textLength", value: "\(textLength)"), ("title", value: "\(title)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("apply", value: "\(apply)"), ("entryActivated", value: "\(entryActivated)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + content.append(("suffix", body: self.suffix())) + content.append(("prefix", body: self.prefix())) + return content + } + /// Initialize `EntryRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ExpanderRow.swift b/Sources/Adwaita/View/Generated/ExpanderRow.swift index 6d92067..58dda16 100644 --- a/Sources/Adwaita/View/Generated/ExpanderRow.swift +++ b/Sources/Adwaita/View/Generated/ExpanderRow.swift @@ -2,7 +2,7 @@ // ExpanderRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -90,6 +90,21 @@ public struct ExpanderRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("enableExpansion", value: "\(enableExpansion)"), ("expanded", value: "\(expanded)"), ("iconName", value: "\(iconName)"), ("showEnableSwitch", value: "\(showEnableSwitch)"), ("subtitle", value: "\(subtitle)"), ("subtitleLines", value: "\(subtitleLines)"), ("title", value: "\(title)"), ("titleLines", value: "\(titleLines)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + content.append(("rows", body: self.rows())) + content.append(("suffix", body: self.suffix())) + content.append(("prefix", body: self.prefix())) + return content + } + /// Initialize `ExpanderRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/FlowBox.swift b/Sources/Adwaita/View/Generated/FlowBox.swift index 7127d05..3bbb722 100644 --- a/Sources/Adwaita/View/Generated/FlowBox.swift +++ b/Sources/Adwaita/View/Generated/FlowBox.swift @@ -2,7 +2,7 @@ // FlowBox.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -143,6 +143,20 @@ public struct FlowBox: Widget where Element: Identifiable { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("acceptUnpairedRelease", value: "\(acceptUnpairedRelease)"), ("accessibleRole", value: "\(accessibleRole)"), ("activateOnSingleClick", value: "\(activateOnSingleClick)"), ("columnSpacing", value: "\(columnSpacing)"), ("homogeneous", value: "\(homogeneous)"), ("maxChildrenPerLine", value: "\(maxChildrenPerLine)"), ("minChildrenPerLine", value: "\(minChildrenPerLine)"), ("rowSpacing", value: "\(rowSpacing)"), ("activateCursorChild", value: "\(activateCursorChild)"), ("childActivated", value: "\(childActivated)"), ("moveCursor", value: "\(moveCursor)"), ("selectAll", value: "\(selectAll)"), ("selectedChildrenChanged", value: "\(selectedChildrenChanged)"), ("toggleCursorChild", value: "\(toggleCursorChild)"), ("unselectAll", value: "\(unselectAll)"), ("elements", value: "\(elements)"),("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + content += elements.map { element in + ("\(element)", body: self.content(element)) + } + return content + } + /// Initialize `FlowBox`. public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) { self.elements = elements diff --git a/Sources/Adwaita/View/Generated/HeaderBar.swift b/Sources/Adwaita/View/Generated/HeaderBar.swift index 6a9c0d0..bf4fc78 100644 --- a/Sources/Adwaita/View/Generated/HeaderBar.swift +++ b/Sources/Adwaita/View/Generated/HeaderBar.swift @@ -2,7 +2,7 @@ // HeaderBar.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -157,6 +157,20 @@ public struct HeaderBar: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("decorationLayout", value: "\(decorationLayout)"), ("showBackButton", value: "\(showBackButton)"), ("showEndTitleButtons", value: "\(showEndTitleButtons)"), ("showStartTitleButtons", value: "\(showStartTitleButtons)"), ("showTitle", value: "\(showTitle)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("titleWidget", body: self.titleWidget?() ?? []),] + + content.append(("start", body: self.start())) + content.append(("end", body: self.end())) + return content + } + /// Initialize `HeaderBar`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Label.swift b/Sources/Adwaita/View/Generated/Label.swift index 9815a76..e4e91ae 100644 --- a/Sources/Adwaita/View/Generated/Label.swift +++ b/Sources/Adwaita/View/Generated/Label.swift @@ -2,7 +2,7 @@ // Label.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -273,6 +273,18 @@ public struct Label: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("label", value: "\(label)"), ("lines", value: "\(lines)"), ("maxWidthChars", value: "\(maxWidthChars)"), ("mnemonicKeyval", value: "\(mnemonicKeyval)"), ("selectable", value: "\(selectable)"), ("singleLineMode", value: "\(singleLineMode)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("widthChars", value: "\(widthChars)"), ("wrap", value: "\(wrap)"), ("xalign", value: "\(xalign)"), ("yalign", value: "\(yalign)"), ("copyClipboard", value: "\(copyClipboard)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("mnemonicWidget", body: self.mnemonicWidget?() ?? []),] + + return content + } + /// Initialize `Label`. public init(label: String) { self.label = label diff --git a/Sources/Adwaita/View/Generated/LevelBar.swift b/Sources/Adwaita/View/Generated/LevelBar.swift index 78c46e3..3045dd2 100644 --- a/Sources/Adwaita/View/Generated/LevelBar.swift +++ b/Sources/Adwaita/View/Generated/LevelBar.swift @@ -2,7 +2,7 @@ // LevelBar.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -141,6 +141,18 @@ public struct LevelBar: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("inverted", value: "\(inverted)"), ("maxValue", value: "\(maxValue)"), ("minValue", value: "\(minValue)"), ("value", value: "\(value)"), ("offsetChanged", value: "\(offsetChanged)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `LevelBar`. public init() { } diff --git a/Sources/Adwaita/View/Generated/LinkButton.swift b/Sources/Adwaita/View/Generated/LinkButton.swift index 3bad52f..580409c 100644 --- a/Sources/Adwaita/View/Generated/LinkButton.swift +++ b/Sources/Adwaita/View/Generated/LinkButton.swift @@ -2,7 +2,7 @@ // LinkButton.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -87,6 +87,18 @@ public struct LinkButton: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("actionName", value: "\(actionName)"), ("canShrink", value: "\(canShrink)"), ("hasFrame", value: "\(hasFrame)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("uri", value: "\(uri)"), ("useUnderline", value: "\(useUnderline)"), ("visited", value: "\(visited)"), ("activate", value: "\(activate)"), ("clicked", value: "\(clicked)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `LinkButton`. public init(uri: String) { self.uri = uri diff --git a/Sources/Adwaita/View/Generated/ListBox.swift b/Sources/Adwaita/View/Generated/ListBox.swift index 46c395b..a7b7eca 100644 --- a/Sources/Adwaita/View/Generated/ListBox.swift +++ b/Sources/Adwaita/View/Generated/ListBox.swift @@ -2,7 +2,7 @@ // ListBox.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -120,6 +120,20 @@ public struct ListBox: Widget where Element: Identifiable { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("acceptUnpairedRelease", value: "\(acceptUnpairedRelease)"), ("accessibleRole", value: "\(accessibleRole)"), ("activateOnSingleClick", value: "\(activateOnSingleClick)"), ("showSeparators", value: "\(showSeparators)"), ("activateCursorRow", value: "\(activateCursorRow)"), ("moveCursor", value: "\(moveCursor)"), ("rowActivated", value: "\(rowActivated)"), ("rowSelected", value: "\(rowSelected)"), ("selectAll", value: "\(selectAll)"), ("selectedRowsChanged", value: "\(selectedRowsChanged)"), ("toggleCursorRow", value: "\(toggleCursorRow)"), ("unselectAll", value: "\(unselectAll)"), ("elements", value: "\(elements)"),("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + content += elements.map { element in + ("\(element)", body: self.content(element)) + } + return content + } + /// Initialize `ListBox`. public init(_ elements: [Element], @ViewBuilder content: @escaping (Element) -> Body) { self.elements = elements diff --git a/Sources/Adwaita/View/Generated/Menu.swift b/Sources/Adwaita/View/Generated/Menu.swift index bae359f..9d3c09f 100644 --- a/Sources/Adwaita/View/Generated/Menu.swift +++ b/Sources/Adwaita/View/Generated/Menu.swift @@ -2,7 +2,7 @@ // Menu.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -116,6 +116,18 @@ public struct Menu: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("active", value: "\(active)"), ("alwaysShowArrow", value: "\(alwaysShowArrow)"), ("canShrink", value: "\(canShrink)"), ("hasFrame", value: "\(hasFrame)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("menuModel", value: "\(menuModel)"), ("primary", value: "\(primary)"), ("useUnderline", value: "\(useUnderline)"), ("activate", value: "\(activate)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `Menu`. public init() { } diff --git a/Sources/Adwaita/View/Generated/NavigationView.swift b/Sources/Adwaita/View/Generated/NavigationView.swift index eca6e6f..a53d452 100644 --- a/Sources/Adwaita/View/Generated/NavigationView.swift +++ b/Sources/Adwaita/View/Generated/NavigationView.swift @@ -2,7 +2,7 @@ // NavigationView.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -167,6 +167,18 @@ public struct NavigationView: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("animateTransitions", value: "\(animateTransitions)"), ("popOnEscape", value: "\(popOnEscape)"), ("getNextPage", value: "\(getNextPage)"), ("popped", value: "\(popped)"), ("pushed", value: "\(pushed)"), ("replaced", value: "\(replaced)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `NavigationView`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Overlay.swift b/Sources/Adwaita/View/Generated/Overlay.swift index 5356e40..bd2eab7 100644 --- a/Sources/Adwaita/View/Generated/Overlay.swift +++ b/Sources/Adwaita/View/Generated/Overlay.swift @@ -2,7 +2,7 @@ // Overlay.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -75,6 +75,19 @@ public struct Overlay: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("getChildPosition", value: "\(getChildPosition)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + content.append(("overlay", body: self.overlay())) + return content + } + /// Initialize `Overlay`. public init() { } diff --git a/Sources/Adwaita/View/Generated/OverlaySplitView.swift b/Sources/Adwaita/View/Generated/OverlaySplitView.swift index 8b57fbf..1479cf9 100644 --- a/Sources/Adwaita/View/Generated/OverlaySplitView.swift +++ b/Sources/Adwaita/View/Generated/OverlaySplitView.swift @@ -2,7 +2,7 @@ // OverlaySplitView.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -175,6 +175,18 @@ public struct OverlaySplitView: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("collapsed", value: "\(collapsed)"), ("enableHideGesture", value: "\(enableHideGesture)"), ("enableShowGesture", value: "\(enableShowGesture)"), ("maxSidebarWidth", value: "\(maxSidebarWidth)"), ("minSidebarWidth", value: "\(minSidebarWidth)"), ("pinSidebar", value: "\(pinSidebar)"), ("showSidebar", value: "\(showSidebar)"), ("sidebarWidthFraction", value: "\(sidebarWidthFraction)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("content", body: self.content?() ?? []), ("sidebar", body: self.sidebar?() ?? []),] + + return content + } + /// Initialize `OverlaySplitView`. public init() { } diff --git a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift index 3d4abde..ca0eb9a 100644 --- a/Sources/Adwaita/View/Generated/PasswordEntryRow.swift +++ b/Sources/Adwaita/View/Generated/PasswordEntryRow.swift @@ -2,7 +2,7 @@ // PasswordEntryRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -81,6 +81,18 @@ public struct PasswordEntryRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("activatesDefault", value: "\(activatesDefault)"), ("enableEmojiCompletion", value: "\(enableEmojiCompletion)"), ("showApplyButton", value: "\(showApplyButton)"), ("textLength", value: "\(textLength)"), ("title", value: "\(title)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("apply", value: "\(apply)"), ("entryActivated", value: "\(entryActivated)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `PasswordEntryRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Picture.swift b/Sources/Adwaita/View/Generated/Picture.swift index 04f6560..2113a3e 100644 --- a/Sources/Adwaita/View/Generated/Picture.swift +++ b/Sources/Adwaita/View/Generated/Picture.swift @@ -2,7 +2,7 @@ // Picture.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -77,6 +77,18 @@ public struct Picture: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("alternativeText", value: "\(alternativeText)"), ("canShrink", value: "\(canShrink)"), ("keepAspectRatio", value: "\(keepAspectRatio)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `Picture`. public init() { } diff --git a/Sources/Adwaita/View/Generated/Popover.swift b/Sources/Adwaita/View/Generated/Popover.swift index 73b65a4..f6f39f6 100644 --- a/Sources/Adwaita/View/Generated/Popover.swift +++ b/Sources/Adwaita/View/Generated/Popover.swift @@ -2,7 +2,7 @@ // Popover.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -104,6 +104,18 @@ public struct Popover: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("autohide", value: "\(autohide)"), ("cascadePopdown", value: "\(cascadePopdown)"), ("hasArrow", value: "\(hasArrow)"), ("mnemonicsVisible", value: "\(mnemonicsVisible)"), ("activateDefault", value: "\(activateDefault)"), ("closed", value: "\(closed)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []), ("defaultWidget", body: self.defaultWidget?() ?? []),] + + return content + } + /// Initialize `Popover`. public init() { } diff --git a/Sources/Adwaita/View/Generated/PreferencesGroup.swift b/Sources/Adwaita/View/Generated/PreferencesGroup.swift index 074134a..23428b9 100644 --- a/Sources/Adwaita/View/Generated/PreferencesGroup.swift +++ b/Sources/Adwaita/View/Generated/PreferencesGroup.swift @@ -2,7 +2,7 @@ // PreferencesGroup.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -61,6 +61,19 @@ public struct PreferencesGroup: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("description", value: "\(description)"), ("title", value: "\(title)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("headerSuffix", body: self.headerSuffix?() ?? []),] + + content.append(("child", body: self.child())) + return content + } + /// Initialize `PreferencesGroup`. public init() { } diff --git a/Sources/Adwaita/View/Generated/PreferencesPage.swift b/Sources/Adwaita/View/Generated/PreferencesPage.swift index f3a4667..6ca9fe1 100644 --- a/Sources/Adwaita/View/Generated/PreferencesPage.swift +++ b/Sources/Adwaita/View/Generated/PreferencesPage.swift @@ -2,7 +2,7 @@ // PreferencesPage.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -46,6 +46,19 @@ public struct PreferencesPage: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("description", value: "\(description)"), ("iconName", value: "\(iconName)"), ("name", value: "\(name)"), ("title", value: "\(title)"), ("useUnderline", value: "\(useUnderline)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + content.append(("child", body: self.child())) + return content + } + /// Initialize `PreferencesPage`. public init() { } diff --git a/Sources/Adwaita/View/Generated/PreferencesRow.swift b/Sources/Adwaita/View/Generated/PreferencesRow.swift index 2828ade..a7f5b62 100644 --- a/Sources/Adwaita/View/Generated/PreferencesRow.swift +++ b/Sources/Adwaita/View/Generated/PreferencesRow.swift @@ -2,7 +2,7 @@ // PreferencesRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -46,6 +46,18 @@ public struct PreferencesRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("title", value: "\(title)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `PreferencesRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ProgressBar.swift b/Sources/Adwaita/View/Generated/ProgressBar.swift index aefff91..53c70d9 100644 --- a/Sources/Adwaita/View/Generated/ProgressBar.swift +++ b/Sources/Adwaita/View/Generated/ProgressBar.swift @@ -2,7 +2,7 @@ // ProgressBar.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -89,6 +89,18 @@ public struct ProgressBar: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("fraction", value: "\(fraction)"), ("inverted", value: "\(inverted)"), ("pulseStep", value: "\(pulseStep)"), ("showText", value: "\(showText)"), ("text", value: "\(text)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `ProgressBar`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ScrolledWindow.swift b/Sources/Adwaita/View/Generated/ScrolledWindow.swift index d972818..c446b8e 100644 --- a/Sources/Adwaita/View/Generated/ScrolledWindow.swift +++ b/Sources/Adwaita/View/Generated/ScrolledWindow.swift @@ -2,7 +2,7 @@ // ScrolledWindow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -169,6 +169,18 @@ public struct ScrolledWindow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("hasFrame", value: "\(hasFrame)"), ("kineticScrolling", value: "\(kineticScrolling)"), ("maxContentHeight", value: "\(maxContentHeight)"), ("maxContentWidth", value: "\(maxContentWidth)"), ("minContentHeight", value: "\(minContentHeight)"), ("minContentWidth", value: "\(minContentWidth)"), ("overlayScrolling", value: "\(overlayScrolling)"), ("propagateNaturalHeight", value: "\(propagateNaturalHeight)"), ("propagateNaturalWidth", value: "\(propagateNaturalWidth)"), ("edgeOvershot", value: "\(edgeOvershot)"), ("edgeReached", value: "\(edgeReached)"), ("moveFocusOut", value: "\(moveFocusOut)"), ("scrollChild", value: "\(scrollChild)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `ScrolledWindow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/SearchBar.swift b/Sources/Adwaita/View/Generated/SearchBar.swift index b72c4d5..c5fa758 100644 --- a/Sources/Adwaita/View/Generated/SearchBar.swift +++ b/Sources/Adwaita/View/Generated/SearchBar.swift @@ -2,7 +2,7 @@ // SearchBar.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -76,6 +76,18 @@ public struct SearchBar: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("searchModeEnabled", value: "\(searchModeEnabled)"), ("showCloseButton", value: "\(showCloseButton)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []), ("keyCaptureWidget", body: self.keyCaptureWidget?() ?? []),] + + return content + } + /// Initialize `SearchBar`. public init() { } diff --git a/Sources/Adwaita/View/Generated/SearchEntry.swift b/Sources/Adwaita/View/Generated/SearchEntry.swift index c9a9650..cd9354b 100644 --- a/Sources/Adwaita/View/Generated/SearchEntry.swift +++ b/Sources/Adwaita/View/Generated/SearchEntry.swift @@ -2,7 +2,7 @@ // SearchEntry.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -159,6 +159,18 @@ public struct SearchEntry: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("activatesDefault", value: "\(activatesDefault)"), ("cursorPosition", value: "\(cursorPosition)"), ("editable", value: "\(editable)"), ("enableUndo", value: "\(enableUndo)"), ("maxWidthChars", value: "\(maxWidthChars)"), ("placeholderText", value: "\(placeholderText)"), ("searchDelay", value: "\(searchDelay)"), ("selectionBound", value: "\(selectionBound)"), ("text", value: "\(text)"), ("widthChars", value: "\(widthChars)"), ("xalign", value: "\(xalign)"), ("activate", value: "\(activate)"), ("changed", value: "\(changed)"), ("deleteText", value: "\(deleteText)"), ("insertText", value: "\(insertText)"), ("nextMatch", value: "\(nextMatch)"), ("previousMatch", value: "\(previousMatch)"), ("searchChanged", value: "\(searchChanged)"), ("searchStarted", value: "\(searchStarted)"), ("stopSearch", value: "\(stopSearch)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `SearchEntry`. public init() { } diff --git a/Sources/Adwaita/View/Generated/SpinRow.swift b/Sources/Adwaita/View/Generated/SpinRow.swift index 6ab2417..807cb57 100644 --- a/Sources/Adwaita/View/Generated/SpinRow.swift +++ b/Sources/Adwaita/View/Generated/SpinRow.swift @@ -2,7 +2,7 @@ // SpinRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -118,6 +118,18 @@ public struct SpinRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("climbRate", value: "\(climbRate)"), ("digits", value: "\(digits)"), ("iconName", value: "\(iconName)"), ("numeric", value: "\(numeric)"), ("snapToTicks", value: "\(snapToTicks)"), ("subtitle", value: "\(subtitle)"), ("subtitleLines", value: "\(subtitleLines)"), ("subtitleSelectable", value: "\(subtitleSelectable)"), ("title", value: "\(title)"), ("titleLines", value: "\(titleLines)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("value", value: "\(value)"), ("wrap", value: "\(wrap)"), ("activated", value: "\(activated)"), ("input", value: "\(input)"), ("output", value: "\(output)"), ("wrapped", value: "\(wrapped)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("activatableWidget", body: self.activatableWidget?() ?? []),] + + return content + } + /// Initialize `SpinRow`. public init(climbRate: Double, digits: UInt) { self.climbRate = climbRate diff --git a/Sources/Adwaita/View/Generated/Spinner.swift b/Sources/Adwaita/View/Generated/Spinner.swift index ca57c4c..4b81c72 100644 --- a/Sources/Adwaita/View/Generated/Spinner.swift +++ b/Sources/Adwaita/View/Generated/Spinner.swift @@ -2,7 +2,7 @@ // Spinner.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -41,6 +41,18 @@ public struct Spinner: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("spinning", value: "\(spinning)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `Spinner`. public init() { } diff --git a/Sources/Adwaita/View/Generated/SplitButton.swift b/Sources/Adwaita/View/Generated/SplitButton.swift index 2a8bb2b..cfe97f4 100644 --- a/Sources/Adwaita/View/Generated/SplitButton.swift +++ b/Sources/Adwaita/View/Generated/SplitButton.swift @@ -2,7 +2,7 @@ // SplitButton.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -100,6 +100,18 @@ public struct SplitButton: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("canShrink", value: "\(canShrink)"), ("dropdownTooltip", value: "\(dropdownTooltip)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("menuModel", value: "\(menuModel)"), ("useUnderline", value: "\(useUnderline)"), ("activate", value: "\(activate)"), ("clicked", value: "\(clicked)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `SplitButton`. public init() { } diff --git a/Sources/Adwaita/View/Generated/StatusPage.swift b/Sources/Adwaita/View/Generated/StatusPage.swift index 83ef3c7..d2ba65c 100644 --- a/Sources/Adwaita/View/Generated/StatusPage.swift +++ b/Sources/Adwaita/View/Generated/StatusPage.swift @@ -2,7 +2,7 @@ // StatusPage.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -46,6 +46,18 @@ public struct StatusPage: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("description", value: "\(description)"), ("iconName", value: "\(iconName)"), ("title", value: "\(title)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `StatusPage`. public init() { } diff --git a/Sources/Adwaita/View/Generated/SwitchRow.swift b/Sources/Adwaita/View/Generated/SwitchRow.swift index 8308b04..25db9ae 100644 --- a/Sources/Adwaita/View/Generated/SwitchRow.swift +++ b/Sources/Adwaita/View/Generated/SwitchRow.swift @@ -2,7 +2,7 @@ // SwitchRow.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -95,6 +95,18 @@ public struct SwitchRow: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("active", value: "\(active)"), ("iconName", value: "\(iconName)"), ("subtitle", value: "\(subtitle)"), ("subtitleLines", value: "\(subtitleLines)"), ("subtitleSelectable", value: "\(subtitleSelectable)"), ("title", value: "\(title)"), ("titleLines", value: "\(titleLines)"), ("titleSelectable", value: "\(titleSelectable)"), ("useMarkup", value: "\(useMarkup)"), ("useUnderline", value: "\(useUnderline)"), ("activated", value: "\(activated)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("activatableWidget", body: self.activatableWidget?() ?? []),] + + return content + } + /// Initialize `SwitchRow`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ToastOverlay.swift b/Sources/Adwaita/View/Generated/ToastOverlay.swift index 0d3b393..d4fa8c0 100644 --- a/Sources/Adwaita/View/Generated/ToastOverlay.swift +++ b/Sources/Adwaita/View/Generated/ToastOverlay.swift @@ -2,7 +2,7 @@ // ToastOverlay.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -58,6 +58,18 @@ public struct ToastOverlay: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `ToastOverlay`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ToggleButton.swift b/Sources/Adwaita/View/Generated/ToggleButton.swift index 147353a..a6e7511 100644 --- a/Sources/Adwaita/View/Generated/ToggleButton.swift +++ b/Sources/Adwaita/View/Generated/ToggleButton.swift @@ -2,7 +2,7 @@ // ToggleButton.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -134,6 +134,18 @@ public struct ToggleButton: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("accessibleRole", value: "\(accessibleRole)"), ("actionName", value: "\(actionName)"), ("active", value: "\(active)"), ("canShrink", value: "\(canShrink)"), ("hasFrame", value: "\(hasFrame)"), ("iconName", value: "\(iconName)"), ("label", value: "\(label)"), ("useUnderline", value: "\(useUnderline)"), ("activate", value: "\(activate)"), ("clicked", value: "\(clicked)"), ("toggled", value: "\(toggled)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("child", body: self.child?() ?? []),] + + return content + } + /// Initialize `ToggleButton`. public init() { } diff --git a/Sources/Adwaita/View/Generated/ToolbarView.swift b/Sources/Adwaita/View/Generated/ToolbarView.swift index 052f9e7..59cfe63 100644 --- a/Sources/Adwaita/View/Generated/ToolbarView.swift +++ b/Sources/Adwaita/View/Generated/ToolbarView.swift @@ -2,7 +2,7 @@ // ToolbarView.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -143,6 +143,20 @@ public struct ToolbarView: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("bottomBarHeight", value: "\(bottomBarHeight)"), ("extendContentToBottomEdge", value: "\(extendContentToBottomEdge)"), ("extendContentToTopEdge", value: "\(extendContentToTopEdge)"), ("revealBottomBars", value: "\(revealBottomBars)"), ("revealTopBars", value: "\(revealTopBars)"), ("topBarHeight", value: "\(topBarHeight)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [("content", body: self.content?() ?? []),] + + content.append(("bottom", body: self.bottom())) + content.append(("top", body: self.top())) + return content + } + /// Initialize `ToolbarView`. public init() { } diff --git a/Sources/Adwaita/View/Generated/WindowTitle.swift b/Sources/Adwaita/View/Generated/WindowTitle.swift index b47d033..b5138fd 100644 --- a/Sources/Adwaita/View/Generated/WindowTitle.swift +++ b/Sources/Adwaita/View/Generated/WindowTitle.swift @@ -2,7 +2,7 @@ // WindowTitle.swift // Adwaita // -// Created by auto-generation on 28.04.24. +// Created by auto-generation on 02.05.24. // import CAdw @@ -39,6 +39,18 @@ public struct WindowTitle: Widget { /// The window. var window: GTUIApplicationWindow? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("subtitle", value: "\(subtitle)"), ("title", value: "\(title)"), ("app", value: "\(app)"), ("window", value: "\(window)")] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + var content: [(String, body: Body)] = [] + + return content + } + /// Initialize `WindowTitle`. public init(subtitle: String, title: String) { self.subtitle = subtitle diff --git a/Sources/Adwaita/View/Modifiers/AppearObserver.swift b/Sources/Adwaita/View/Modifiers/AppearObserver.swift index 073f276..c94ebdf 100644 --- a/Sources/Adwaita/View/Modifiers/AppearObserver.swift +++ b/Sources/Adwaita/View/Modifiers/AppearObserver.swift @@ -15,6 +15,18 @@ struct AppearObserver: Widget { /// The content. var content: AnyView + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("onAppear", value: "(ViewStorage) -> Void") + ] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("content", body: [content])] + } + /// Get the content's container. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The content's container. diff --git a/Sources/Adwaita/View/Modifiers/ContentModifier.swift b/Sources/Adwaita/View/Modifiers/ContentModifier.swift index db6052f..0b8a974 100644 --- a/Sources/Adwaita/View/Modifiers/ContentModifier.swift +++ b/Sources/Adwaita/View/Modifiers/ContentModifier.swift @@ -13,6 +13,16 @@ struct ContentModifier: Widget where Content: AnyView { /// The closure for the modification. var modify: (Content) -> AnyView + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [("Attention", value: "Content modifiers are unsupported in the debugging view.")] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("content", body: [content])] + } + /// Get the content's container. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The content's container. diff --git a/Sources/Adwaita/View/Modifiers/Freeze.swift b/Sources/Adwaita/View/Modifiers/Freeze.swift index 128f0d1..07e45cf 100644 --- a/Sources/Adwaita/View/Modifiers/Freeze.swift +++ b/Sources/Adwaita/View/Modifiers/Freeze.swift @@ -13,6 +13,18 @@ struct Freeze: Widget { /// The wrapped view. var content: AnyView + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("freeze", value: freeze) + ] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("content", body: [content])] + } + /// Get the content's container. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The content's container. diff --git a/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift b/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift index e969c29..36be520 100644 --- a/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift +++ b/Sources/Adwaita/View/Modifiers/InspectorWrapper.swift @@ -15,6 +15,18 @@ struct InspectorWrapper: Widget { /// The wrapped view. var content: AnyView + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("modify", value: "(ViewStorage) -> Void") + ] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("content", body: [content])] + } + /// Get the content's container. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The content's container. diff --git a/Sources/Adwaita/View/Modifiers/ModifierStopper.swift b/Sources/Adwaita/View/Modifiers/ModifierStopper.swift index 795244f..9d44d2d 100644 --- a/Sources/Adwaita/View/Modifiers/ModifierStopper.swift +++ b/Sources/Adwaita/View/Modifiers/ModifierStopper.swift @@ -11,6 +11,16 @@ struct ModifierStopper: Widget { /// The wrapped view. var content: AnyView + /// The debug tree parameters. + var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [] + } + + /// The debug tree's content. + var debugTreeContent: [(String, body: Body)] { + [("content", body: [content])] + } + /// Get the content's container. /// - Parameter modifiers: Modify views before being updated. /// - Returns: The content's container. diff --git a/Sources/Adwaita/View/NavigationSplitView.swift b/Sources/Adwaita/View/NavigationSplitView.swift index 8b28d33..6b83407 100644 --- a/Sources/Adwaita/View/NavigationSplitView.swift +++ b/Sources/Adwaita/View/NavigationSplitView.swift @@ -19,6 +19,19 @@ public struct NavigationSplitView: Widget { /// Whether the content is visible (if the split view is collapsed). var showContent: Binding? + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("collapsed", value: collapsed), + ("showContent", value: showContent) + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [("sidebar", body: sidebar()), ("content", body: content())] + } + /// The sidebar content's id. let sidebarID = "sidebar" /// The main content's id. diff --git a/Sources/Adwaita/View/StateWrapper.swift b/Sources/Adwaita/View/StateWrapper.swift index baf5286..dd173b1 100644 --- a/Sources/Adwaita/View/StateWrapper.swift +++ b/Sources/Adwaita/View/StateWrapper.swift @@ -5,6 +5,9 @@ // Created by david-swift on 26.09.23. // +import CAdw +import Observation + /// A storage for `@State` properties. public struct StateWrapper: Widget { @@ -13,6 +16,21 @@ public struct StateWrapper: Widget { /// The state information (from properties with the `State` wrapper). var state: [String: StateProtocol] = [:] + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("state", value: state) + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [("content", body: content())] + } + + /// The identifier of the field storing whether to update the wrapper's content. + private var updateID: String { "update" } + /// Initialize a `StateWrapper`. /// - Parameter content: The view content. public init(@ViewBuilder content: @escaping () -> Body) { @@ -34,7 +52,8 @@ public struct StateWrapper: Widget { /// - modifiers: Modify views before being updated. /// - updateProperties: Whether to update properties. public func update(_ storage: ViewStorage, modifiers: [(AnyView) -> AnyView], updateProperties: Bool) { - var updateProperties = updateProperties + var updateProperties = storage.fields[updateID] as? Bool ?? false + storage.fields[updateID] = false for property in state { if let storage = storage.state[property.key]?.content.storage { property.value.content.storage = storage @@ -56,7 +75,24 @@ public struct StateWrapper: Widget { /// - Returns: The view storage. public func container(modifiers: [(AnyView) -> AnyView]) -> ViewStorage { let content = content().widget(modifiers: modifiers).container(modifiers: modifiers) - return .init(content.pointer, content: [.mainContent: [content]], state: state) + let storage = ViewStorage(content.pointer, content: [.mainContent: [content]], state: state) + observe(storage: storage) + return storage + } + + /// Observe the observable properties accessed in the view. + /// - Parameter storage: The view storage + func observe(storage: ViewStorage) { + withObservationTracking { + _ = content().getDebugTree(parameters: true) + } onChange: { + storage.fields[updateID] = true + let idleSourceId = g_idle_add({ _ in + State.updateViews() + return G_SOURCE_REMOVE + }, nil) + observe(storage: storage) + } } } diff --git a/Sources/Adwaita/View/ViewStack.swift b/Sources/Adwaita/View/ViewStack.swift index b57d2fd..ce7d2fc 100644 --- a/Sources/Adwaita/View/ViewStack.swift +++ b/Sources/Adwaita/View/ViewStack.swift @@ -15,6 +15,18 @@ public struct ViewStack: Widget { /// The stack's active identifier. var id: CustomStringConvertible + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("id", value: id) + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [("content", body: content)] + } + /// Initialize the stack. /// - Parameters: /// - id: The identifier of the current view. diff --git a/Sources/Adwaita/View/ViewSwitcher.swift b/Sources/Adwaita/View/ViewSwitcher.swift index 950024b..c3ce3ee 100644 --- a/Sources/Adwaita/View/ViewSwitcher.swift +++ b/Sources/Adwaita/View/ViewSwitcher.swift @@ -17,6 +17,19 @@ public struct ViewSwitcher: Widget where Element: ViewSwitcherOption { /// Whether the wide style is used, that means the icons and titles are on the same line. var wide = false + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [ + ("wide", value: wide), + ("selection", value: "\(selection)") + ] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [] + } + /// Initialize a view switcher. /// - Parameter selection: The selected element. public init(selection: Binding) { diff --git a/Sources/Adwaita/View/Wrapper.swift b/Sources/Adwaita/View/Wrapper.swift index 4ffc2d9..b37ca85 100644 --- a/Sources/Adwaita/View/Wrapper.swift +++ b/Sources/Adwaita/View/Wrapper.swift @@ -11,6 +11,16 @@ public struct Wrapper: Widget { /// The content. var content: Body + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + [("content", body: content)] + } + /// Initialize a `Wrapper`. /// - Parameter content: The view content. public init(@ViewBuilder content: @escaping () -> Body) { diff --git a/Sources/Generation/GIR/Class+.swift b/Sources/Generation/GIR/Class+.swift index bad793e..903e2b1 100644 --- a/Sources/Generation/GIR/Class+.swift +++ b/Sources/Generation/GIR/Class+.swift @@ -171,6 +171,74 @@ extension Class { return content } + /// Generate the properties. + /// - Parameters: + /// - config: The widget configuration. + /// - genConfig: The generation configuration. + /// - namespace: The namespace. + /// - configs: The available widget configurations. + /// - Returns: The code. + func generateDebugTreeParameters( + config: WidgetConfiguration, + genConfig: GenerationConfiguration, + namespace: Namespace, + configs: [WidgetConfiguration] + ) -> String { + var content = "" + for property in properties(namespace: namespace, configurations: configs) + where !config.excludeProperties.contains(property.name) || config.requiredProperties.contains(property.name) { + content += property.generateDebugTreeParameter(genConfig: genConfig) + } + for signal in signals(namespace: namespace) where !config.excludeSignals.contains(signal.name) { + content += signal.generateDebugTreeParameter(genConfig: genConfig) + } + if config.dynamicWidget != nil { + content += "(\"elements\", value: \"\\(elements)\")," + } + content += "(\"app\", value: \"\\(app)\"), (\"window\", value: \"\\(window)\")" + return content + } + + /// Generate the content. + /// - Parameters: + /// - config: The widget configuration. + /// - genConfig: The generation configuration. + /// - namespace: The namespace. + /// - configs: The available widget configurations. + /// - Returns: The code. + func generateDebugTreeContent( + config: WidgetConfiguration, + genConfig: GenerationConfiguration, + namespace: Namespace, + configs: [WidgetConfiguration] + ) -> String { + let prefix = "var content: [(String, body: Body)] = [" + var content = prefix + for property in properties(namespace: namespace, configurations: configs) + where !config.excludeProperties.contains(property.name) || config.requiredProperties.contains(property.name) { + content += property.generateDebugTreeContent(genConfig: genConfig) + } + if content.count > prefix.count { + content.removeLast() + } + content += "]\n" + if config.dynamicWidget != nil { + content += """ + content += elements.map { element in + ("\\(element)", body: self.content(element)) + } + """ + } + for widget in config.staticWidgets { + content += """ + + content.append(("\(widget.name)", body: self.\(widget.name)())) + """ + } + content += "\n return content" + return content + } + /// Generate the property modifications for updating. /// - Parameters: /// - config: The widget configuration. diff --git a/Sources/Generation/GIR/Class.swift b/Sources/Generation/GIR/Class.swift index 37d6c04..a6b5a1a 100644 --- a/Sources/Generation/GIR/Class.swift +++ b/Sources/Generation/GIR/Class.swift @@ -89,6 +89,16 @@ struct Class: ClassLike, Decodable { var appearFunctions: [(ViewStorage, [(AnyView) -> AnyView]) -> Void] = [] \(generateProperties(config: config, genConfig: genConfig, namespace: namespace, configs: configs)) + /// The debug tree parameters. + public var debugTreeParameters: [(String, value: CustomStringConvertible)] { + [\(generateDebugTreeParameters(config: config, genConfig: genConfig, namespace: namespace, configs: configs))] + } + + /// The debug tree's content. + public var debugTreeContent: [(String, body: Body)] { + \(generateDebugTreeContent(config: config, genConfig: genConfig, namespace: namespace, configs: configs)) + } + /// Initialize `\(widgetName)`. \(generateAdwaitaInitializer(config: config, genConfig: genConfig, namespace: namespace, configs: configs)) diff --git a/Sources/Generation/GIR/Property.swift b/Sources/Generation/GIR/Property.swift index 2d0a50e..61f29d7 100644 --- a/Sources/Generation/GIR/Property.swift +++ b/Sources/Generation/GIR/Property.swift @@ -79,6 +79,28 @@ struct Property: Decodable { """ } + /// Generate the property for the debug tree. + /// - Parameter genConfig: The generation configuration. + /// - Returns: The code. + func generateDebugTreeParameter(genConfig: GenerationConfiguration) -> String { + if self.type?.isWidget ?? false { + return "" + } + let name = convertPropertyName(configuration: genConfig) + return "(\"\(name)\", value: \"\\(\(name))\"), " + } + + /// Generate the content for the debug tree. + /// - Parameter genConfig: The generation configuration. + /// - Returns: The code. + func generateDebugTreeContent(genConfig: GenerationConfiguration) -> String { + if !(self.type?.isWidget ?? false) { + return "" + } + let name = convertPropertyName(configuration: genConfig) + return "(\"\(name)\", body: self.\(name)?() ?? []), " + } + // swiftlint:disable line_length /// Generate the property's modifier. /// - Parameters: diff --git a/Sources/Generation/GIR/Signal.swift b/Sources/Generation/GIR/Signal.swift index d27ccdb..cc85372 100644 --- a/Sources/Generation/GIR/Signal.swift +++ b/Sources/Generation/GIR/Signal.swift @@ -29,6 +29,14 @@ struct Signal: Decodable { """ } + /// Generate the property for the debug tree. + /// - Parameter genConfig: The generation configuration. + /// - Returns: The code. + func generateDebugTreeParameter(genConfig: GenerationConfiguration) -> String { + let name = name.convertDelimitedCasingToCamel(delimiter: "-", configuration: genConfig, unshorten: true) + return "(\"\(name)\", value: \"\\(\(name))\"), " + } + /// Generate the signal's modifier. /// - Parameters: /// - config: The widget configuration. diff --git a/Tests/Demo.swift b/Tests/Demo.swift index 1d3464a..e48dce0 100644 --- a/Tests/Demo.swift +++ b/Tests/Demo.swift @@ -9,6 +9,7 @@ import Adwaita import Foundation +import Observation @main struct Demo: App { @@ -63,7 +64,8 @@ struct Demo: App { } - struct DemoModel: Codable { + @Observable + class DemoModel: Codable { var selection: Page = .welcome var sidebarVisible = true diff --git a/Tests/ViewSwitcherDemo.swift b/Tests/ViewSwitcherDemo.swift index 0e593f3..cfbd949 100644 --- a/Tests/ViewSwitcherDemo.swift +++ b/Tests/ViewSwitcherDemo.swift @@ -11,7 +11,6 @@ import Adwaita struct ViewSwitcherDemo: SimpleView { - @State private var model = Demo.DemoModel() var app: GTUIApp var view: Body {