@atom-js-org/runtime 0.5.0-alpha.0 → 0.5.1-alpha.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.
package/package.json
CHANGED
|
@@ -70,6 +70,28 @@ static NSColor *AtomJSColor(NSString *hex) {
|
|
|
70
70
|
return [NSColor colorWithSRGBRed:red green:green blue:blue alpha:alpha];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
static void AtomJSConfigureTransparentWebView(WKWebView *webView) {
|
|
74
|
+
if (!webView) return;
|
|
75
|
+
|
|
76
|
+
// `drawsBackground` is not exposed as a public Objective-C property by every
|
|
77
|
+
// macOS SDK. Use guarded KVC so older SDKs still compile, while retaining the
|
|
78
|
+
// WebKit behavior needed for genuinely transparent pages.
|
|
79
|
+
@try {
|
|
80
|
+
[webView setValue:@NO forKey:@"drawsBackground"];
|
|
81
|
+
} @catch (__unused NSException *exception) {}
|
|
82
|
+
|
|
83
|
+
// Newer WebKit versions expose a public under-page color. Set it through the
|
|
84
|
+
// Objective-C runtime so the host also compiles against SDKs that predate it.
|
|
85
|
+
if ([webView respondsToSelector:NSSelectorFromString(@"setUnderPageBackgroundColor:")]) {
|
|
86
|
+
@try {
|
|
87
|
+
[webView setValue:[NSColor clearColor] forKey:@"underPageBackgroundColor"];
|
|
88
|
+
} @catch (__unused NSException *exception) {}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
webView.wantsLayer = YES;
|
|
92
|
+
webView.layer.backgroundColor = [NSColor clearColor].CGColor;
|
|
93
|
+
}
|
|
94
|
+
|
|
73
95
|
static NSImage *AtomJSDefaultApplicationIcon(void) {
|
|
74
96
|
NSSize size = NSMakeSize(512.0, 512.0);
|
|
75
97
|
NSImage *image = [[NSImage alloc] initWithSize:size];
|
|
@@ -208,7 +230,7 @@ static void AtomJSConfigureApplicationIdentity(NSApplication *application) {
|
|
|
208
230
|
_webView = [[WKWebView alloc] initWithFrame:frame configuration:webConfiguration];
|
|
209
231
|
_webView.navigationDelegate = self;
|
|
210
232
|
_webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
211
|
-
if (AtomJSBoolean(config[@"transparent"], NO)) _webView
|
|
233
|
+
if (AtomJSBoolean(config[@"transparent"], NO)) AtomJSConfigureTransparentWebView(_webView);
|
|
212
234
|
_window.contentView = _webView;
|
|
213
235
|
|
|
214
236
|
NSNumber *parentWindowId = AtomJSNumber(config[@"parentWindowId"], nil);
|