@webspatial/platform-visionos 0.1.1 → 0.1.3
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.
- package/package.json +1 -1
- package/web-spatial/libs/SpatialWindowComponent.swift +5 -0
- package/web-spatial/libs/webView/backend/NativeWebView.swift +1 -0
- package/web-spatial/views/MaterialWithBorderCornerModifier.swift +21 -0
- package/web-spatial/views/SpatialWebViewUI.swift +1 -1
- package/web-spatial/views/ui/NavView.swift +3 -2
package/package.json
CHANGED
|
@@ -18,6 +18,10 @@ struct LoadingStyles {
|
|
|
18
18
|
var backgroundMaterial: BackgroundMaterial = .None
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
class NavInfo: ObservableObject {
|
|
22
|
+
@Published var url: String = ""
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
@Observable
|
|
22
26
|
class SpatialWindowComponent: SpatialComponent {
|
|
23
27
|
override func inspect() -> [String: Any] {
|
|
@@ -66,6 +70,7 @@ class SpatialWindowComponent: SpatialComponent {
|
|
|
66
70
|
var parentWindowContainerID: String
|
|
67
71
|
var childWindowContainers = [String: WindowContainerData]()
|
|
68
72
|
var spawnedNativeWebviews = [String: WebViewNative]()
|
|
73
|
+
var navInfo = NavInfo()
|
|
69
74
|
|
|
70
75
|
// Resources that will be destroyed when this webpage is destoryed or if it is navigated away from
|
|
71
76
|
private var childResources = [String: SpatialObject]()
|
|
@@ -129,6 +129,7 @@ class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler, WKUID
|
|
|
129
129
|
// backward/forward
|
|
130
130
|
webViewRef?.didNavBackForward()
|
|
131
131
|
}
|
|
132
|
+
webViewRef?.navInfo.url = resource
|
|
132
133
|
decisionHandler(.allow)
|
|
133
134
|
} else {
|
|
134
135
|
decisionHandler(.cancel)
|
|
@@ -7,6 +7,27 @@ enum BackgroundMaterial: String, Codable {
|
|
|
7
7
|
case ThickMaterial = "thick"
|
|
8
8
|
case RegularMaterial = "regular"
|
|
9
9
|
case ThinMaterial = "thin"
|
|
10
|
+
|
|
11
|
+
init(from decoder: Decoder) throws {
|
|
12
|
+
let container = try decoder.singleValueContainer()
|
|
13
|
+
let rawValue = try container.decode(String.self)
|
|
14
|
+
switch rawValue {
|
|
15
|
+
case "none":
|
|
16
|
+
self = .None
|
|
17
|
+
case "transparent":
|
|
18
|
+
self = .Transparent
|
|
19
|
+
case "translucent":
|
|
20
|
+
self = .GlassMaterial
|
|
21
|
+
case "thick":
|
|
22
|
+
self = .ThickMaterial
|
|
23
|
+
case "regular":
|
|
24
|
+
self = .RegularMaterial
|
|
25
|
+
case "thin":
|
|
26
|
+
self = .ThinMaterial
|
|
27
|
+
default:
|
|
28
|
+
self = .None
|
|
29
|
+
}
|
|
30
|
+
}
|
|
10
31
|
}
|
|
11
32
|
|
|
12
33
|
struct CornerRadius: Codable {
|
|
@@ -178,7 +178,7 @@ struct SpatialWebViewUI: View {
|
|
|
178
178
|
.hidden(!ent.visible)
|
|
179
179
|
.ornament(attachmentAnchor: .scene(.bottomTrailing), contentAlignment: .bottomTrailing) {
|
|
180
180
|
if wv.isRootWebview() {
|
|
181
|
-
NavView(swc: wv)
|
|
181
|
+
NavView(swc: wv, navInfo: wv.navInfo)
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -3,6 +3,7 @@ import WebKit
|
|
|
3
3
|
|
|
4
4
|
struct NavView: View {
|
|
5
5
|
@State var swc: SpatialWindowComponent?
|
|
6
|
+
@StateObject var navInfo: NavInfo
|
|
6
7
|
@State var showUrl: Bool = true
|
|
7
8
|
@State private var showCopyTip = false
|
|
8
9
|
@State private var navWidth: CGFloat = 0
|
|
@@ -52,7 +53,7 @@ struct NavView: View {
|
|
|
52
53
|
HStack(spacing: 5) {
|
|
53
54
|
if showUrl {
|
|
54
55
|
Text(
|
|
55
|
-
|
|
56
|
+
navInfo.url
|
|
56
57
|
)
|
|
57
58
|
.padding()
|
|
58
59
|
.lineLimit(1)
|
|
@@ -64,7 +65,7 @@ struct NavView: View {
|
|
|
64
65
|
}
|
|
65
66
|
return AnyView(EmptyView())
|
|
66
67
|
})
|
|
67
|
-
.frame(width:
|
|
68
|
+
.frame(width: .maximum(300, texWidth))
|
|
68
69
|
Button(action: {
|
|
69
70
|
UIPasteboard.general.string = swc?.getURL()?.absoluteString ?? ""
|
|
70
71
|
showCopyTip = true
|