@webspatial/platform-visionos 0.1.7 → 0.1.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/platform-visionos",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Used to publish WebSpatial projects to Apple Vision Pro",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -28,9 +28,12 @@ struct PWAManager: Codable {
28
28
  mutating func _init() {
29
29
  let urlType = start_url.split(separator: "://").first
30
30
  if !(urlType == "http" || urlType == "https") {
31
- start_url = Bundle.main.url(forResource: start_url, withExtension: "", subdirectory: "")!.absoluteString
32
- scope = "file://" + Bundle.main.bundlePath + "/" + scope
33
- scope = scope.replacingOccurrences(of: " ", with: "%20")
31
+ if scope == "" || scope == "/" {
32
+ scope = "./"
33
+ }
34
+ let startUrl = Bundle.main.url(forResource: start_url, withExtension: "", subdirectory: "")
35
+ start_url = startUrl!.absoluteString
36
+ scope = URL(string: scope, relativeTo: startUrl)!.absoluteString
34
37
  isLocal = true
35
38
  }
36
39
 
@@ -63,16 +66,24 @@ struct PWAManager: Codable {
63
66
 
64
67
  func getLocalResourceURL(url: String) -> String {
65
68
  let path = String(url.split(separator: "file://").first!.split(separator: "?").first!)
66
- let root = String(url.split(separator: "?").first!)
67
- let params = String(url.split(separator: "file://" + root).first!)
68
- var resource: String = Bundle.main.url(forResource: path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
69
+ let newUrl = URL(string: url)
70
+ let fileManager = FileManager.default
71
+ if fileManager.fileExists(atPath: newUrl!.path) {
72
+ return url
73
+ }
74
+ var resource: String = Bundle.main.url(forResource: newUrl?.path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
69
75
  if resource == "" {
70
76
  resource = Bundle.main.url(forResource: "static-web" + path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
71
77
  }
72
78
  if resource == "" {
73
79
  return url
74
80
  }
75
- resource += "?" + params
81
+ if newUrl?.query() != nil {
82
+ resource += "?" + (newUrl?.query())!
83
+ }
84
+ if newUrl?.fragment() != nil {
85
+ resource += "#" + (newUrl?.fragment())!
86
+ }
76
87
  return resource
77
88
  }
78
89
  }
@@ -80,6 +91,7 @@ struct PWAManager: Codable {
80
91
  enum PWADisplayMode: Codable {
81
92
  case minimal
82
93
  case standalone
94
+ case fullscreen
83
95
  }
84
96
 
85
97
  struct PWAProtocol: Codable {
@@ -179,7 +179,7 @@ struct SpatialWebViewUI: View {
179
179
  .opacity(wv.opacity)
180
180
  .hidden(!ent.visible)
181
181
  .ornament(attachmentAnchor: .scene(.bottomTrailing), contentAlignment: .bottomTrailing) {
182
- if wv.isRootWebview() {
182
+ if wv.isRootWebview() && pwaManager.display != .fullscreen {
183
183
  NavView(swc: wv, navInfo: wv.navInfo)
184
184
  }
185
185
  }