1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/// <reference path='./import.ts' /> 17class ArkWebComponent extends ArkComponent implements WebAttribute { 18 constructor(nativePtr: KNode) { 19 super(nativePtr); 20 } 21 javaScriptAccess(javaScriptAccess: boolean): this { 22 throw new Error('Method not implemented.'); 23 } 24 fileAccess(fileAccess: boolean): this { 25 throw new Error('Method not implemented.'); 26 } 27 onlineImageAccess(onlineImageAccess: boolean): this { 28 throw new Error('Method not implemented.'); 29 } 30 domStorageAccess(domStorageAccess: boolean): this { 31 throw new Error('Method not implemented.'); 32 } 33 imageAccess(imageAccess: boolean): this { 34 throw new Error('Method not implemented.'); 35 } 36 mixedMode(mixedMode: MixedMode): this { 37 throw new Error('Method not implemented.'); 38 } 39 zoomAccess(zoomAccess: boolean): this { 40 throw new Error('Method not implemented.'); 41 } 42 geolocationAccess(geolocationAccess: boolean): this { 43 throw new Error('Method not implemented.'); 44 } 45 javaScriptProxy(javaScriptProxy: { object: object; name: string; methodList: string[]; controller: any; }): this { 46 throw new Error('Method not implemented.'); 47 } 48 password(password: boolean): this { 49 throw new Error('Method not implemented.'); 50 } 51 cacheMode(cacheMode: CacheMode): this { 52 throw new Error('Method not implemented.'); 53 } 54 darkMode(mode: WebDarkMode): this { 55 throw new Error('Method not implemented.'); 56 } 57 forceDarkAccess(access: boolean): this { 58 throw new Error('Method not implemented.'); 59 } 60 mediaOptions(options: WebMediaOptions): this { 61 throw new Error('Method not implemented.'); 62 } 63 tableData(tableData: boolean): this { 64 throw new Error('Method not implemented.'); 65 } 66 wideViewModeAccess(wideViewModeAccess: boolean): this { 67 throw new Error('Method not implemented.'); 68 } 69 overviewModeAccess(overviewModeAccess: boolean): this { 70 throw new Error('Method not implemented.'); 71 } 72 overScrollMode(mode: OverScrollMode): this { 73 throw new Error('Method not implemented.'); 74 } 75 textZoomAtio(textZoomAtio: number): this { 76 throw new Error('Method not implemented.'); 77 } 78 textZoomRatio(textZoomRatio: number): this { 79 throw new Error('Method not implemented.'); 80 } 81 databaseAccess(databaseAccess: boolean): this { 82 throw new Error('Method not implemented.'); 83 } 84 initialScale(percent: number): this { 85 throw new Error('Method not implemented.'); 86 } 87 userAgent(userAgent: string): this { 88 throw new Error('Method not implemented.'); 89 } 90 onPageEnd(callback: (event?: { url: string; } | undefined) => void): this { 91 throw new Error('Method not implemented.'); 92 } 93 onPageBegin(callback: (event?: { url: string; } | undefined) => void): this { 94 throw new Error('Method not implemented.'); 95 } 96 onProgressChange(callback: (event?: { newProgress: number; } | undefined) => void): this { 97 throw new Error('Method not implemented.'); 98 } 99 onTitleReceive(callback: (event?: { title: string; } | undefined) => void): this { 100 throw new Error('Method not implemented.'); 101 } 102 onGeolocationHide(callback: () => void): this { 103 throw new Error('Method not implemented.'); 104 } 105 onGeolocationShow(callback: (event?: { origin: string; geolocation: JsGeolocation; } | undefined) => void): this { 106 throw new Error('Method not implemented.'); 107 } 108 onRequestSelected(callback: () => void): this { 109 throw new Error('Method not implemented.'); 110 } 111 onAlert(callback: (event?: { url: string; message: string; result: JsResult; } | undefined) => boolean): this { 112 throw new Error('Method not implemented.'); 113 } 114 onBeforeUnload(callback: (event?: { url: string; message: string; result: JsResult; } | undefined) => boolean): this { 115 throw new Error('Method not implemented.'); 116 } 117 onConfirm(callback: (event?: { url: string; message: string; result: JsResult; } | undefined) => boolean): this { 118 throw new Error('Method not implemented.'); 119 } 120 onPrompt(callback: (event?: { url: string; message: string; value: string; result: JsResult; } | undefined) => boolean): this { 121 throw new Error('Method not implemented.'); 122 } 123 onConsole(callback: (event?: { message: ConsoleMessage; } | undefined) => boolean): this { 124 throw new Error('Method not implemented.'); 125 } 126 onErrorReceive(callback: (event?: { request: WebResourceRequest; error: WebResourceError; } | undefined) => void): this { 127 throw new Error('Method not implemented.'); 128 } 129 onHttpErrorReceive(callback: (event?: { request: WebResourceRequest; response: WebResourceResponse; } | undefined) => void): this { 130 throw new Error('Method not implemented.'); 131 } 132 onDownloadStart(callback: (event?: { 133 url: string; 134 userAgent: string; contentDisposition: string; 135 mimetype: string; contentLength: number; 136 } | undefined) => void): this { 137 throw new Error('Method not implemented.'); 138 } 139 onRefreshAccessedHistory(callback: (event?: { url: string; isRefreshed: boolean; } | undefined) => void): this { 140 throw new Error('Method not implemented.'); 141 } 142 onUrlLoadIntercept(callback: (event?: { data: string | WebResourceRequest; } | undefined) => boolean): this { 143 throw new Error('Method not implemented.'); 144 } 145 onSslErrorReceive(callback: (event?: { handler: Function; error: object; } | undefined) => void): this { 146 throw new Error('Method not implemented.'); 147 } 148 onRenderExited(callback: (event?: { renderExitReason: RenderExitReason; } | undefined) => void): this; 149 onRenderExited(callback: (event?: { detail: object; } | undefined) => boolean): this; 150 onRenderExited(callback: unknown): this { 151 throw new Error('Method not implemented.'); 152 } 153 onShowFileSelector(callback: (event?: { result: FileSelectorResult; fileSelector: FileSelectorParam; } | undefined) => boolean): this { 154 throw new Error('Method not implemented.'); 155 } 156 onFileSelectorShow(callback: (event?: { callback: Function; fileSelector: object; } | undefined) => void): this { 157 throw new Error('Method not implemented.'); 158 } 159 onResourceLoad(callback: (event: { url: string; }) => void): this { 160 throw new Error('Method not implemented.'); 161 } 162 onFullScreenExit(callback: () => void): this { 163 throw new Error('Method not implemented.'); 164 } 165 onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler; }) => void): this { 166 throw new Error('Method not implemented.'); 167 } 168 onScaleChange(callback: (event: { oldScale: number; newScale: number; }) => void): this { 169 throw new Error('Method not implemented.'); 170 } 171 onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler; host: string; realm: string; } | undefined) => boolean): this { 172 throw new Error('Method not implemented.'); 173 } 174 onInterceptRequest(callback: (event?: { request: WebResourceRequest; } | undefined) => WebResourceResponse): this { 175 throw new Error('Method not implemented.'); 176 } 177 onPermissionRequest(callback: (event?: { request: PermissionRequest; } | undefined) => void): this { 178 throw new Error('Method not implemented.'); 179 } 180 onScreenCaptureRequest(callback: (event?: { handler: ScreenCaptureHandler; } | undefined) => void): this { 181 throw new Error('Method not implemented.'); 182 } 183 onContextMenuShow(callback: (event?: { param: WebContextMenuParam; result: WebContextMenuResult; } | undefined) => boolean): this { 184 throw new Error('Method not implemented.'); 185 } 186 mediaPlayGestureAccess(access: boolean): this { 187 throw new Error('Method not implemented.'); 188 } 189 onSearchResultReceive(callback: (event?: { activeMatchOrdinal: number; numberOfMatches: number; isDoneCounting: boolean; } | undefined) => void): this { 190 throw new Error('Method not implemented.'); 191 } 192 onScroll(callback: (event: { xOffset: number; yOffset: number; }) => void): this { 193 throw new Error('Method not implemented.'); 194 } 195 onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler; error: SslError; }) => void): this { 196 throw new Error('Method not implemented.'); 197 } 198 onClientAuthenticationRequest(callback: (event: { 199 handler: ClientAuthenticationHandler; 200 host: string; port: number; keyTypes: string[]; issuers: string[]; 201 }) => void): this { 202 throw new Error('Method not implemented.'); 203 } 204 onWindowNew(callback: (event: { isAlert: boolean; isUserTrigger: boolean; targetUrl: string; handler: ControllerHandler; }) => void): this { 205 throw new Error('Method not implemented.'); 206 } 207 onWindowExit(callback: () => void): this { 208 throw new Error('Method not implemented.'); 209 } 210 multiWindowAccess(multiWindow: boolean): this { 211 throw new Error('Method not implemented.'); 212 } 213 onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): this { 214 throw new Error('Method not implemented.'); 215 } 216 webStandardFont(family: string): this { 217 throw new Error('Method not implemented.'); 218 } 219 webSerifFont(family: string): this { 220 throw new Error('Method not implemented.'); 221 } 222 webSansSerifFont(family: string): this { 223 throw new Error('Method not implemented.'); 224 } 225 webFixedFont(family: string): this { 226 throw new Error('Method not implemented.'); 227 } 228 webFantasyFont(family: string): this { 229 throw new Error('Method not implemented.'); 230 } 231 webCursiveFont(family: string): this { 232 throw new Error('Method not implemented.'); 233 } 234 defaultFixedFontSize(size: number): this { 235 throw new Error('Method not implemented.'); 236 } 237 defaultFontSize(size: number): this { 238 throw new Error('Method not implemented.'); 239 } 240 minFontSize(size: number): this { 241 throw new Error('Method not implemented.'); 242 } 243 minLogicalFontSize(size: number): this { 244 throw new Error('Method not implemented.'); 245 } 246 blockNetwork(block: boolean): this { 247 throw new Error('Method not implemented.'); 248 } 249 horizontalScrollBarAccess(horizontalScrollBar: boolean): this { 250 throw new Error('Method not implemented.'); 251 } 252 verticalScrollBarAccess(verticalScrollBar: boolean): this { 253 throw new Error('Method not implemented.'); 254 } 255 onTouchIconUrlReceived(callback: (event: { url: string; precomposed: boolean; }) => void): this { 256 throw new Error('Method not implemented.'); 257 } 258 onFaviconReceived(callback: (event: { favicon: any; }) => void): this { 259 throw new Error('Method not implemented.'); 260 } 261 onPageVisible(callback: (event: { url: string; }) => void): this { 262 throw new Error('Method not implemented.'); 263 } 264 onDataResubmitted(callback: (event: { handler: DataResubmissionHandler; }) => void): this { 265 throw new Error('Method not implemented.'); 266 } 267 pinchSmooth(isEnabled: boolean): this { 268 throw new Error('Method not implemented.'); 269 } 270 allowWindowOpenMethod(flag: boolean): this { 271 throw new Error('Method not implemented.'); 272 } 273 onAudioStateChanged(callback: (event: { playing: boolean; }) => void): this { 274 throw new Error('Method not implemented.'); 275 } 276 onFirstContentfulPaint(callback: (event?: { navigationStartTick: number; firstContentfulPaintMs: number; } | undefined) => void): this { 277 throw new Error('Method not implemented.'); 278 } 279 onLoadIntercept(callback: (event: { data: WebResourceRequest; }) => boolean): this { 280 throw new Error('Method not implemented.'); 281 } 282 onControllerAttached(callback: () => void): this { 283 throw new Error('Method not implemented.'); 284 } 285 onOverScroll(callback: (event: { xOffset: number; yOffset: number; }) => void): this { 286 throw new Error('Method not implemented.'); 287 } 288 javaScriptOnDocumentStart(scripts: ScriptItem[]): this { 289 throw new Error('Method not implemented.'); 290 } 291 layoutMode(mode: WebLayoutMode): this { 292 throw new Error('Method not implemented.'); 293 } 294 nestedScroll(value: NestedScrollOptions): this { 295 throw new Error('Method not implemented.'); 296 } 297} 298 299// @ts-ignore 300globalThis.Web.attributeModifier = function (modifier) { 301 const elmtId = ViewStackProcessor.GetElmtIdToAccountFor(); 302 let nativeNode = getUINativeModule().getFrameNodeById(elmtId); 303 let component = this.createOrGetNode(elmtId, () => { 304 return new ArkWebComponent(nativeNode); 305 }); 306 applyUIAttributes(modifier, nativeNode, component); 307 component.applyModifierPatch(); 308}; 309