@octane-xplat/macos-renderer 0.13.0 → 0.15.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/README.md +95 -20
- package/package.json +15 -2
- package/src/appearance.ts +2 -0
- package/src/fonts.ts +2 -0
- package/src/formatted-text.ts +147 -0
- package/src/gestures.ts +196 -0
- package/src/host-globals.d.ts +55 -0
- package/src/html-text.ts +88 -0
- package/src/image.ts +91 -16
- package/src/index.d.ts +9 -0
- package/src/index.ts +5030 -678
- package/src/layer.ts +11 -9
- package/src/list-template.ts +266 -0
- package/src/list-view.ts +445 -0
- package/src/portal-components.macos.tsx +86 -0
- package/src/presentation.ts +48 -15
- package/src/scroll-view.ts +124 -0
- package/src/tab-view.ts +512 -0
- package/src/template-props.ts +402 -0
- package/src/vendor/listview/LICENSE +19 -0
- package/src/vendor/listview/README.md +1 -0
- package/src/vendor/listview/binding-options.ts +189 -0
- package/src/vendor/listview/expressions.ts +285 -0
- package/src/webview.ts +36 -7
- package/types/ARKitCore.d.ts +199 -0
- package/types/AVFAudio.d.ts +2304 -0
- package/types/AVFoundation.d.ts +6974 -0
- package/types/AVKit.d.ts +215 -0
- package/types/AVRouting.d.ts +7 -0
- package/types/Accelerate.d.ts +4776 -0
- package/types/Accessibility.d.ts +69 -0
- package/types/Accounts.d.ts +134 -0
- package/types/AdSupport.d.ts +12 -0
- package/types/AddressBook.d.ts +1012 -0
- package/types/AppKit.d.ts +34247 -0
- package/types/AppTrackingTransparency.d.ts +23 -0
- package/types/AppleScriptKit.d.ts +6 -0
- package/types/ApplicationServices.d.ts +6346 -0
- package/types/AudioToolbox.d.ts +7129 -0
- package/types/AudioVideoBridging.d.ts +613 -0
- package/types/AuthenticationServices.d.ts +982 -0
- package/types/AutomaticAssessmentConfiguration.d.ts +46 -0
- package/types/Automator.d.ts +248 -0
- package/types/BackgroundAssets.d.ts +9 -0
- package/types/BrowserEngineKit.d.ts +166 -0
- package/types/BusinessChat.d.ts +29 -0
- package/types/CFNetwork.d.ts +931 -0
- package/types/CalendarStore.d.ts +354 -0
- package/types/CallKit.d.ts +30 -0
- package/types/Carbon.d.ts +16207 -0
- package/types/ClassKit.d.ts +281 -0
- package/types/CloudKit.d.ts +1565 -0
- package/types/Collaboration.d.ts +123 -0
- package/types/ColorSync.d.ts +562 -0
- package/types/CompositorServices.d.ts +60 -0
- package/types/ComputeGraph.d.ts +16 -0
- package/types/Contacts.d.ts +1558 -0
- package/types/ContactsUI.d.ts +39 -0
- package/types/CoreAudio.d.ts +1376 -0
- package/types/CoreAudioKit.d.ts +122 -0
- package/types/CoreAudioTypes.d.ts +1003 -0
- package/types/CoreBluetooth.d.ts +657 -0
- package/types/CoreData.d.ts +2479 -0
- package/types/CoreFoundation.d.ts +5546 -0
- package/types/CoreGraphics.d.ts +3676 -0
- package/types/CoreHaptics.d.ts +361 -0
- package/types/CoreImage.d.ts +4781 -0
- package/types/CoreLocation.d.ts +564 -0
- package/types/CoreMIDI.d.ts +1538 -0
- package/types/CoreML.d.ts +905 -0
- package/types/CoreMedia.d.ts +2615 -0
- package/types/CoreMediaIO.d.ts +1046 -0
- package/types/CoreMotion.d.ts +316 -0
- package/types/CoreServices.d.ts +24810 -0
- package/types/CoreSpotlight.d.ts +789 -0
- package/types/CoreTelephony.d.ts +31 -0
- package/types/CoreText.d.ts +3973 -0
- package/types/CoreTransferable.d.ts +3 -0
- package/types/CoreVideo.d.ts +1162 -0
- package/types/CoreWLAN.d.ts +556 -0
- package/types/CryptoTokenKit.d.ts +548 -0
- package/types/DVDPlayback.d.ts +931 -0
- package/types/DataDetection.d.ts +66 -0
- package/types/DeviceCheck.d.ts +46 -0
- package/types/DeviceDiscoveryExtension.d.ts +142 -0
- package/types/DirectoryService.d.ts +966 -0
- package/types/DiscRecording.d.ts +2345 -0
- package/types/DiscRecordingUI.d.ts +288 -0
- package/types/DiskArbitration.d.ts +366 -0
- package/types/DriverKit.d.ts +639 -0
- package/types/EventKit.d.ts +640 -0
- package/types/ExceptionHandling.d.ts +56 -0
- package/types/ExecutionPolicy.d.ts +30 -0
- package/types/ExternalAccessory.d.ts +98 -0
- package/types/FSKit.d.ts +237 -0
- package/types/FileProvider.d.ts +495 -0
- package/types/FileProviderUI.d.ts +31 -0
- package/types/FinderSync.d.ts +165 -0
- package/types/FocusEngine.d.ts +133 -0
- package/types/ForceFeedback.d.ts +399 -0
- package/types/Foundation.d.ts +18216 -0
- package/types/GLKit.d.ts +937 -0
- package/types/GLUT.d.ts +1018 -0
- package/types/GSS.d.ts +855 -0
- package/types/GameController.d.ts +1394 -0
- package/types/GameKit.d.ts +1958 -0
- package/types/GameSave.d.ts +54 -0
- package/types/GameplayKit.d.ts +1645 -0
- package/types/HealthKit.d.ts +278 -0
- package/types/Hypervisor.d.ts +2079 -0
- package/types/ICADevices.d.ts +1400 -0
- package/types/IOBluetooth.d.ts +6094 -0
- package/types/IOBluetoothUI.d.ts +250 -0
- package/types/IOKit.d.ts +25804 -0
- package/types/IOSurface.d.ts +435 -0
- package/types/IOUSBHost.d.ts +809 -0
- package/types/ImageCaptureCore.d.ts +1104 -0
- package/types/ImageIO.d.ts +1697 -0
- package/types/InputMethodKit.d.ts +264 -0
- package/types/InstallerPlugins.d.ts +102 -0
- package/types/InstantMessage.d.ts +229 -0
- package/types/Intents.d.ts +1833 -0
- package/types/IntentsUI.d.ts +5 -0
- package/types/JavaRuntimeSupport.d.ts +520 -0
- package/types/JavaScriptCore.d.ts +934 -0
- package/types/Kerberos.d.ts +3754 -0
- package/types/Kernel.d.ts +33698 -0
- package/types/KernelManagement.d.ts +5 -0
- package/types/LatentSemanticMapping.d.ts +152 -0
- package/types/LinkPresentation.d.ts +57 -0
- package/types/LocalAuthentication.d.ts +94 -0
- package/types/MLCompute.d.ts +2343 -0
- package/types/MapKit.d.ts +2125 -0
- package/types/Matter.d.ts +151 -0
- package/types/MediaAccessibility.d.ts +137 -0
- package/types/MediaLibrary.d.ts +394 -0
- package/types/MediaPlayer.d.ts +475 -0
- package/types/MediaToolbox.d.ts +70 -0
- package/types/Metal.d.ts +4542 -0
- package/types/MetalFX.d.ts +107 -0
- package/types/MetalKit.d.ts +524 -0
- package/types/MetalPerformanceShaders.d.ts +9306 -0
- package/types/MetalPerformanceShadersGraph.d.ts +1394 -0
- package/types/MetricKit.d.ts +231 -0
- package/types/ModelIO.d.ts +2908 -0
- package/types/MultipeerConnectivity.d.ts +348 -0
- package/types/NaturalLanguage.d.ts +556 -0
- package/types/NearbyInteraction.d.ts +51 -0
- package/types/NetFS.d.ts +99 -0
- package/types/Network.d.ts +1622 -0
- package/types/NetworkExtension.d.ts +1574 -0
- package/types/NotificationCenter.d.ts +103 -0
- package/types/OSAKit.d.ts +260 -0
- package/types/OSLog.d.ts +208 -0
- package/types/OpenAL.d.ts +314 -0
- package/types/OpenCL.d.ts +2489 -0
- package/types/OpenDirectory.d.ts +1919 -0
- package/types/OpenGL.d.ts +11322 -0
- package/types/PCSC.d.ts +534 -0
- package/types/PDFKit.d.ts +1575 -0
- package/types/PHASE.d.ts +166 -0
- package/types/ParavirtualizedGraphics.d.ts +153 -0
- package/types/PassKit.d.ts +1287 -0
- package/types/PencilKit.d.ts +201 -0
- package/types/Photos.d.ts +1125 -0
- package/types/PhotosUI.d.ts +397 -0
- package/types/PreferencePanes.d.ts +68 -0
- package/types/ProximityReaderStub.d.ts +5 -0
- package/types/PushKit.d.ts +45 -0
- package/types/Quartz.d.ts +1642 -0
- package/types/QuartzCore.d.ts +1398 -0
- package/types/QuickLook.d.ts +212 -0
- package/types/QuickLookThumbnailing.d.ts +131 -0
- package/types/QuickLookUI.d.ts +117 -0
- package/types/REVISION.json +5 -0
- package/types/ReplayKit.d.ts +294 -0
- package/types/Runtime.d.ts +51605 -0
- package/types/SafariServices.d.ts +430 -0
- package/types/SafetyKit.d.ts +7 -0
- package/types/SceneKit.d.ts +4996 -0
- package/types/ScreenCaptureKit.d.ts +16 -0
- package/types/ScreenSaver.d.ts +41 -0
- package/types/ScreenTime.d.ts +41 -0
- package/types/ScriptingBridge.d.ts +96 -0
- package/types/Security.d.ts +14336 -0
- package/types/SecurityFoundation.d.ts +53 -0
- package/types/SecurityInterface.d.ts +297 -0
- package/types/SensorKit.d.ts +7 -0
- package/types/ServiceManagement.d.ts +71 -0
- package/types/SharedWithYou.d.ts +9 -0
- package/types/SharedWithYouCore.d.ts +5 -0
- package/types/ShazamKit.d.ts +12 -0
- package/types/Social.d.ts +306 -0
- package/types/SoundAnalysis.d.ts +177 -0
- package/types/Speech.d.ts +246 -0
- package/types/SpriteKit.d.ts +2766 -0
- package/types/StoreKit.d.ts +509 -0
- package/types/SyncServices.d.ts +551 -0
- package/types/SystemConfiguration.d.ts +1415 -0
- package/types/SystemExtensions.d.ts +89 -0
- package/types/TWAIN.d.ts +380 -0
- package/types/Tcl.d.ts +4013 -0
- package/types/ThreadNetwork.d.ts +77 -0
- package/types/Tk.d.ts +3750 -0
- package/types/UIUtilities.d.ts +31 -0
- package/types/UniformTypeIdentifiers.d.ts +358 -0
- package/types/UserNotifications.d.ts +538 -0
- package/types/UserNotificationsUI.d.ts +38 -0
- package/types/VideoDecodeAcceleration.d.ts +50 -0
- package/types/VideoSubscriberAccount.d.ts +139 -0
- package/types/VideoToolbox.d.ts +907 -0
- package/types/Virtualization.d.ts +302 -0
- package/types/Vision.d.ts +1723 -0
- package/types/WebKit.d.ts +5195 -0
- package/types/WidgetKit.d.ts +9 -0
- package/types/_LocationEssentials.d.ts +159 -0
- package/types/_ScreenCaptureKit_SwiftUI.d.ts +5 -0
- package/types/iTunesLibrary.d.ts +528 -0
- package/types/index.d.ts +9 -0
- package/types/vecLib.d.ts +33586 -0
- package/types/vmnet.d.ts +178 -0
- package/src/appkit.d.ts +0 -472
package/src/html-text.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** AppKit's HTML importer owns markup semantics; this layer supplies host styling. */
|
|
2
|
+
export function validateHtmlProps(props: Record<string, any>) {
|
|
3
|
+
if (props.html != null && typeof props.html !== 'string') {
|
|
4
|
+
throw new Error('AppKit htmlview html must be a string')
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const cssString = (value: string) =>
|
|
9
|
+
'"' +
|
|
10
|
+
value
|
|
11
|
+
.replace(/\\/g, '\\\\')
|
|
12
|
+
.replace(/"/g, '\\"')
|
|
13
|
+
.replace(/[\n\r\f]/g, ' ') +
|
|
14
|
+
'"'
|
|
15
|
+
|
|
16
|
+
export function htmlDocument(
|
|
17
|
+
html: string,
|
|
18
|
+
defaults: {
|
|
19
|
+
fontSize: number
|
|
20
|
+
fontFamily: string
|
|
21
|
+
fontWeight: string
|
|
22
|
+
color: string
|
|
23
|
+
style: Record<string, any>
|
|
24
|
+
},
|
|
25
|
+
) {
|
|
26
|
+
const { style } = defaults
|
|
27
|
+
const css = [
|
|
28
|
+
`font-family:${cssString(defaults.fontFamily)}`,
|
|
29
|
+
`font-size:${defaults.fontSize}px`,
|
|
30
|
+
`font-weight:${defaults.fontWeight}`,
|
|
31
|
+
`color:${defaults.color}`,
|
|
32
|
+
'margin:0',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
if (['italic', 'oblique', 'normal'].includes(style.fontStyle)) {
|
|
36
|
+
css.push(`font-style:${style.fontStyle}`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (['left', 'center', 'right', 'justify'].includes(style.textAlign)) {
|
|
40
|
+
css.push(`text-align:${style.textAlign}`)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (Number.isFinite(Number(style.lineHeight)) && Number(style.lineHeight) > 0) {
|
|
44
|
+
css.push(`line-height:${Number(style.lineHeight)}px`)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Append the body defaults as NativeScript does, without escaping authored
|
|
48
|
+
// markup. Escape '<' in generated CSS so a font name cannot close the style.
|
|
49
|
+
return html + '<style>body{' + css.join(';').replace(/</g, '\\3c ') + '}</style>'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function parseHtmlText(
|
|
53
|
+
html: string,
|
|
54
|
+
defaults: {
|
|
55
|
+
fontSize: number
|
|
56
|
+
fontFamily: string
|
|
57
|
+
fontWeight: string
|
|
58
|
+
color: any
|
|
59
|
+
style: Record<string, any>
|
|
60
|
+
},
|
|
61
|
+
) {
|
|
62
|
+
const native = globalThis as any
|
|
63
|
+
if (!html) {
|
|
64
|
+
return native.NSAttributedString.alloc().initWithString('')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const rgb = defaults.color.colorUsingColorSpace(native.NSColorSpace.sRGBColorSpace)
|
|
68
|
+
const color = `rgb(${[rgb.redComponent, rgb.greenComponent, rgb.blueComponent].map((value) => Math.round(Number(value) * 255)).join(',')})`
|
|
69
|
+
const data = native.NSString.stringWithString(
|
|
70
|
+
htmlDocument(html, { ...defaults, color }),
|
|
71
|
+
).dataUsingEncoding(native.NSUTF8StringEncoding)
|
|
72
|
+
|
|
73
|
+
const result = native.NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(
|
|
74
|
+
data,
|
|
75
|
+
{
|
|
76
|
+
[native.NSDocumentTypeDocumentAttribute]: native.NSHTMLTextDocumentType,
|
|
77
|
+
[native.NSCharacterEncodingDocumentAttribute]: native.NSUTF8StringEncoding,
|
|
78
|
+
},
|
|
79
|
+
null,
|
|
80
|
+
null,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if (!result) {
|
|
84
|
+
throw new Error('AppKit htmlview could not parse HTML')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return result
|
|
88
|
+
}
|
package/src/image.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/** Local and embedded sources avoid synchronous network work on AppKit's main thread. */
|
|
2
|
+
|
|
3
|
+
import { NSBundle, NSData, NSImage, NSImageView, NSURL, NSURLSession } from '@octane-xplat/platform/macos'
|
|
2
4
|
export function loadImage(source: unknown): NSImage | null {
|
|
3
5
|
const src = String(source ?? '')
|
|
4
6
|
const match = /^data:[^,]*;base64,(.+)$/s.exec(src)
|
|
@@ -7,6 +9,14 @@ export function loadImage(source: unknown): NSImage | null {
|
|
|
7
9
|
return data ? NSImage.alloc().initWithData(data) : null
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
if (src.startsWith('res://')) {
|
|
13
|
+
return NSImage.imageNamed(src.slice(6))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (src.startsWith('~/')) {
|
|
17
|
+
return NSImage.alloc().initWithContentsOfFile(NSBundle.mainBundle.resourcePath + '/' + src.slice(2))
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
if (src.startsWith('file://')) {
|
|
11
21
|
return NSImage.alloc().initWithContentsOfURL(NSURL.URLWithString(src))
|
|
12
22
|
}
|
|
@@ -24,9 +34,13 @@ export function loadImage(source: unknown): NSImage | null {
|
|
|
24
34
|
|
|
25
35
|
/** Per-view load state. The generation invalidates in-flight decodes when the
|
|
26
36
|
* source changes or `disposeImage` runs — the same guard the webview leaf
|
|
27
|
-
* applies to async measurements.
|
|
37
|
+
* applies to async measurements. `placeholderImage` is kept so a failed load
|
|
38
|
+
* can leave the placeholder standing (the native contract — the placeholder
|
|
39
|
+
* doubles as the failure image). */
|
|
28
40
|
interface ImageRequest {
|
|
29
41
|
source: string
|
|
42
|
+
placeholder: string
|
|
43
|
+
placeholderImage: NSImage | null
|
|
30
44
|
generation: number
|
|
31
45
|
}
|
|
32
46
|
|
|
@@ -39,17 +53,10 @@ const cache = new Map<string, NSImage>()
|
|
|
39
53
|
const pending = new Map<string, ((image: NSImage | null) => void)[]>()
|
|
40
54
|
const IMAGE_CACHE_LIMIT = 64
|
|
41
55
|
|
|
42
|
-
function
|
|
56
|
+
function settleImage(source: string, image: NSImage | null) {
|
|
43
57
|
const callbacks = pending.get(source) ?? []
|
|
44
58
|
pending.delete(source)
|
|
45
59
|
|
|
46
|
-
let image: NSImage | null = null
|
|
47
|
-
try {
|
|
48
|
-
image = loadImage(source)
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.error('[macos-image] decode failed', error)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
60
|
if (image) {
|
|
54
61
|
cache.delete(source)
|
|
55
62
|
cache.set(source, image)
|
|
@@ -63,32 +70,93 @@ function decodeImage(source: string) {
|
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
|
|
73
|
+
function decodeImage(source: string) {
|
|
74
|
+
let image: NSImage | null = null
|
|
75
|
+
try {
|
|
76
|
+
image = loadImage(source)
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error('[macos-image] decode failed', error)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
settleImage(source, image)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Remote sources fetch through NSURLSession and settle through the same
|
|
85
|
+
* cache/waiter path as local decodes. The task is keyed by source, not view —
|
|
86
|
+
* a superseded request is generation-guarded, and letting the fetch finish
|
|
87
|
+
* still populates the cache for the next view asking for it. */
|
|
88
|
+
function fetchImage(source: string) {
|
|
89
|
+
NSURLSession.sharedSession
|
|
90
|
+
.dataTaskWithURLCompletionHandler(NSURL.URLWithString(source), (data: any, _response: any, error: any) => {
|
|
91
|
+
let image: NSImage | null = null
|
|
92
|
+
if (data && !error) {
|
|
93
|
+
try {
|
|
94
|
+
image = NSImage.alloc().initWithData(data)
|
|
95
|
+
} catch (decodeError) {
|
|
96
|
+
console.error('[macos-image] remote decode failed', decodeError)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
settleImage(source, image)
|
|
101
|
+
})
|
|
102
|
+
.resume()
|
|
103
|
+
}
|
|
104
|
+
|
|
66
105
|
/** Points `view` at `source`. Cached decodes assign immediately; anything else
|
|
67
|
-
* decodes on a later run-loop turn
|
|
68
|
-
*
|
|
69
|
-
|
|
106
|
+
* decodes on a later run-loop turn — or fetches over NSURLSession for
|
|
107
|
+
* http(s) — so command batches never block on image I/O. While a load is
|
|
108
|
+
* pending, `placeholder` (a loadImage-resolvable source; the leaf resolves
|
|
109
|
+
* thumbhash:/blurhash: to data: PNGs) paints into the same view, and a failed
|
|
110
|
+
* load leaves it standing. The previous image stays visible until its
|
|
111
|
+
* replacement resolves. */
|
|
112
|
+
export function updateImage(view: NSImageView, source: unknown, placeholder?: unknown) {
|
|
70
113
|
const src = String(source ?? '')
|
|
114
|
+
const ph = String(placeholder ?? '')
|
|
71
115
|
let request = requests.get(view)
|
|
72
116
|
if (!request) {
|
|
73
|
-
request = { source: '', generation: 0 }
|
|
117
|
+
request = { source: '', placeholder: '', placeholderImage: null, generation: 0 }
|
|
74
118
|
requests.set(view, request)
|
|
75
119
|
}
|
|
76
120
|
|
|
77
|
-
if (request.source === src) {
|
|
121
|
+
if (request.source === src && request.placeholder === ph) {
|
|
78
122
|
return
|
|
79
123
|
}
|
|
80
124
|
|
|
125
|
+
if (request.placeholder !== ph) {
|
|
126
|
+
request.placeholderImage = null
|
|
127
|
+
}
|
|
128
|
+
|
|
81
129
|
request.source = src
|
|
130
|
+
request.placeholder = ph
|
|
82
131
|
const generation = ++request.generation
|
|
83
132
|
const deliver = (image: NSImage | null) => {
|
|
84
133
|
if (requests.get(view) !== request || request.generation !== generation) {
|
|
85
134
|
return
|
|
86
135
|
}
|
|
87
136
|
|
|
88
|
-
view.image = image
|
|
137
|
+
view.image = (image ?? request.placeholderImage) as NSImage
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const showPlaceholder = () => {
|
|
141
|
+
if (!ph) {
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (!request.placeholderImage) {
|
|
146
|
+
try {
|
|
147
|
+
request.placeholderImage = loadImage(ph)
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error('[macos-image] placeholder decode failed', error)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (request.placeholderImage) {
|
|
154
|
+
view.image = request.placeholderImage as NSImage
|
|
155
|
+
}
|
|
89
156
|
}
|
|
90
157
|
|
|
91
158
|
if (!src) {
|
|
159
|
+
showPlaceholder()
|
|
92
160
|
deliver(null)
|
|
93
161
|
return
|
|
94
162
|
}
|
|
@@ -99,11 +167,18 @@ export function updateImage(view: NSImageView, source: unknown) {
|
|
|
99
167
|
return
|
|
100
168
|
}
|
|
101
169
|
|
|
170
|
+
// A decode/fetch is pending — the placeholder is the interim content.
|
|
171
|
+
showPlaceholder()
|
|
172
|
+
|
|
102
173
|
let waiters = pending.get(src)
|
|
103
174
|
if (!waiters) {
|
|
104
175
|
waiters = []
|
|
105
176
|
pending.set(src, waiters)
|
|
106
|
-
|
|
177
|
+
if (/^https?:\/\//i.test(src)) {
|
|
178
|
+
fetchImage(src)
|
|
179
|
+
} else {
|
|
180
|
+
setTimeout(() => decodeImage(src), 0)
|
|
181
|
+
}
|
|
107
182
|
}
|
|
108
183
|
|
|
109
184
|
waiters.push(deliver)
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@nativescript/macos-node-api'
|
|
2
|
+
import { NSFontDescriptor, NSView } from '@octane-xplat/platform/macos'
|
|
2
3
|
|
|
3
4
|
export * from 'octane/universal/native'
|
|
4
5
|
export interface MacOSRootOptions {
|
|
@@ -16,3 +17,11 @@ export declare function createMacOSRoot(
|
|
|
16
17
|
hostView: NSView,
|
|
17
18
|
options?: MacOSRootOptions,
|
|
18
19
|
): import('octane/universal/native').UniversalRoot
|
|
20
|
+
|
|
21
|
+
/** @internal Compiler ABI for tabviewitem JSX spreads in xplatMacOS builds. */
|
|
22
|
+
export declare function __tabItemProps(props: any): any
|
|
23
|
+
|
|
24
|
+
/** @internal Compiler-owned portal wrapper for raw AppKit tab items. */
|
|
25
|
+
export declare function __PortalTabItem(props: any): any
|
|
26
|
+
/** @internal Compiler-owned portal wrapper for raw AppKit list cells. */
|
|
27
|
+
export declare function __PortalList(props: any): any
|