diff --git a/src/Components/Web.JS/package.json b/src/Components/Web.JS/package.json index 02fc08b2d827..bcf4b6508a4b 100644 --- a/src/Components/Web.JS/package.json +++ b/src/Components/Web.JS/package.json @@ -12,6 +12,7 @@ "preclean": "yarn install --mutex network --frozen-lockfile", "clean": "node node_modules/rimraf/bin.js ./dist/Debug ./dist/Release", "prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile", + "lint": "eslint -c ./src/.eslintrc.js --ext .ts ./src", "build": "yarn run build:debug && yarn run build:production", "build:debug": "cd src && node ../node_modules/webpack-cli/bin/cli.js --mode development --config ./webpack.config.js", "build:production": "cd src && node ../node_modules/webpack-cli/bin/cli.js --mode production --config ./webpack.config.js", @@ -30,6 +31,7 @@ "@typescript-eslint/parser": "^4.29.3", "babel-jest": "^27.1.0", "eslint": "^7.32.0", + "eslint-plugin-header": "^3.1.1", "inspectpack": "^4.7.1", "jest": "^27.1.0", "rimraf": "^3.0.2", diff --git a/src/Components/Web.JS/src/.eslintrc.js b/src/Components/Web.JS/src/.eslintrc.js index 3cdd38968789..ac51b8db75ae 100644 --- a/src/Components/Web.JS/src/.eslintrc.js +++ b/src/Components/Web.JS/src/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { parser: '@typescript-eslint/parser', // Specifies the ESLint parser - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'header'], extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin @@ -62,8 +62,16 @@ module.exports = { "asyncArrow": "always" }], "space-in-parens": ["error", "never"], - "space-infix-ops": ["error"] - + "space-infix-ops": ["error"], + "header/header": [ + 2, + "line", + [ + " Licensed to the .NET Foundation under one or more agreements.", + " The .NET Foundation licenses this file to you under the MIT license." + ], + 2 + ] }, globals: { DotNet: "readonly" diff --git a/src/Components/Web.JS/src/BinaryDecoder.ts b/src/Components/Web.JS/src/BinaryDecoder.ts index 6b7f1d5eaec1..da389d0a48c8 100644 --- a/src/Components/Web.JS/src/BinaryDecoder.ts +++ b/src/Components/Web.JS/src/BinaryDecoder.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + const uint64HighPartShift = Math.pow(2, 32); const maxSafeNumberHighPart = Math.pow(2, 21) - 1; // The high-order int32 from Number.MAX_SAFE_INTEGER diff --git a/src/Components/Web.JS/src/Boot.Server.ts b/src/Components/Web.JS/src/Boot.Server.ts index 12222ac20346..01db21cb02c0 100644 --- a/src/Components/Web.JS/src/Boot.Server.ts +++ b/src/Components/Web.JS/src/Boot.Server.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; import { Blazor } from './GlobalExports'; import { HubConnectionBuilder, HubConnection, HttpTransportType } from '@microsoft/signalr'; @@ -111,7 +114,7 @@ async function initializeConnection(options: CircuitStartOptions, logger: Logger complete: () => controller.close(), error: (err) => controller.error(err), }); - } + }, }); DotNet.jsCallDispatcher.supplyDotNetStream(streamId, readableStream); diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.ts b/src/Components/Web.JS/src/Boot.WebAssembly.ts index 5517ed65fed7..711bff688b16 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + /* eslint-disable array-element-newline */ import { DotNet } from '@microsoft/dotnet-js-interop'; import { Blazor } from './GlobalExports'; diff --git a/src/Components/Web.JS/src/Boot.WebView.ts b/src/Components/Web.JS/src/Boot.WebView.ts index b77409285506..8f7d91565bf4 100644 --- a/src/Components/Web.JS/src/Boot.WebView.ts +++ b/src/Components/Web.JS/src/Boot.WebView.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; import { Blazor } from './GlobalExports'; import { shouldAutoStart } from './BootCommon'; diff --git a/src/Components/Web.JS/src/BootCommon.ts b/src/Components/Web.JS/src/BootCommon.ts index 0d502ada9b94..9c9a3464d6f4 100644 --- a/src/Components/Web.JS/src/BootCommon.ts +++ b/src/Components/Web.JS/src/BootCommon.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + // Tells you if the script was added without export function shouldAutoStart(): boolean { return !!(document && diff --git a/src/Components/Web.JS/src/BootErrors.ts b/src/Components/Web.JS/src/BootErrors.ts index 2aac9ff46187..a90a00612012 100644 --- a/src/Components/Web.JS/src/BootErrors.ts +++ b/src/Components/Web.JS/src/BootErrors.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + let hasFailed = false; export function showErrorNotification(): void { diff --git a/src/Components/Web.JS/src/DomWrapper.ts b/src/Components/Web.JS/src/DomWrapper.ts index ea6527e9b619..5483985be7fd 100644 --- a/src/Components/Web.JS/src/DomWrapper.ts +++ b/src/Components/Web.JS/src/DomWrapper.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import '@microsoft/dotnet-js-interop'; export const domFunctions = { diff --git a/src/Components/Web.JS/src/Environment.ts b/src/Components/Web.JS/src/Environment.ts index cf4329213a5a..eade82fa9e07 100644 --- a/src/Components/Web.JS/src/Environment.ts +++ b/src/Components/Web.JS/src/Environment.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + // Expose an export called 'platform' of the interface type 'Platform', // so that consumers can be agnostic about which implementation they use. // Basic alternative to having an actual DI container. diff --git a/src/Components/Web.JS/src/GlobalExports.ts b/src/Components/Web.JS/src/GlobalExports.ts index 21ab215dda89..5a573312b053 100644 --- a/src/Components/Web.JS/src/GlobalExports.ts +++ b/src/Components/Web.JS/src/GlobalExports.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { navigateTo, internalFunctions as navigationManagerInternalFunctions, NavigationOptions } from './Services/NavigationManager'; import { domFunctions } from './DomWrapper'; import { Virtualize } from './Virtualize'; diff --git a/src/Components/Web.JS/src/InputFile.ts b/src/Components/Web.JS/src/InputFile.ts index 0470b2968942..9519c2bf97a4 100644 --- a/src/Components/Web.JS/src/InputFile.ts +++ b/src/Components/Web.JS/src/InputFile.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export const InputFile = { init, toImageFile, diff --git a/src/Components/Web.JS/src/JSInitializers/JSInitializers.Server.ts b/src/Components/Web.JS/src/JSInitializers/JSInitializers.Server.ts index 44a941690146..ad783e62a69a 100644 --- a/src/Components/Web.JS/src/JSInitializers/JSInitializers.Server.ts +++ b/src/Components/Web.JS/src/JSInitializers/JSInitializers.Server.ts @@ -1,12 +1,15 @@ -import { BootJsonData } from "../Platform/BootConfig"; -import { CircuitStartOptions } from "../Platform/Circuits/CircuitStartOptions"; -import { JSInitializer } from "./JSInitializers"; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +import { BootJsonData } from '../Platform/BootConfig'; +import { CircuitStartOptions } from '../Platform/Circuits/CircuitStartOptions'; +import { JSInitializer } from './JSInitializers'; export async function fetchAndInvokeInitializers(options: Partial) : Promise { const jsInitializersResponse = await fetch('_blazor/initializers', { method: 'GET', credentials: 'include', - cache: 'no-cache' + cache: 'no-cache', }); const initializers: string[] = await jsInitializersResponse.json(); diff --git a/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebAssembly.ts b/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebAssembly.ts index 23127e0b6621..4e82a94184d4 100644 --- a/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebAssembly.ts +++ b/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebAssembly.ts @@ -1,6 +1,9 @@ -import { BootJsonData } from "../Platform/BootConfig"; -import { WebAssemblyStartOptions } from "../Platform/WebAssemblyStartOptions"; -import { JSInitializer } from "./JSInitializers"; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +import { BootJsonData } from '../Platform/BootConfig'; +import { WebAssemblyStartOptions } from '../Platform/WebAssemblyStartOptions'; +import { JSInitializer } from './JSInitializers'; export async function fetchAndInvokeInitializers(bootConfig: BootJsonData, options: Partial) : Promise { const initializers = bootConfig.resources.libraryInitializers; @@ -8,7 +11,8 @@ export async function fetchAndInvokeInitializers(bootConfig: BootJsonData, optio if (initializers) { await jsInitializer.importInitializersAsync( Object.keys(initializers), - [options, bootConfig.resources.extensions]); + [options, bootConfig.resources.extensions] + ); } return jsInitializer; diff --git a/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebView.ts b/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebView.ts index b57d53ad185e..0b46064ef5ea 100644 --- a/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebView.ts +++ b/src/Components/Web.JS/src/JSInitializers/JSInitializers.WebView.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { JSInitializer } from './JSInitializers'; export async function fetchAndInvokeInitializers() : Promise { diff --git a/src/Components/Web.JS/src/JSInitializers/JSInitializers.ts b/src/Components/Web.JS/src/JSInitializers/JSInitializers.ts index 3d31b050f07d..b00ce7af451d 100644 --- a/src/Components/Web.JS/src/JSInitializers/JSInitializers.ts +++ b/src/Components/Web.JS/src/JSInitializers/JSInitializers.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { Blazor } from '../GlobalExports'; type BeforeBlazorStartedCallback = (...args: unknown[]) => Promise; diff --git a/src/Components/Web.JS/src/PageTitle.ts b/src/Components/Web.JS/src/PageTitle.ts index ed2fabc53565..a92aa64034da 100644 --- a/src/Components/Web.JS/src/PageTitle.ts +++ b/src/Components/Web.JS/src/PageTitle.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { getLogicalParent, LogicalElement } from './Rendering/LogicalElements'; export const PageTitle = { diff --git a/src/Components/Web.JS/src/Platform/BootConfig.ts b/src/Components/Web.JS/src/Platform/BootConfig.ts index 933a781e2507..26f5755c0036 100644 --- a/src/Components/Web.JS/src/Platform/BootConfig.ts +++ b/src/Components/Web.JS/src/Platform/BootConfig.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { WebAssemblyBootResourceType } from './WebAssemblyStartOptions'; type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise | null | undefined; diff --git a/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts b/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts index 880560f43c67..9dd52c0f59db 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { internalFunctions as navigationManagerFunctions } from '../../Services/NavigationManager'; import { toLogicalRootCommentElement, LogicalElement, toLogicalElement } from '../../Rendering/LogicalElements'; import { ServerComponentDescriptor } from '../../Services/ComponentDescriptorDiscovery'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/CircuitStartOptions.ts b/src/Components/Web.JS/src/Platform/Circuits/CircuitStartOptions.ts index f536388f55c0..1f18a72a33fd 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/CircuitStartOptions.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/CircuitStartOptions.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { LogLevel } from '../Logging/Logger'; import { HubConnectionBuilder } from '@microsoft/signalr'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/CircuitStreamingInterop.ts b/src/Components/Web.JS/src/Platform/Circuits/CircuitStreamingInterop.ts index 31601aec12e6..c0f9ae5e385d 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/CircuitStreamingInterop.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/CircuitStreamingInterop.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { HubConnection } from '@microsoft/signalr'; import { getNextChunk } from '../../StreamingInterop'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts index 0ae25989a3ed..03e00cc76869 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { ReconnectDisplay } from './ReconnectDisplay'; import { Logger, LogLevel } from '../Logging/Logger'; import { Blazor } from '../../GlobalExports'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectionHandler.ts b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectionHandler.ts index 386e4f0af56a..d5fd175c7b46 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectionHandler.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectionHandler.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { ReconnectionHandler, ReconnectionOptions } from './CircuitStartOptions'; import { ReconnectDisplay } from './ReconnectDisplay'; import { DefaultReconnectDisplay } from './DefaultReconnectDisplay'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/ReconnectDisplay.ts b/src/Components/Web.JS/src/Platform/Circuits/ReconnectDisplay.ts index d16e5dba8ed4..e319913044d2 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/ReconnectDisplay.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/ReconnectDisplay.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export interface ReconnectDisplay { show(): void; update(currentAttempt: number): void; diff --git a/src/Components/Web.JS/src/Platform/Circuits/RenderQueue.ts b/src/Components/Web.JS/src/Platform/Circuits/RenderQueue.ts index 32838ca038b2..165b2e0d1508 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/RenderQueue.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/RenderQueue.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { renderBatch } from '../../Rendering/Renderer'; import { OutOfProcessRenderBatch } from '../../Rendering/RenderBatch/OutOfProcessRenderBatch'; import { Logger, LogLevel } from '../Logging/Logger'; diff --git a/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts b/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts index 5531f50a58a3..c4f05fb0cc73 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { ReconnectDisplay } from './ReconnectDisplay'; export class UserSpecifiedDisplay implements ReconnectDisplay { static readonly ShowClassName = 'components-reconnect-show'; diff --git a/src/Components/Web.JS/src/Platform/Logging/Loggers.ts b/src/Components/Web.JS/src/Platform/Logging/Loggers.ts index 2d4c5037b773..d56561f6b24b 100644 --- a/src/Components/Web.JS/src/Platform/Logging/Loggers.ts +++ b/src/Components/Web.JS/src/Platform/Logging/Loggers.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + /* eslint-disable no-console */ import { Logger, LogLevel } from './Logger'; diff --git a/src/Components/Web.JS/src/Platform/Mono/MonoDebugger.ts b/src/Components/Web.JS/src/Platform/Mono/MonoDebugger.ts index 44768d5a491d..a4d4a3087801 100644 --- a/src/Components/Web.JS/src/Platform/Mono/MonoDebugger.ts +++ b/src/Components/Web.JS/src/Platform/Mono/MonoDebugger.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { WebAssemblyResourceLoader } from '../WebAssemblyResourceLoader'; const currentBrowserIsChrome = (window as any).chrome diff --git a/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts b/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts index 73766c1d968a..230051deaf37 100644 --- a/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts +++ b/src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts @@ -1,4 +1,6 @@ -/* eslint-disable @typescript-eslint/ban-types */ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + /* eslint-disable no-prototype-builtins */ import { DotNet } from '@microsoft/dotnet-js-interop'; import { attachDebuggerHotkey, hasDebuggingEnabled } from './MonoDebugger'; diff --git a/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts b/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts index 830204788f34..e57a7dfb3070 100644 --- a/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts +++ b/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { Pointer, System_String, System_Array, System_Object } from '../Platform'; // Mono uses this global to hang various debugging-related items on @@ -14,7 +17,7 @@ declare interface MONO { // Mono uses this global to hold low-level interop APIs declare interface BINDING { mono_obj_array_new(length: number): System_Array; - mono_obj_array_set(array: System_Array, index: Number, value: System_Object): void; + mono_obj_array_set(array: System_Array, index: number, value: System_Object): void; js_string_to_mono_string(jsString: string): System_String; js_typed_array_to_array(array: Uint8Array): System_Object; js_to_mono_obj(jsObject: any) : System_Object; diff --git a/src/Components/Web.JS/src/Platform/Platform.ts b/src/Components/Web.JS/src/Platform/Platform.ts index 17ef10c19944..c646e5a4f083 100644 --- a/src/Components/Web.JS/src/Platform/Platform.ts +++ b/src/Components/Web.JS/src/Platform/Platform.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { WebAssemblyResourceLoader } from './WebAssemblyResourceLoader'; export interface Platform { diff --git a/src/Components/Web.JS/src/Platform/WebAssemblyComponentAttacher.ts b/src/Components/Web.JS/src/Platform/WebAssemblyComponentAttacher.ts index 8f7221662505..9c6fcabc47a9 100644 --- a/src/Components/Web.JS/src/Platform/WebAssemblyComponentAttacher.ts +++ b/src/Components/Web.JS/src/Platform/WebAssemblyComponentAttacher.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { LogicalElement, toLogicalRootCommentElement } from '../Rendering/LogicalElements'; import { WebAssemblyComponentDescriptor } from '../Services/ComponentDescriptorDiscovery'; diff --git a/src/Components/Web.JS/src/Platform/WebAssemblyConfigLoader.ts b/src/Components/Web.JS/src/Platform/WebAssemblyConfigLoader.ts index d7e89c7bf573..286623a335ab 100644 --- a/src/Components/Web.JS/src/Platform/WebAssemblyConfigLoader.ts +++ b/src/Components/Web.JS/src/Platform/WebAssemblyConfigLoader.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { BootConfigResult } from './BootConfig'; import { System_String, System_Object } from './Platform'; import { Blazor } from '../GlobalExports'; diff --git a/src/Components/Web.JS/src/Platform/WebAssemblyResourceLoader.ts b/src/Components/Web.JS/src/Platform/WebAssemblyResourceLoader.ts index 0d607c2c6a22..f286d79517e2 100644 --- a/src/Components/Web.JS/src/Platform/WebAssemblyResourceLoader.ts +++ b/src/Components/Web.JS/src/Platform/WebAssemblyResourceLoader.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { toAbsoluteUri } from '../Services/NavigationManager'; import { BootJsonData, ResourceList } from './BootConfig'; import { WebAssemblyStartOptions, WebAssemblyBootResourceType } from './WebAssemblyStartOptions'; diff --git a/src/Components/Web.JS/src/Platform/WebAssemblyStartOptions.ts b/src/Components/Web.JS/src/Platform/WebAssemblyStartOptions.ts index c48a5100a5d3..4c40a349f466 100644 --- a/src/Components/Web.JS/src/Platform/WebAssemblyStartOptions.ts +++ b/src/Components/Web.JS/src/Platform/WebAssemblyStartOptions.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export interface WebAssemblyStartOptions { /** * Overrides the built-in boot resource loading mechanism so that boot resources can be fetched diff --git a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcCommon.ts b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcCommon.ts index 72db02f201c8..33598d2956b8 100644 --- a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcCommon.ts +++ b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcCommon.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + const ipcMessagePrefix = '__bwv:'; let applicationIsTerminated = false; @@ -18,10 +21,10 @@ export function tryDeserializeMessage(message: string): IpcMessage | null { } export function setApplicationIsTerminated() { - // If there's an unhandled exception, we'll prevent the webview from doing anything else until - // it reloads the page. This is equivalent to what happens in Blazor Server, and avoids anyone - // taking a dependency on being able to continue interacting after a fatal error. - applicationIsTerminated = true; + // If there's an unhandled exception, we'll prevent the webview from doing anything else until + // it reloads the page. This is equivalent to what happens in Blazor Server, and avoids anyone + // taking a dependency on being able to continue interacting after a fatal error. + applicationIsTerminated = true; } interface IpcMessage { diff --git a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcReceiver.ts b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcReceiver.ts index 4935983811cd..8e5fbdc4c1d1 100644 --- a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcReceiver.ts +++ b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcReceiver.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; import { showErrorNotification } from '../../BootErrors'; import { OutOfProcessRenderBatch } from '../../Rendering/RenderBatch/OutOfProcessRenderBatch'; diff --git a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcSender.ts b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcSender.ts index 20967d60cac5..ca39ee83d2d3 100644 --- a/src/Components/Web.JS/src/Platform/WebView/WebViewIpcSender.ts +++ b/src/Components/Web.JS/src/Platform/WebView/WebViewIpcSender.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { trySerializeMessage } from './WebViewIpcCommon'; export function sendAttachPage(baseUrl: string, startUrl: string) { @@ -26,7 +29,7 @@ function base64EncodeByteArray(data: Uint8Array) { // Note `btoa(String.fromCharCode.apply(null, data as unknown as number[]));` // isn't sufficient as the `apply` over a large array overflows the stack. const charBytes = new Array(data.length); - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { charBytes[i] = String.fromCharCode(data[i]); } const dataBase64Encoded = btoa(charBytes.join('')); diff --git a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts index aa622e0ecd86..cef5c15a56d8 100644 --- a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts +++ b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { RenderBatch, ArrayBuilderSegment, RenderTreeEdit, RenderTreeFrame, EditType, FrameType, ArrayValues } from './RenderBatch/RenderBatch'; import { EventDelegator } from './Events/EventDelegator'; import { LogicalElement, PermutationListEntry, toLogicalElement, insertLogicalChild, removeLogicalChild, getLogicalParent, getLogicalChild, createAndInsertLogicalContainer, isSvgElement, getLogicalChildrenArray, getLogicalSiblingEnd, permuteLogicalChildren, getClosestDomElement, emptyLogicalElement } from './LogicalElements'; @@ -15,6 +18,7 @@ export class BrowserRenderer { public eventDelegator: EventDelegator; private rootComponentIds = new Set(); + private childComponentLocations: { [componentId: number]: LogicalElement } = {}; public constructor(browserRendererId: number) { diff --git a/src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts b/src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts index ac965690d0cb..87200d999730 100644 --- a/src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts +++ b/src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; export function applyCaptureIdToElement(element: Element, referenceCaptureId: string) { diff --git a/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts b/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts index 1f81330ab2da..a4b6f2a9466e 100644 --- a/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { EventFieldInfo } from './EventFieldInfo'; import { eventNameAliasRegisteredCallbacks, getBrowserEventName, getEventNameAliases, getEventTypeOptions } from './EventTypes'; import { dispatchEvent } from '../WebRendererInteropMethods'; @@ -44,7 +47,13 @@ const nonBubblingEvents = toLookup([ const alwaysPreventDefaultEvents: { [eventType: string]: boolean } = { submit: true }; -const disableableEventNames = toLookup(['click', 'dblclick', 'mousedown', 'mousemove', 'mouseup']); +const disableableEventNames = toLookup([ + 'click', + 'dblclick', + 'mousedown', + 'mousemove', + 'mouseup', +]); // Responsible for adding/removing the eventInfo on an expando property on DOM elements, and // calling an EventInfoStore that deals with registering/unregistering the underlying delegated @@ -178,7 +187,7 @@ export class EventDelegator { dispatchEvent(this.browserRendererId, { eventHandlerId: handlerInfo.eventHandlerId, eventName: eventName, - eventFieldInfo: EventFieldInfo.fromEvent(handlerInfo.renderingComponentId, browserEvent) + eventFieldInfo: EventFieldInfo.fromEvent(handlerInfo.renderingComponentId, browserEvent), }, eventArgs); } @@ -303,7 +312,9 @@ class EventHandlerInfosForElement { // that name at any one time. // So to keep things simple, only track one EventHandlerInfo per (element, eventName) private handlers: { [eventName: string]: EventHandlerInfo } = {}; + private preventDefaultFlags: { [eventName: string]: boolean } | null = null; + private stopPropagationFlags: { [eventName: string]: boolean } | null = null; public getHandler(eventName: string): EventHandlerInfo | null { diff --git a/src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts b/src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts index 205f5d0cf276..12b71f5b6f43 100644 --- a/src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts @@ -1,34 +1,37 @@ -export class EventFieldInfo { - constructor(public componentId: number, public fieldValue: string | boolean) { - } +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. - public static fromEvent(componentId: number, event: Event): EventFieldInfo | null { - const elem = event.target; - if (elem instanceof Element) { - const fieldData = getFormFieldData(elem); - if (fieldData) { - return new EventFieldInfo(componentId, fieldData.value); - } - } +export class EventFieldInfo { + constructor(public componentId: number, public fieldValue: string | boolean) { + } - // This event isn't happening on a form field that we can reverse-map back to some incoming attribute - return null; + public static fromEvent(componentId: number, event: Event): EventFieldInfo | null { + const elem = event.target; + if (elem instanceof Element) { + const fieldData = getFormFieldData(elem); + if (fieldData) { + return new EventFieldInfo(componentId, fieldData.value); + } } + + // This event isn't happening on a form field that we can reverse-map back to some incoming attribute + return null; + } } function getFormFieldData(elem: Element) { - // The logic in here should be the inverse of the logic in BrowserRenderer's tryApplySpecialProperty. - // That is, we're doing the reverse mapping, starting from an HTML property and reconstructing which - // "special" attribute would have been mapped to that property. - if (elem instanceof HTMLInputElement) { - return (elem.type && elem.type.toLowerCase() === 'checkbox') - ? { value: elem.checked } - : { value: elem.value }; - } + // The logic in here should be the inverse of the logic in BrowserRenderer's tryApplySpecialProperty. + // That is, we're doing the reverse mapping, starting from an HTML property and reconstructing which + // "special" attribute would have been mapped to that property. + if (elem instanceof HTMLInputElement) { + return (elem.type && elem.type.toLowerCase() === 'checkbox') + ? { value: elem.checked } + : { value: elem.value }; + } - if (elem instanceof HTMLSelectElement || elem instanceof HTMLTextAreaElement) { - return { value: elem.value }; - } + if (elem instanceof HTMLSelectElement || elem instanceof HTMLTextAreaElement) { + return { value: elem.value }; + } - return null; + return null; } diff --git a/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts index 60834fe65938..f5bc16ad82b7 100644 --- a/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export interface EventTypeOptions { browserEventName?: string; createEventArgs?: (event: Event) => any; @@ -57,47 +60,102 @@ function registerBuiltInEventType(eventNames: string[], options: EventTypeOption } registerBuiltInEventType(['input', 'change'], { - createEventArgs: parseChangeEvent + createEventArgs: parseChangeEvent, }); -registerBuiltInEventType(['copy', 'cut', 'paste'], { - createEventArgs: e => parseClipboardEvent(e as ClipboardEvent) +registerBuiltInEventType([ + 'copy', + 'cut', + 'paste', +], { + createEventArgs: e => parseClipboardEvent(e as ClipboardEvent), }); -registerBuiltInEventType(['drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop'], { - createEventArgs: e => parseDragEvent(e as DragEvent) +registerBuiltInEventType([ + 'drag', + 'dragend', + 'dragenter', + 'dragleave', + 'dragover', + 'dragstart', + 'drop', +], { + createEventArgs: e => parseDragEvent(e as DragEvent), }); -registerBuiltInEventType(['focus', 'blur', 'focusin', 'focusout'], { - createEventArgs: e => parseFocusEvent(e as FocusEvent) +registerBuiltInEventType([ + 'focus', + 'blur', + 'focusin', + 'focusout', +], { + createEventArgs: e => parseFocusEvent(e as FocusEvent), }); -registerBuiltInEventType(['keydown', 'keyup', 'keypress'], { - createEventArgs: e => parseKeyboardEvent(e as KeyboardEvent) +registerBuiltInEventType([ + 'keydown', + 'keyup', + 'keypress', +], { + createEventArgs: e => parseKeyboardEvent(e as KeyboardEvent), }); -registerBuiltInEventType(['contextmenu', 'click', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'dblclick'], { - createEventArgs: e => parseMouseEvent(e as MouseEvent) +registerBuiltInEventType([ + 'contextmenu', + 'click', + 'mouseover', + 'mouseout', + 'mousemove', + 'mousedown', + 'mouseup', + 'dblclick', +], { + createEventArgs: e => parseMouseEvent(e as MouseEvent), }); registerBuiltInEventType(['error'], { - createEventArgs: e => parseErrorEvent(e as ErrorEvent) + createEventArgs: e => parseErrorEvent(e as ErrorEvent), }); -registerBuiltInEventType(['loadstart', 'timeout', 'abort', 'load', 'loadend', 'progress'], { - createEventArgs: e => parseProgressEvent(e as ProgressEvent) +registerBuiltInEventType([ + 'loadstart', + 'timeout', + 'abort', + 'load', + 'loadend', + 'progress', +], { + createEventArgs: e => parseProgressEvent(e as ProgressEvent), }); -registerBuiltInEventType(['touchcancel', 'touchend', 'touchmove', 'touchenter', 'touchleave', 'touchstart'], { - createEventArgs: e => parseTouchEvent(e as TouchEvent) +registerBuiltInEventType([ + 'touchcancel', + 'touchend', + 'touchmove', + 'touchenter', + 'touchleave', + 'touchstart', +], { + createEventArgs: e => parseTouchEvent(e as TouchEvent), }); -registerBuiltInEventType(['gotpointercapture', 'lostpointercapture', 'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointermove', 'pointerout', 'pointerover', 'pointerup'], { - createEventArgs: e => parsePointerEvent(e as PointerEvent) +registerBuiltInEventType([ + 'gotpointercapture', + 'lostpointercapture', + 'pointercancel', + 'pointerdown', + 'pointerenter', + 'pointerleave', + 'pointermove', + 'pointerout', + 'pointerover', + 'pointerup', +], { + createEventArgs: e => parsePointerEvent(e as PointerEvent), }); registerBuiltInEventType(['wheel', 'mousewheel'], { - createEventArgs: e => parseWheelEvent(e as WheelEvent) + createEventArgs: e => parseWheelEvent(e as WheelEvent), }); registerBuiltInEventType(['toggle'], createBlankEventArgsOptions); @@ -154,19 +212,19 @@ function parseTouchEvent(event: TouchEvent): TouchEventArgs { shiftKey: event.shiftKey, altKey: event.altKey, metaKey: event.metaKey, - type: event.type + type: event.type, }; } function parseFocusEvent(event: FocusEvent): FocusEventArgs { return { - type: event.type + type: event.type, }; } function parseClipboardEvent(event: ClipboardEvent): ClipboardEventArgs { return { - type: event.type + type: event.type, }; } diff --git a/src/Components/Web.JS/src/Rendering/JSRootComponents.ts b/src/Components/Web.JS/src/Rendering/JSRootComponents.ts index d4031153b925..19fdea90907c 100644 --- a/src/Components/Web.JS/src/Rendering/JSRootComponents.ts +++ b/src/Components/Web.JS/src/Rendering/JSRootComponents.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; const pendingRootComponentContainerNamePrefix = '__bl-dynamic-root:'; @@ -21,8 +24,7 @@ export const RootComponentsFunctions = { pendingRootComponentContainers.set(containerIdentifier, toElement); // Instruct .NET to add and render the new root component - const componentId = await getRequiredManager().invokeMethodAsync( - 'AddRootComponent', componentIdentifier, containerIdentifier); + const componentId = await getRequiredManager().invokeMethodAsync('AddRootComponent', componentIdentifier, containerIdentifier); const component = new DynamicRootComponent(componentId, jsComponentParametersByIdentifier[componentIdentifier]); await component.setParameters(initialParameters); return component; diff --git a/src/Components/Web.JS/src/Rendering/LogicalElements.ts b/src/Components/Web.JS/src/Rendering/LogicalElements.ts index 5b6c8f8424af..7e3815c08323 100644 --- a/src/Components/Web.JS/src/Rendering/LogicalElements.ts +++ b/src/Components/Web.JS/src/Rendering/LogicalElements.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + /* A LogicalElement plays the same role as an Element instance from the point of view of the API consumer. Inserting and removing logical elements updates the browser DOM just the same. @@ -173,7 +176,7 @@ export function getLogicalChild(parent: LogicalElement, childIndex: number): Log export function isSvgElement(element: LogicalElement) { // Note: This check is intentionally case-sensitive since we expect this element // to appear as a child of an SVG element and SVGs are case-sensitive. - var closestElement = getClosestDomElement(element) as any; + const closestElement = getClosestDomElement(element) as any; return closestElement.namespaceURI === 'http://www.w3.org/2000/svg' && closestElement['tagName'] !== 'foreignObject'; } diff --git a/src/Components/Web.JS/src/Rendering/RenderBatch/OutOfProcessRenderBatch.ts b/src/Components/Web.JS/src/Rendering/RenderBatch/OutOfProcessRenderBatch.ts index 1e2778796d3b..e3d295c38600 100644 --- a/src/Components/Web.JS/src/Rendering/RenderBatch/OutOfProcessRenderBatch.ts +++ b/src/Components/Web.JS/src/Rendering/RenderBatch/OutOfProcessRenderBatch.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { RenderBatch, ArrayRange, RenderTreeDiff, ArrayValues, RenderTreeEdit, RenderTreeFrame, RenderTreeDiffReader, RenderTreeFrameReader, RenderTreeEditReader, ArrayRangeReader, ArrayBuilderSegmentReader, ArrayBuilderSegment } from './RenderBatch'; import { decodeUtf8 } from '../../Utf8Decoder'; import { readInt32LE, readUint64LE, readLEB128, numLEB128Bytes } from '../../BinaryDecoder'; diff --git a/src/Components/Web.JS/src/Rendering/RenderBatch/RenderBatch.ts b/src/Components/Web.JS/src/Rendering/RenderBatch/RenderBatch.ts index 84a9844adbd9..9d82f3542ea5 100644 --- a/src/Components/Web.JS/src/Rendering/RenderBatch/RenderBatch.ts +++ b/src/Components/Web.JS/src/Rendering/RenderBatch/RenderBatch.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export interface RenderBatch { updatedComponents(): ArrayRange; referenceFrames(): ArrayRange; diff --git a/src/Components/Web.JS/src/Rendering/RenderBatch/SharedMemoryRenderBatch.ts b/src/Components/Web.JS/src/Rendering/RenderBatch/SharedMemoryRenderBatch.ts index 4b8d560c41f3..c79a8cf0550c 100644 --- a/src/Components/Web.JS/src/Rendering/RenderBatch/SharedMemoryRenderBatch.ts +++ b/src/Components/Web.JS/src/Rendering/RenderBatch/SharedMemoryRenderBatch.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { platform } from '../../Environment'; import { RenderBatch, ArrayRange, ArrayBuilderSegment, RenderTreeDiff, RenderTreeEdit, RenderTreeFrame, ArrayValues, EditType, FrameType } from './RenderBatch'; import { Pointer, System_Array, System_Object } from '../../Platform/Platform'; diff --git a/src/Components/Web.JS/src/Rendering/Renderer.ts b/src/Components/Web.JS/src/Rendering/Renderer.ts index 210de4bc76d8..be4ecf3ad586 100644 --- a/src/Components/Web.JS/src/Rendering/Renderer.ts +++ b/src/Components/Web.JS/src/Rendering/Renderer.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import '../Platform/Platform'; import '../Environment'; import { RenderBatch } from './RenderBatch/RenderBatch'; diff --git a/src/Components/Web.JS/src/Rendering/WebRendererInteropMethods.ts b/src/Components/Web.JS/src/Rendering/WebRendererInteropMethods.ts index 1d3f0f284ce1..202a1606416a 100644 --- a/src/Components/Web.JS/src/Rendering/WebRendererInteropMethods.ts +++ b/src/Components/Web.JS/src/Rendering/WebRendererInteropMethods.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; import { EventDescriptor } from './Events/EventDelegator'; import { enableJSRootComponents, JSComponentParametersByIdentifier, JSComponentIdentifiersByInitializer } from './JSRootComponents'; diff --git a/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts b/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts index e7780747cfc5..d663119cae08 100644 --- a/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts +++ b/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export function discoverComponents(document: Document, type: 'webassembly' | 'server'): ServerComponentDescriptor[] | WebAssemblyComponentDescriptor[] { switch (type){ case 'webassembly': diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index 74e9a10da27e..59bfb76454d9 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import '@microsoft/dotnet-js-interop'; import { resetScrollAfterNextBatch } from '../Rendering/Renderer'; import { EventDelegator } from '../Rendering/Events/EventDelegator'; diff --git a/src/Components/Web.JS/src/StreamingInterop.ts b/src/Components/Web.JS/src/StreamingInterop.ts index 8951cab89e2c..92fac7740168 100644 --- a/src/Components/Web.JS/src/StreamingInterop.ts +++ b/src/Components/Web.JS/src/StreamingInterop.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + import { DotNet } from '@microsoft/dotnet-js-interop'; export async function getNextChunk(data: ArrayBufferView | Blob, position: number, nextChunkSize: number): Promise { diff --git a/src/Components/Web.JS/src/Utf8Decoder.ts b/src/Components/Web.JS/src/Utf8Decoder.ts index 942c3e37a323..49024b9ae6c8 100644 --- a/src/Components/Web.JS/src/Utf8Decoder.ts +++ b/src/Components/Web.JS/src/Utf8Decoder.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + const nativeDecoder = typeof TextDecoder === 'function' ? new TextDecoder('utf-8') : null; diff --git a/src/Components/Web.JS/src/Virtualize.ts b/src/Components/Web.JS/src/Virtualize.ts index b7aaa89e0701..a6603f25fdd4 100644 --- a/src/Components/Web.JS/src/Virtualize.ts +++ b/src/Components/Web.JS/src/Virtualize.ts @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + export const Virtualize = { init, dispose, diff --git a/src/Components/Web.JS/yarn.lock b/src/Components/Web.JS/yarn.lock index 2ebb76ed66cd..75436007f2e5 100644 --- a/src/Components/Web.JS/yarn.lock +++ b/src/Components/Web.JS/yarn.lock @@ -2164,6 +2164,11 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-plugin-header@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz#6ce512432d57675265fac47292b50d1eff11acd6" + integrity sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg== + eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"