@swiftbrowser/swift 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,11 +26,22 @@ extension AnyTransition {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/// Space between toolbar items (iOS 26), which separates Liquid Glass
|
|
29
|
-
/// groups
|
|
30
|
-
///
|
|
29
|
+
/// groups: an empty `toolbar` element of its placement with `"spacer":
|
|
30
|
+
/// "flexible"` or `"fixed"`. In a bottom bar flexible spacers share the room
|
|
31
|
+
/// left over and push the groups apart (Toolbar.swift); in the navigation
|
|
32
|
+
/// bar they only separate groups.
|
|
31
33
|
nonisolated public struct ToolbarSpacer: ToolbarContent {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
let sizing: SpacerSizing
|
|
35
|
+
let placement: ToolbarItemPlacement
|
|
36
|
+
|
|
37
|
+
public init(_ sizing: SpacerSizing = .flexible, placement: ToolbarItemPlacement = .automatic) {
|
|
38
|
+
self.sizing = sizing
|
|
39
|
+
self.placement = placement
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
nonisolated public var _toolbarItems: [any View] {
|
|
43
|
+
[_ToolbarGroupView(placement: placement, items: [], spacer: sizing.name)]
|
|
44
|
+
}
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
/// How much room a `ToolbarSpacer` takes.
|
|
@@ -33,15 +33,21 @@ public protocol ToolbarContent {
|
|
|
33
33
|
nonisolated var _toolbarItems: [any View] { get }
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/// A `toolbar` element: the items of one placement
|
|
36
|
+
/// A `toolbar` element: the items of one placement, or a `ToolbarSpacer`
|
|
37
|
+
/// (`spacer`: `"flexible"` or `"fixed"`, no items).
|
|
37
38
|
struct _ToolbarGroupView {
|
|
38
39
|
let placement: ToolbarItemPlacement
|
|
39
40
|
let items: [any View]
|
|
41
|
+
var spacer: String? = nil
|
|
40
42
|
}
|
|
41
43
|
extension _ToolbarGroupView: _PrimitiveView {}
|
|
42
44
|
extension _ToolbarGroupView: _HostView {
|
|
43
45
|
var _kind: String { "toolbar" }
|
|
44
|
-
func _props(in environment: EnvironmentValues) -> _JSON {
|
|
46
|
+
func _props(in environment: EnvironmentValues) -> _JSON {
|
|
47
|
+
var props: [String: _JSON] = ["placement": .string(placement.name)]
|
|
48
|
+
if let spacer { props["spacer"] = .string(spacer) }
|
|
49
|
+
return .object(props)
|
|
50
|
+
}
|
|
45
51
|
var _content: [any View] { items }
|
|
46
52
|
}
|
|
47
53
|
extension _ToolbarGroupView: _EnvironmentModifying {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swiftbrowser/swift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The SwiftBrowser Swift package (the SwiftUI shim, Charts, SwiftData and FoundationBridge) as an npm package, so @swiftbrowser/cli builds apps against the exact version it ships with.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|