From 95bb8059b483b26223ec6e0a245457dfe05de142 Mon Sep 17 00:00:00 2001 From: Jake Fried Date: Fri, 2 Jul 2021 14:47:35 -0400 Subject: [PATCH] Remove all "import type" after discovery of a TS bug (#1073) * Revert "worker: fix faulty import type (#1072)" This reverts commit 35139efa78181743dc3373e37c708b43d76d20f5. * Revert "Separate out all type-only imports (#1067)" This reverts commit b1f16582272eb78af356c459ffcd63cc73b4fa60. --- src/main-thread/configuration.ts | 7 +- src/main-thread/debugging.ts | 22 +++-- .../deserializeTransferrableObject.ts | 7 +- src/main-thread/exported-worker.ts | 8 +- src/main-thread/index.amp.ts | 5 +- src/main-thread/index.ts | 2 +- src/main-thread/install.ts | 7 +- src/main-thread/mutator.ts | 15 ++-- src/main-thread/nodes.ts | 2 +- src/main-thread/serialize.ts | 8 +- src/main-thread/worker.ts | 7 +- src/third_party/html-parser/html-parser.ts | 4 +- src/transfer/Messages.ts | 14 +-- src/transfer/TransferrableEvent.ts | 4 +- src/transfer/TransferrableNodes.ts | 4 +- src/transfer/TransferrableSyncValue.ts | 2 +- src/worker-thread/Event.ts | 14 ++- src/worker-thread/MutationObserver.ts | 7 +- src/worker-thread/MutationRecord.ts | 2 +- src/worker-thread/MutationTransfer.ts | 10 +-- src/worker-thread/ResizePropagation.ts | 6 +- src/worker-thread/Storage.ts | 5 +- src/worker-thread/SyncValuePropagation.ts | 8 +- src/worker-thread/WorkerDOMGlobalScope.ts | 86 +++++++++---------- src/worker-thread/amp/amp.ts | 8 +- src/worker-thread/canvas/CanvasGradient.ts | 5 +- src/worker-thread/canvas/CanvasPattern.ts | 2 +- .../canvas/CanvasRenderingContext2D.ts | 14 ++- .../canvas/FakeNativeCanvasPattern.ts | 6 +- .../canvas/OffscreenCanvasPolyfill.ts | 13 ++- src/worker-thread/canvas/canvas-utils.ts | 10 +-- src/worker-thread/css/CSSStyleDeclaration.ts | 7 +- src/worker-thread/dom/Attr.ts | 2 +- src/worker-thread/dom/CharacterData.ts | 8 +- src/worker-thread/dom/Comment.ts | 2 +- src/worker-thread/dom/DOMTokenList.ts | 7 +- src/worker-thread/dom/Document.ts | 8 +- src/worker-thread/dom/DocumentFragment.ts | 2 +- src/worker-thread/dom/DocumentLite.ts | 5 +- src/worker-thread/dom/Element.ts | 6 +- src/worker-thread/dom/HTMLDataListElement.ts | 6 +- .../dom/HTMLFormControlsMixin.ts | 2 +- src/worker-thread/dom/HTMLFormElement.ts | 4 +- src/worker-thread/dom/HTMLInputElement.ts | 3 +- src/worker-thread/dom/HTMLInputLabelsMixin.ts | 2 +- src/worker-thread/dom/HTMLLabelElement.ts | 6 +- src/worker-thread/dom/HTMLMapElement.ts | 4 +- src/worker-thread/dom/HTMLOptionElement.ts | 3 +- src/worker-thread/dom/HTMLSelectElement.ts | 8 +- src/worker-thread/dom/HTMLTableCellElement.ts | 4 +- src/worker-thread/dom/HTMLTableElement.ts | 10 +-- src/worker-thread/dom/HTMLTableRowElement.ts | 10 +-- .../dom/HTMLTableSectionElement.ts | 6 +- src/worker-thread/dom/Node.ts | 8 +- src/worker-thread/dom/ParentNode.ts | 3 +- src/worker-thread/dom/SVGElement.ts | 5 +- src/worker-thread/dom/Text.ts | 3 +- src/worker-thread/dom/enhanceElement.ts | 2 +- src/worker-thread/dom/matchElements.ts | 5 +- src/worker-thread/function.ts | 8 +- src/worker-thread/index.amp.ts | 17 ++-- src/worker-thread/index.nodom.amp.ts | 9 +- src/worker-thread/index.ts | 7 +- src/worker-thread/initialize.ts | 7 +- src/worker-thread/long-task.ts | 5 +- src/worker-thread/nodes.ts | 3 +- .../serializeTransferrableObject.ts | 3 +- src/worker-thread/server-lib.ts | 3 +- 68 files changed, 225 insertions(+), 292 deletions(-) diff --git a/src/main-thread/configuration.ts b/src/main-thread/configuration.ts index eabed757f..ba7b18e38 100644 --- a/src/main-thread/configuration.ts +++ b/src/main-thread/configuration.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import type { MessageFromWorker, MessageToWorker } from '../transfer/Messages'; -import type { Phase } from '../transfer/Phase'; -import type { HydrateableNode } from '../transfer/TransferrableNodes'; - +import { MessageFromWorker, MessageToWorker } from '../transfer/Messages'; +import { Phase } from '../transfer/Phase'; +import { HydrateableNode } from '../transfer/TransferrableNodes'; import { DefaultAllowedMutations } from '../transfer/TransferrableMutation'; /** diff --git a/src/main-thread/debugging.ts b/src/main-thread/debugging.ts index 1d3914a9c..66bc8adf4 100644 --- a/src/main-thread/debugging.ts +++ b/src/main-thread/debugging.ts @@ -22,18 +22,22 @@ * @see https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#9.4 */ -import type { EventToWorker, MessageToWorker, ValueSyncToWorker, BoundingClientRectToWorker, StorageValueToWorker } from '../transfer/Messages'; -import type { HydrateableNode, TransferredNode } from '../transfer/TransferrableNodes'; -import type { NodeContext } from './nodes'; -import type { TransferrableEvent } from '../transfer/TransferrableEvent'; -import type { TransferrableSyncValue } from '../transfer/TransferrableSyncValue'; -import type { WorkerContext } from './worker'; - -import { MessageType } from '../transfer/Messages'; -import { TransferrableNodeIndex } from '../transfer/TransferrableNodes'; +import { + EventToWorker, + MessageType, + MessageToWorker, + ValueSyncToWorker, + BoundingClientRectToWorker, + StorageValueToWorker, +} from '../transfer/Messages'; +import { HydrateableNode, TransferredNode, TransferrableNodeIndex } from '../transfer/TransferrableNodes'; +import { NodeContext } from './nodes'; +import { TransferrableEvent } from '../transfer/TransferrableEvent'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; +import { TransferrableSyncValue } from '../transfer/TransferrableSyncValue'; import { createReadableHydrateableRootNode } from './serialize'; import { WorkerDOMConfiguration } from './configuration'; +import { WorkerContext } from './worker'; /** * @param element diff --git a/src/main-thread/deserializeTransferrableObject.ts b/src/main-thread/deserializeTransferrableObject.ts index a495caa89..e37ab8ab4 100644 --- a/src/main-thread/deserializeTransferrableObject.ts +++ b/src/main-thread/deserializeTransferrableObject.ts @@ -14,11 +14,10 @@ * limitations under the License. */ -import type { StringContext } from './strings'; -import type { NodeContext } from './nodes'; -import type { ObjectContext } from './object-context'; - +import { StringContext } from './strings'; import { TransferrableObjectType } from '../transfer/TransferrableMutation'; +import { NodeContext } from './nodes'; +import { ObjectContext } from './object-context'; interface DeserializedArgs { args: unknown[]; diff --git a/src/main-thread/exported-worker.ts b/src/main-thread/exported-worker.ts index 186f2a343..7833e636a 100644 --- a/src/main-thread/exported-worker.ts +++ b/src/main-thread/exported-worker.ts @@ -14,12 +14,10 @@ * limitations under the License. */ -import type { WorkerContext } from './worker'; -import type { WorkerDOMConfiguration } from './configuration'; -import type { FunctionCallToWorker } from '../transfer/Messages'; - +import { WorkerContext } from './worker'; +import { WorkerDOMConfiguration } from './configuration'; import { registerPromise } from './commands/function'; -import { MessageType } from '../transfer/Messages'; +import { FunctionCallToWorker, MessageType } from '../transfer/Messages'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../transfer/TransferrableMutation'; diff --git a/src/main-thread/index.amp.ts b/src/main-thread/index.amp.ts index 26a21ecb3..571ec111d 100644 --- a/src/main-thread/index.amp.ts +++ b/src/main-thread/index.amp.ts @@ -18,11 +18,10 @@ * @fileoverview This entry point API in active development and unstable. */ -import type { ExportedWorker } from './exported-worker'; -import type { WorkerDOMConfiguration, LongTaskFunction } from './configuration'; - import { fetchAndInstall, install } from './install'; +import { WorkerDOMConfiguration, LongTaskFunction } from './configuration'; import { toLower } from '../utils'; +import { ExportedWorker } from './exported-worker'; /** * AMP Element Children need to be filtered from Hydration, to avoid Author Code from manipulating it. diff --git a/src/main-thread/index.ts b/src/main-thread/index.ts index 7af3815fe..3ff51811a 100644 --- a/src/main-thread/index.ts +++ b/src/main-thread/index.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { ExportedWorker } from './exported-worker'; import { fetchAndInstall } from './install'; +import { ExportedWorker } from './exported-worker'; export function upgradeElement(baseElement: Element, domURL: string): Promise { const authorURL = baseElement.getAttribute('src'); diff --git a/src/main-thread/install.ts b/src/main-thread/install.ts index dc3069ce2..2589e45c1 100644 --- a/src/main-thread/install.ts +++ b/src/main-thread/install.ts @@ -14,15 +14,12 @@ * limitations under the License. */ -import type { MutationFromWorker, MessageFromWorker } from '../transfer/Messages'; -import type { InboundWorkerDOMConfiguration } from './configuration'; - -import { MessageType } from '../transfer/Messages'; +import { MutationFromWorker, MessageType, MessageFromWorker } from '../transfer/Messages'; import { MutatorProcessor } from './mutator'; import { NodeContext } from './nodes'; import { StringContext } from './strings'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; -import { normalizeConfiguration } from './configuration'; +import { InboundWorkerDOMConfiguration, normalizeConfiguration } from './configuration'; import { WorkerContext } from './worker'; import { ObjectContext } from './object-context'; import { ExportedWorker } from './exported-worker'; diff --git a/src/main-thread/mutator.ts b/src/main-thread/mutator.ts index 6b5d7e075..5d4a02d85 100644 --- a/src/main-thread/mutator.ts +++ b/src/main-thread/mutator.ts @@ -14,14 +14,9 @@ * limitations under the License. */ -import type { NodeContext } from './nodes'; -import type { StringContext } from './strings'; -import type { WorkerContext } from './worker'; -import type { WorkerDOMConfiguration, MutationPumpFunction } from './configuration'; -import type { CommandExecutor } from './commands/interface'; -import type { Phase } from '../transfer/Phase'; -import type { ObjectContext } from './object-context'; - +import { NodeContext } from './nodes'; +import { StringContext } from './strings'; +import { WorkerContext } from './worker'; import { OffscreenCanvasProcessor } from './commands/offscreen-canvas'; import { TransferrableMutationType, ReadableMutationType, isUserVisibleMutation } from '../transfer/TransferrableMutation'; import { EventSubscriptionProcessor } from './commands/event-subscription'; @@ -31,8 +26,12 @@ import { AttributeProcessor } from './commands/attribute'; import { CharacterDataProcessor } from './commands/character-data'; import { PropertyProcessor } from './commands/property'; import { LongTaskExecutor } from './commands/long-task'; +import { CommandExecutor } from './commands/interface'; +import { WorkerDOMConfiguration, MutationPumpFunction } from './configuration'; +import { Phase } from '../transfer/Phase'; import { ObjectMutationProcessor } from './commands/object-mutation'; import { ObjectCreationProcessor } from './commands/object-creation'; +import { ObjectContext } from './object-context'; import { ImageBitmapProcessor } from './commands/image-bitmap'; import { StorageProcessor } from './commands/storage'; import { FunctionProcessor } from './commands/function'; diff --git a/src/main-thread/nodes.ts b/src/main-thread/nodes.ts index 24a1ebcb1..657fddf37 100644 --- a/src/main-thread/nodes.ts +++ b/src/main-thread/nodes.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { StringContext } from './strings'; import { NodeType, TransferrableNodeIndex } from '../transfer/TransferrableNodes'; +import { StringContext } from './strings'; /** * IE11 doesn't support NodeList.prototype.forEach diff --git a/src/main-thread/serialize.ts b/src/main-thread/serialize.ts index 285e13cff..9ae4fdb55 100644 --- a/src/main-thread/serialize.ts +++ b/src/main-thread/serialize.ts @@ -14,14 +14,12 @@ * limitations under the License. */ -import type { HydrateableNode } from '../transfer/TransferrableNodes'; -import type { WorkerDOMConfiguration, HydrationFilterPredicate } from './configuration'; -import type { WorkerContext } from './worker'; - -import { NodeType } from '../transfer/TransferrableNodes'; +import { HydrateableNode, NodeType } from '../transfer/TransferrableNodes'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; import { NumericBoolean } from '../utils'; +import { WorkerDOMConfiguration, HydrationFilterPredicate } from './configuration'; import { applyDefaultInputListener, sendValueChangeOnAttributeMutation } from './commands/event-subscription'; +import { WorkerContext } from './worker'; const NODES_ALLOWED_TO_TRANSMIT_TEXT_CONTENT = [NodeType.COMMENT_NODE, NodeType.TEXT_NODE]; diff --git a/src/main-thread/worker.ts b/src/main-thread/worker.ts index 846f92595..b4b409066 100644 --- a/src/main-thread/worker.ts +++ b/src/main-thread/worker.ts @@ -14,12 +14,11 @@ * limitations under the License. */ -import type { MessageToWorker } from '../transfer/Messages'; -import type { WorkerDOMConfiguration } from './configuration'; -import type { NodeContext } from './nodes'; - +import { MessageToWorker } from '../transfer/Messages'; +import { WorkerDOMConfiguration } from './configuration'; import { createHydrateableRootNode } from './serialize'; import { readableHydrateableRootNode, readableMessageToWorker } from './debugging'; +import { NodeContext } from './nodes'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; import { StorageLocation } from '../transfer/TransferrableStorage'; import { IframeWorker } from './iframe-worker'; diff --git a/src/third_party/html-parser/html-parser.ts b/src/third_party/html-parser/html-parser.ts index 8741d862a..fcf94e07a 100644 --- a/src/third_party/html-parser/html-parser.ts +++ b/src/third_party/html-parser/html-parser.ts @@ -1,5 +1,5 @@ -import type { Element } from '../../worker-thread/dom/Element'; -import type { Node } from '../../worker-thread/dom/Node'; +import { Element } from '../../worker-thread/dom/Element'; +import { Node } from '../../worker-thread/dom/Node'; import { SVG_NAMESPACE, HTML_NAMESPACE } from '../../transfer/TransferrableNodes'; import { toLower, toUpper } from '../../utils'; diff --git a/src/transfer/Messages.ts b/src/transfer/Messages.ts index 5f8ac20ee..f0c757f99 100644 --- a/src/transfer/Messages.ts +++ b/src/transfer/Messages.ts @@ -14,13 +14,13 @@ * limitations under the License. */ -import type { TransferrableEvent } from './TransferrableEvent'; -import type { TransferrableSyncValue } from './TransferrableSyncValue'; -import type { TransferrableKeys } from './TransferrableKeys'; -import type { HydrateableNode, TransferredNode } from './TransferrableNodes'; -import type { TransferrableBoundingClientRect } from './TransferrableBoundClientRect'; -import type { Phase } from './Phase'; -import type { StorageLocation } from './TransferrableStorage'; +import { TransferrableEvent } from './TransferrableEvent'; +import { TransferrableSyncValue } from './TransferrableSyncValue'; +import { TransferrableKeys } from './TransferrableKeys'; +import { HydrateableNode, TransferredNode } from './TransferrableNodes'; +import { TransferrableBoundingClientRect } from './TransferrableBoundClientRect'; +import { Phase } from './Phase'; +import { StorageLocation } from './TransferrableStorage'; export const enum MessageType { // INIT = 0, diff --git a/src/transfer/TransferrableEvent.ts b/src/transfer/TransferrableEvent.ts index 69a71eb39..5db8d48e9 100644 --- a/src/transfer/TransferrableEvent.ts +++ b/src/transfer/TransferrableEvent.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { TransferredNode } from './TransferrableNodes'; -import type { TransferrableKeys } from './TransferrableKeys'; +import { TransferredNode } from './TransferrableNodes'; +import { TransferrableKeys } from './TransferrableKeys'; interface TransferrableTouch { [key: number]: number; diff --git a/src/transfer/TransferrableNodes.ts b/src/transfer/TransferrableNodes.ts index 3ea5b4e9f..1f057040f 100644 --- a/src/transfer/TransferrableNodes.ts +++ b/src/transfer/TransferrableNodes.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { NumericBoolean } from '../utils'; -import type { TransferrableKeys } from './TransferrableKeys'; +import { NumericBoolean } from '../utils'; +import { TransferrableKeys } from './TransferrableKeys'; export const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; diff --git a/src/transfer/TransferrableSyncValue.ts b/src/transfer/TransferrableSyncValue.ts index e2d49d81e..5c1deecbb 100644 --- a/src/transfer/TransferrableSyncValue.ts +++ b/src/transfer/TransferrableSyncValue.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { TransferrableKeys } from './TransferrableKeys'; +import { TransferrableKeys } from './TransferrableKeys'; export interface TransferrableSyncValue { readonly [TransferrableKeys.index]: number; diff --git a/src/worker-thread/Event.ts b/src/worker-thread/Event.ts index 4a38f6aac..d0d57abf9 100644 --- a/src/worker-thread/Event.ts +++ b/src/worker-thread/Event.ts @@ -19,16 +19,14 @@ * WorkerDOM's `Event` class. `CustomEvent` is available natively in web worker. */ -import type { Node } from './dom/Node'; -import type { EventToWorker } from '../transfer/Messages'; -import type { TransferrableEvent, TransferrableTouchList } from '../transfer/TransferrableEvent'; -import type { Document } from './dom/Document'; -import type { TransferredNode } from '../transfer/TransferrableNodes'; -import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; - +import { Node } from './dom/Node'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; -import { MessageType } from '../transfer/Messages'; +import { EventToWorker, MessageType } from '../transfer/Messages'; +import { TransferrableEvent, TransferrableTouchList } from '../transfer/TransferrableEvent'; import { get } from './nodes'; +import { Document } from './dom/Document'; +import { TransferredNode } from '../transfer/TransferrableNodes'; +import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; interface EventOptions { bubbles?: boolean; diff --git a/src/worker-thread/MutationObserver.ts b/src/worker-thread/MutationObserver.ts index 14e378400..24d72e289 100644 --- a/src/worker-thread/MutationObserver.ts +++ b/src/worker-thread/MutationObserver.ts @@ -14,11 +14,10 @@ * limitations under the License. */ -import type { Document } from './dom/Document'; -import type { Node } from './dom/Node'; -import type { MutationRecord } from './MutationRecord'; - +import { Node } from './dom/Node'; +import { MutationRecord } from './MutationRecord'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; +import { Document } from './dom/Document'; import { transfer } from './MutationTransfer'; const observers: MutationObserver[] = []; diff --git a/src/worker-thread/MutationRecord.ts b/src/worker-thread/MutationRecord.ts index ddbc03c4c..95247f52b 100644 --- a/src/worker-thread/MutationRecord.ts +++ b/src/worker-thread/MutationRecord.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Node } from './dom/Node'; +import { Node } from './dom/Node'; // MutationRecord interface is modification and extension of the spec version. // It supports capturing property changes. diff --git a/src/worker-thread/MutationTransfer.ts b/src/worker-thread/MutationTransfer.ts index b6aef7158..0d01efbd8 100644 --- a/src/worker-thread/MutationTransfer.ts +++ b/src/worker-thread/MutationTransfer.ts @@ -14,17 +14,15 @@ * limitations under the License. */ -import type { MutationFromWorker } from '../transfer/Messages'; -import type { Node } from './dom/Node'; -import type { Document } from './dom/Document'; -import type { DocumentStub } from './dom/DocumentLite'; - import { consume as consumeNodes } from './nodes'; import { consume as consumeStrings } from './strings'; -import { MessageType } from '../transfer/Messages'; +import { MessageType, MutationFromWorker } from '../transfer/Messages'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; +import { Node } from './dom/Node'; import { Phase } from '../transfer/Phase'; import { phase, set as setPhase } from './phase'; +import { Document } from './dom/Document'; +import { DocumentStub } from './dom/DocumentLite'; let pending = false; let pendingMutations: Array = []; diff --git a/src/worker-thread/ResizePropagation.ts b/src/worker-thread/ResizePropagation.ts index 30f06a243..c84c10391 100644 --- a/src/worker-thread/ResizePropagation.ts +++ b/src/worker-thread/ResizePropagation.ts @@ -14,11 +14,9 @@ * limitations under the License. */ -import type { MessageToWorker, ResizeSyncToWorker } from '../transfer/Messages'; -import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; - -import { MessageType } from '../transfer/Messages'; +import { MessageToWorker, MessageType, ResizeSyncToWorker } from '../transfer/Messages'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; +import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; export function propagate(global: WorkerDOMGlobalScope): void { const document = global.document; diff --git a/src/worker-thread/Storage.ts b/src/worker-thread/Storage.ts index fc5076d97..f7eaf73fb 100644 --- a/src/worker-thread/Storage.ts +++ b/src/worker-thread/Storage.ts @@ -14,14 +14,13 @@ * limitations under the License. */ -import type { Document } from './dom/Document'; -import type { DocumentStub } from './dom/DocumentLite'; - +import { Document } from './dom/Document'; import { GetOrSet } from '../transfer/Messages'; import { StorageLocation } from '../transfer/TransferrableStorage'; import { TransferrableMutationType } from '../transfer/TransferrableMutation'; import { store } from './strings'; import { transfer } from './MutationTransfer'; +import { DocumentStub } from './dom/DocumentLite'; /** * @see https://developer.mozilla.org/en-US/docs/Web/API/Storage diff --git a/src/worker-thread/SyncValuePropagation.ts b/src/worker-thread/SyncValuePropagation.ts index 6457c03e7..e1a135612 100644 --- a/src/worker-thread/SyncValuePropagation.ts +++ b/src/worker-thread/SyncValuePropagation.ts @@ -14,13 +14,11 @@ * limitations under the License. */ -import type { MessageToWorker, ValueSyncToWorker } from '../transfer/Messages'; -import type { Document } from './dom/Document'; -import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; - -import { MessageType } from '../transfer/Messages'; +import { MessageToWorker, MessageType, ValueSyncToWorker } from '../transfer/Messages'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; import { get } from './nodes'; +import { Document } from './dom/Document'; +import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; /** * When an event is dispatched from the main thread, it needs to be propagated in the worker thread. diff --git a/src/worker-thread/WorkerDOMGlobalScope.ts b/src/worker-thread/WorkerDOMGlobalScope.ts index 7ec87af3f..430efcfa1 100644 --- a/src/worker-thread/WorkerDOMGlobalScope.ts +++ b/src/worker-thread/WorkerDOMGlobalScope.ts @@ -14,49 +14,49 @@ * limitations under the License. */ -import type { HTMLAnchorElement } from './dom/HTMLAnchorElement'; -import type { HTMLButtonElement } from './dom/HTMLButtonElement'; -import type { HTMLCanvasElement } from './dom/HTMLCanvasElement'; -import type { HTMLDataElement } from './dom/HTMLDataElement'; -import type { HTMLEmbedElement } from './dom/HTMLEmbedElement'; -import type { HTMLFieldSetElement } from './dom/HTMLFieldSetElement'; -import type { HTMLFormElement } from './dom/HTMLFormElement'; -import type { HTMLIFrameElement } from './dom/HTMLIFrameElement'; -import type { HTMLImageElement } from './dom/HTMLImageElement'; -import type { HTMLInputElement } from './dom/HTMLInputElement'; -import type { HTMLLabelElement } from './dom/HTMLLabelElement'; -import type { HTMLLinkElement } from './dom/HTMLLinkElement'; -import type { HTMLMapElement } from './dom/HTMLMapElement'; -import type { HTMLMeterElement } from './dom/HTMLMeterElement'; -import type { HTMLModElement } from './dom/HTMLModElement'; -import type { HTMLOListElement } from './dom/HTMLOListElement'; -import type { HTMLOptionElement } from './dom/HTMLOptionElement'; -import type { HTMLProgressElement } from './dom/HTMLProgressElement'; -import type { HTMLQuoteElement } from './dom/HTMLQuoteElement'; -import type { HTMLScriptElement } from './dom/HTMLScriptElement'; -import type { HTMLSelectElement } from './dom/HTMLSelectElement'; -import type { HTMLSourceElement } from './dom/HTMLSourceElement'; -import type { HTMLStyleElement } from './dom/HTMLStyleElement'; -import type { HTMLTableCellElement } from './dom/HTMLTableCellElement'; -import type { HTMLTableColElement } from './dom/HTMLTableColElement'; -import type { HTMLTableElement } from './dom/HTMLTableElement'; -import type { HTMLTableRowElement } from './dom/HTMLTableRowElement'; -import type { HTMLTableSectionElement } from './dom/HTMLTableSectionElement'; -import type { HTMLTimeElement } from './dom/HTMLTimeElement'; -import type { Document } from './dom/Document'; -import type { EventHandler, Event as WorkerDOMEvent } from './Event'; -import type { MutationObserver } from './MutationObserver'; -import type { Storage } from './Storage'; -import type { SVGElement } from './dom/SVGElement'; -import type { HTMLElement } from './dom/HTMLElement'; -import type { HTMLDataListElement } from './dom/HTMLDataListElement'; -import type { Text } from './dom/Text'; -import type { Comment } from './dom/Comment'; -import type { CharacterData } from './dom/CharacterData'; -import type { DocumentFragment } from './dom/DocumentFragment'; -import type { DOMTokenList } from './dom/DOMTokenList'; -import type { Element } from './dom/Element'; -import type { DocumentStub } from './dom/DocumentLite'; +import { HTMLAnchorElement } from './dom/HTMLAnchorElement'; +import { HTMLButtonElement } from './dom/HTMLButtonElement'; +import { HTMLCanvasElement } from './dom/HTMLCanvasElement'; +import { HTMLDataElement } from './dom/HTMLDataElement'; +import { HTMLEmbedElement } from './dom/HTMLEmbedElement'; +import { HTMLFieldSetElement } from './dom/HTMLFieldSetElement'; +import { HTMLFormElement } from './dom/HTMLFormElement'; +import { HTMLIFrameElement } from './dom/HTMLIFrameElement'; +import { HTMLImageElement } from './dom/HTMLImageElement'; +import { HTMLInputElement } from './dom/HTMLInputElement'; +import { HTMLLabelElement } from './dom/HTMLLabelElement'; +import { HTMLLinkElement } from './dom/HTMLLinkElement'; +import { HTMLMapElement } from './dom/HTMLMapElement'; +import { HTMLMeterElement } from './dom/HTMLMeterElement'; +import { HTMLModElement } from './dom/HTMLModElement'; +import { HTMLOListElement } from './dom/HTMLOListElement'; +import { HTMLOptionElement } from './dom/HTMLOptionElement'; +import { HTMLProgressElement } from './dom/HTMLProgressElement'; +import { HTMLQuoteElement } from './dom/HTMLQuoteElement'; +import { HTMLScriptElement } from './dom/HTMLScriptElement'; +import { HTMLSelectElement } from './dom/HTMLSelectElement'; +import { HTMLSourceElement } from './dom/HTMLSourceElement'; +import { HTMLStyleElement } from './dom/HTMLStyleElement'; +import { HTMLTableCellElement } from './dom/HTMLTableCellElement'; +import { HTMLTableColElement } from './dom/HTMLTableColElement'; +import { HTMLTableElement } from './dom/HTMLTableElement'; +import { HTMLTableRowElement } from './dom/HTMLTableRowElement'; +import { HTMLTableSectionElement } from './dom/HTMLTableSectionElement'; +import { HTMLTimeElement } from './dom/HTMLTimeElement'; +import { Document } from './dom/Document'; +import { EventHandler, Event as WorkerDOMEvent } from './Event'; +import { MutationObserver } from './MutationObserver'; +import { Storage } from './Storage'; +import { SVGElement } from './dom/SVGElement'; +import { HTMLElement } from './dom/HTMLElement'; +import { HTMLDataListElement } from './dom/HTMLDataListElement'; +import { Text } from './dom/Text'; +import { Comment } from './dom/Comment'; +import { CharacterData } from './dom/CharacterData'; +import { DocumentFragment } from './dom/DocumentFragment'; +import { DOMTokenList } from './dom/DOMTokenList'; +import { Element } from './dom/Element'; +import { DocumentStub } from './dom/DocumentLite'; /** * Should only contain properties that exist on Window. diff --git a/src/worker-thread/amp/amp.ts b/src/worker-thread/amp/amp.ts index 126c6d721..55286938d 100644 --- a/src/worker-thread/amp/amp.ts +++ b/src/worker-thread/amp/amp.ts @@ -14,16 +14,14 @@ * limitations under the License. */ -import type { Document } from '../dom/Document'; -import type { DocumentStub } from '../dom/DocumentLite'; -import type { StorageValueToWorker, MessageToWorker } from '../../transfer/Messages'; - +import { Document } from '../dom/Document'; import { StorageLocation } from '../../transfer/TransferrableStorage'; -import { MessageType, GetOrSet } from '../../transfer/Messages'; +import { StorageValueToWorker, MessageType, MessageToWorker, GetOrSet } from '../../transfer/Messages'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { store } from '../strings'; import { transfer } from '../MutationTransfer'; +import { DocumentStub } from '../dom/DocumentLite'; export class AMP { private document: Document | DocumentStub; diff --git a/src/worker-thread/canvas/CanvasGradient.ts b/src/worker-thread/canvas/CanvasGradient.ts index 9c660f844..acf46e81d 100644 --- a/src/worker-thread/canvas/CanvasGradient.ts +++ b/src/worker-thread/canvas/CanvasGradient.ts @@ -14,13 +14,12 @@ * limitations under the License. */ -import type { Document } from '../dom/Document'; -import type { TransferrableObject } from '../worker-thread'; - +import { Document } from '../dom/Document'; import { transfer } from '../MutationTransfer'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { serializeTransferrableObject } from '../serializeTransferrableObject'; import { store } from '../strings'; +import { TransferrableObject } from '../worker-thread'; import { TransferrableObjectType } from '../../transfer/TransferrableMutation'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; diff --git a/src/worker-thread/canvas/CanvasPattern.ts b/src/worker-thread/canvas/CanvasPattern.ts index 52f7dd42c..0782a3eea 100644 --- a/src/worker-thread/canvas/CanvasPattern.ts +++ b/src/worker-thread/canvas/CanvasPattern.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { TransferrableObject } from '../worker-thread'; import { TransferrableObjectType } from '../../transfer/TransferrableMutation'; +import { TransferrableObject } from '../worker-thread'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; /** diff --git a/src/worker-thread/canvas/CanvasRenderingContext2D.ts b/src/worker-thread/canvas/CanvasRenderingContext2D.ts index cea0f0e45..22fed7464 100644 --- a/src/worker-thread/canvas/CanvasRenderingContext2D.ts +++ b/src/worker-thread/canvas/CanvasRenderingContext2D.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { +import { CanvasRenderingContext2D, CanvasDirection, CanvasFillRule, @@ -27,18 +27,16 @@ import type { CanvasGradient, CanvasPattern, } from './CanvasTypes'; -import type { OffscreenCanvasToWorker } from '../../transfer/Messages'; -import type { Document } from '../dom/Document'; -import type { HTMLElement } from '../dom/HTMLElement'; -import type { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; - -import { MessageType } from '../../transfer/Messages'; +import { MessageType, OffscreenCanvasToWorker } from '../../transfer/Messages'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { transfer } from '../MutationTransfer'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { OffscreenCanvasPolyfill } from './OffscreenCanvasPolyfill'; +import { Document } from '../dom/Document'; +import { HTMLElement } from '../dom/HTMLElement'; import { FakeNativeCanvasPattern } from './FakeNativeCanvasPattern'; import { retrieveImageBitmap } from './canvas-utils'; +import { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; export const deferredUpgrades = new WeakMap(); @@ -398,7 +396,7 @@ export class CanvasRenderingContext2DShim imple this.degradeImplementation(); // Retrieve an ImageBitmap from the main-thread with the same image as the input image - retrieveImageBitmap(image as any, this.canvas as unknown as HTMLCanvasElement) + retrieveImageBitmap(image as any, (this.canvas as unknown) as HTMLCanvasElement) // Then call the actual method with the retrieved ImageBitmap .then((instance: ImageBitmap) => { args.push(instance, dx, dy); diff --git a/src/worker-thread/canvas/FakeNativeCanvasPattern.ts b/src/worker-thread/canvas/FakeNativeCanvasPattern.ts index 56c56a2b5..478518a10 100644 --- a/src/worker-thread/canvas/FakeNativeCanvasPattern.ts +++ b/src/worker-thread/canvas/FakeNativeCanvasPattern.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import type { HTMLElement } from '../dom/HTMLElement'; -import type { CanvasImageSource } from './CanvasTypes'; -import type { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; +import { HTMLElement } from '../dom/HTMLElement'; +import { CanvasImageSource } from './CanvasTypes'; import { retrieveImageBitmap } from './canvas-utils'; +import { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; /** diff --git a/src/worker-thread/canvas/OffscreenCanvasPolyfill.ts b/src/worker-thread/canvas/OffscreenCanvasPolyfill.ts index 18e3555b7..b084c2544 100644 --- a/src/worker-thread/canvas/OffscreenCanvasPolyfill.ts +++ b/src/worker-thread/canvas/OffscreenCanvasPolyfill.ts @@ -14,7 +14,9 @@ * limitations under the License. */ -import type { +import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; +import { TransferrableKeys } from '../../transfer/TransferrableKeys'; +import { CanvasRenderingContext2D, ImageSmoothingQuality, CanvasTextAlign, @@ -25,13 +27,8 @@ import type { CanvasFillRule, CanvasImageSource, } from './CanvasTypes'; -import type { Document } from '../dom/Document'; -import type { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; -import type { HTMLImageElement } from '../dom/HTMLImageElement'; - -import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; -import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { transfer } from '../MutationTransfer'; +import { Document } from '../dom/Document'; import { toLower } from '../../utils'; import { store } from '../strings'; import { HTMLElement } from '../dom/HTMLElement'; @@ -40,6 +37,8 @@ import { TransferrableObjectType } from '../../transfer/TransferrableMutation'; import { TransferrableObject } from '../worker-thread'; import { CanvasGradient } from './CanvasGradient'; import { CanvasPattern } from './CanvasPattern'; +import { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; +import { HTMLImageElement } from '../dom/HTMLImageElement'; /** * Handles calls to a CanvasRenderingContext2D object in cases where the user's environment does not diff --git a/src/worker-thread/canvas/canvas-utils.ts b/src/worker-thread/canvas/canvas-utils.ts index 825f5c749..1a6ffeaff 100644 --- a/src/worker-thread/canvas/canvas-utils.ts +++ b/src/worker-thread/canvas/canvas-utils.ts @@ -14,14 +14,12 @@ * limitations under the License. */ -import type { ImageBitmapToWorker } from '../../transfer/Messages'; -import type { HTMLImageElement } from '../dom/HTMLImageElement'; -import type { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; -import type { Document } from '../dom/Document'; - import { TransferrableKeys } from '../../transfer/TransferrableKeys'; -import { MessageType } from '../../transfer/Messages'; +import { MessageType, ImageBitmapToWorker } from '../../transfer/Messages'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; +import { HTMLImageElement } from '../dom/HTMLImageElement'; +import { HTMLCanvasElement } from '../dom/HTMLCanvasElement'; +import { Document } from '../dom/Document'; import { transfer } from '../MutationTransfer'; let indexTracker = 0; diff --git a/src/worker-thread/css/CSSStyleDeclaration.ts b/src/worker-thread/css/CSSStyleDeclaration.ts index 81f96d0ef..608982ebe 100644 --- a/src/worker-thread/css/CSSStyleDeclaration.ts +++ b/src/worker-thread/css/CSSStyleDeclaration.ts @@ -14,16 +14,15 @@ * limitations under the License. */ -import type { Document } from '../dom/Document'; -import type { Element } from '../dom/Element'; -import type { NamespaceURI } from '../dom/Node'; - import { mutate } from '../MutationObserver'; import { MutationRecordType } from '../MutationRecord'; +import { Element } from '../dom/Element'; +import { NamespaceURI } from '../dom/Node'; import { toLower } from '../../utils'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { store as storeString } from '../strings'; +import { Document } from '../dom/Document'; interface StyleProperties { [key: string]: string | null; diff --git a/src/worker-thread/dom/Attr.ts b/src/worker-thread/dom/Attr.ts index 553b44db7..c263e0371 100644 --- a/src/worker-thread/dom/Attr.ts +++ b/src/worker-thread/dom/Attr.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { NamespaceURI } from './Node'; import { keyValueString } from '../../utils'; +import { NamespaceURI } from './Node'; export interface Attr { [index: string]: string | null; diff --git a/src/worker-thread/dom/CharacterData.ts b/src/worker-thread/dom/CharacterData.ts index 90653571d..7f158b7c4 100644 --- a/src/worker-thread/dom/CharacterData.ts +++ b/src/worker-thread/dom/CharacterData.ts @@ -14,14 +14,12 @@ * limitations under the License. */ -import type { NodeName } from './Node'; -import type { Document } from './Document'; -import type { NodeType } from '../../transfer/TransferrableNodes'; - -import { Node } from './Node'; +import { Node, NodeName } from './Node'; import { mutate } from '../MutationObserver'; import { MutationRecordType } from '../MutationRecord'; import { store as storeString } from '../strings'; +import { Document } from './Document'; +import { NodeType } from '../../transfer/TransferrableNodes'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; diff --git a/src/worker-thread/dom/Comment.ts b/src/worker-thread/dom/Comment.ts index f93dbf03a..dff5d23de 100644 --- a/src/worker-thread/dom/Comment.ts +++ b/src/worker-thread/dom/Comment.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import type { Node } from './Node'; import { CharacterData } from './CharacterData'; +import { Node } from './Node'; import { NodeType } from '../../transfer/TransferrableNodes'; // @see https://developer.mozilla.org/en-US/docs/Web/API/Comment diff --git a/src/worker-thread/dom/DOMTokenList.ts b/src/worker-thread/dom/DOMTokenList.ts index da4757ee9..8547588c7 100644 --- a/src/worker-thread/dom/DOMTokenList.ts +++ b/src/worker-thread/dom/DOMTokenList.ts @@ -14,15 +14,14 @@ * limitations under the License. */ -import type { Document } from './Document'; -import type { Element } from './Element'; -import type { NamespaceURI } from './Node'; - +import { Element } from './Element'; +import { NamespaceURI } from './Node'; import { mutate } from '../MutationObserver'; import { MutationRecordType } from '../MutationRecord'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { store as storeString } from '../strings'; +import { Document } from './Document'; const WHITESPACE_REGEX = /\s/; diff --git a/src/worker-thread/dom/Document.ts b/src/worker-thread/dom/Document.ts index 5a013a5d6..b647af889 100644 --- a/src/worker-thread/dom/Document.ts +++ b/src/worker-thread/dom/Document.ts @@ -14,10 +14,6 @@ * limitations under the License. */ -import type { WorkerDOMGlobalScope, GlobalScope } from '../WorkerDOMGlobalScope'; -import type { PostMessage } from '../worker-thread'; -import type { HydrateableNode } from '../../transfer/TransferrableNodes'; - import { Element, NS_NAME_TO_CLASS } from './Element'; import { HTMLElement } from './HTMLElement'; import './HTMLAnchorElement'; @@ -56,12 +52,14 @@ import { Text } from './Text'; import { Comment } from './Comment'; import { toLower } from '../../utils'; import { DocumentFragment } from './DocumentFragment'; -import { NodeType, HTML_NAMESPACE, } from '../../transfer/TransferrableNodes'; +import { PostMessage } from '../worker-thread'; +import { NodeType, HTML_NAMESPACE, HydrateableNode } from '../../transfer/TransferrableNodes'; import { Phase } from '../../transfer/Phase'; import { propagate as propagateEvents } from '../Event'; import { propagate as propagateSyncValues } from '../SyncValuePropagation'; import { propagate as propagateResize } from '../ResizePropagation'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; +import { WorkerDOMGlobalScope, GlobalScope } from '../WorkerDOMGlobalScope'; import { set as setPhase } from '../phase'; const DOCUMENT_NAME = '#document'; diff --git a/src/worker-thread/dom/DocumentFragment.ts b/src/worker-thread/dom/DocumentFragment.ts index 827aca597..6e0172620 100644 --- a/src/worker-thread/dom/DocumentFragment.ts +++ b/src/worker-thread/dom/DocumentFragment.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import type { Node } from './Node'; import { ParentNode } from './ParentNode'; import { store as storeString } from '../strings'; +import { Node } from './Node'; import { NodeType } from '../../transfer/TransferrableNodes'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; diff --git a/src/worker-thread/dom/DocumentLite.ts b/src/worker-thread/dom/DocumentLite.ts index bb6e4baab..c6a30b7f0 100644 --- a/src/worker-thread/dom/DocumentLite.ts +++ b/src/worker-thread/dom/DocumentLite.ts @@ -14,12 +14,11 @@ * limitations under the License. */ -import type { PostMessage } from '../worker-thread'; -import type { WorkerNoDOMGlobalScope } from '../WorkerDOMGlobalScope'; - +import { PostMessage } from '../worker-thread'; import { Phase } from '../../transfer/Phase'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { set as setPhase } from '../phase'; +import { WorkerNoDOMGlobalScope } from '../WorkerDOMGlobalScope'; /** * A lightweight Document stub for the no-dom amp binary. diff --git a/src/worker-thread/dom/Element.ts b/src/worker-thread/dom/Element.ts index 266d2fec5..2c506bf2d 100644 --- a/src/worker-thread/dom/Element.ts +++ b/src/worker-thread/dom/Element.ts @@ -14,9 +14,7 @@ * limitations under the License. */ -import type { Node, NodeName, NamespaceURI } from './Node'; -import type { MessageToWorker, BoundingClientRectToWorker } from '../../transfer/Messages'; - +import { Node, NodeName, NamespaceURI } from './Node'; import { ParentNode } from './ParentNode'; import { DOMTokenList, synchronizedAccessor } from './DOMTokenList'; import { Attr, toString as attrsToString, matchPredicate as matchAttrPredicate } from './Attr'; @@ -33,7 +31,7 @@ import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { NodeType, HTML_NAMESPACE } from '../../transfer/TransferrableNodes'; import { TransferrableBoundingClientRect } from '../../transfer/TransferrableBoundClientRect'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; -import { MessageType } from '../../transfer/Messages'; +import { MessageToWorker, MessageType, BoundingClientRectToWorker } from '../../transfer/Messages'; import { parse } from '../../third_party/html-parser/html-parser'; import { propagate } from './Node'; import { Event } from '../Event'; diff --git a/src/worker-thread/dom/HTMLDataListElement.ts b/src/worker-thread/dom/HTMLDataListElement.ts index 0114072a3..12af5757e 100644 --- a/src/worker-thread/dom/HTMLDataListElement.ts +++ b/src/worker-thread/dom/HTMLDataListElement.ts @@ -14,11 +14,9 @@ * limitations under the License. */ -import type { Node } from './Node'; -import type { Element } from './Element'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; +import { Node } from './Node'; export class HTMLDataListElement extends HTMLElement { /** diff --git a/src/worker-thread/dom/HTMLFormControlsMixin.ts b/src/worker-thread/dom/HTMLFormControlsMixin.ts index 7878b8d72..6377ffce5 100644 --- a/src/worker-thread/dom/HTMLFormControlsMixin.ts +++ b/src/worker-thread/dom/HTMLFormControlsMixin.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; +import { Element } from './Element'; import { matchChildrenElements, tagNameConditionPredicate } from './matchElements'; const MATCHING_CHILD_ELEMENT_TAGNAMES = 'BUTTON FIELDSET INPUT OBJECT OUTPUT SELECT TEXTAREA'.split(' '); diff --git a/src/worker-thread/dom/HTMLFormElement.ts b/src/worker-thread/dom/HTMLFormElement.ts index 95507eac5..959336b04 100644 --- a/src/worker-thread/dom/HTMLFormElement.ts +++ b/src/worker-thread/dom/HTMLFormElement.ts @@ -14,9 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; import { HTMLFormControlsCollectionMixin } from './HTMLFormControlsMixin'; import { reflectProperties } from './enhanceElement'; diff --git a/src/worker-thread/dom/HTMLInputElement.ts b/src/worker-thread/dom/HTMLInputElement.ts index 6f99eea29..8a54790de 100644 --- a/src/worker-thread/dom/HTMLInputElement.ts +++ b/src/worker-thread/dom/HTMLInputElement.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -import type { Document } from './Document'; - import { HTMLElement } from './HTMLElement'; import { HTMLInputLabelsMixin } from './HTMLInputLabelsMixin'; import { reflectProperties } from './enhanceElement'; @@ -23,6 +21,7 @@ import { registerSubclass } from './Element'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { store as storeString } from '../strings'; +import { Document } from './Document'; import { transfer } from '../MutationTransfer'; import { NumericBoolean } from '../../utils'; diff --git a/src/worker-thread/dom/HTMLInputLabelsMixin.ts b/src/worker-thread/dom/HTMLInputLabelsMixin.ts index 4426f1e30..4bcfa7b9c 100644 --- a/src/worker-thread/dom/HTMLInputLabelsMixin.ts +++ b/src/worker-thread/dom/HTMLInputLabelsMixin.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; +import { Element } from './Element'; import { matchChildrenElements } from './matchElements'; /** diff --git a/src/worker-thread/dom/HTMLLabelElement.ts b/src/worker-thread/dom/HTMLLabelElement.ts index a98ec6cd7..823bcefe1 100644 --- a/src/worker-thread/dom/HTMLLabelElement.ts +++ b/src/worker-thread/dom/HTMLLabelElement.ts @@ -14,13 +14,11 @@ * limitations under the License. */ -import type { Document } from './Document'; -import type { Element } from './Element'; - -import { registerSubclass } from './Element'; +import { Element, registerSubclass } from './Element'; import { HTMLElement } from './HTMLElement'; import { reflectProperties } from './enhanceElement'; import { matchChildElement, tagNameConditionPredicate } from './matchElements'; +import { Document } from './Document'; export class HTMLLabelElement extends HTMLElement { /** diff --git a/src/worker-thread/dom/HTMLMapElement.ts b/src/worker-thread/dom/HTMLMapElement.ts index 203622387..6f439b94b 100644 --- a/src/worker-thread/dom/HTMLMapElement.ts +++ b/src/worker-thread/dom/HTMLMapElement.ts @@ -14,9 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; import { reflectProperties } from './enhanceElement'; import { matchChildrenElements } from './matchElements'; diff --git a/src/worker-thread/dom/HTMLOptionElement.ts b/src/worker-thread/dom/HTMLOptionElement.ts index 37e97ecb5..b743f29b2 100644 --- a/src/worker-thread/dom/HTMLOptionElement.ts +++ b/src/worker-thread/dom/HTMLOptionElement.ts @@ -14,13 +14,12 @@ * limitations under the License. */ -import type { Document } from './Document'; - import { registerSubclass, definePropertyBackedAttributes } from './Element'; import { HTMLElement } from './HTMLElement'; import { reflectProperties } from './enhanceElement'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { transfer } from '../MutationTransfer'; +import { Document } from './Document'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; import { store as storeString } from '../strings'; import { NumericBoolean } from '../../utils'; diff --git a/src/worker-thread/dom/HTMLSelectElement.ts b/src/worker-thread/dom/HTMLSelectElement.ts index e504a8899..deac6132c 100644 --- a/src/worker-thread/dom/HTMLSelectElement.ts +++ b/src/worker-thread/dom/HTMLSelectElement.ts @@ -14,16 +14,14 @@ * limitations under the License. */ -import type { Element } from './Element'; -import type { HTMLOptionElement } from './HTMLOptionElement'; -import type { Node } from './Node'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; import { reflectProperties } from './enhanceElement'; import { HTMLInputLabelsMixin } from './HTMLInputLabelsMixin'; import { matchChildrenElements, matchChildElement, tagNameConditionPredicate } from './matchElements'; +import { HTMLOptionElement } from './HTMLOptionElement'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; +import { Node } from './Node'; const isOptionPredicate = tagNameConditionPredicate(['OPTION']); const isSelectedOptionPredicate = (element: Element): boolean => isOptionPredicate(element) && (element as HTMLOptionElement).selected === true; diff --git a/src/worker-thread/dom/HTMLTableCellElement.ts b/src/worker-thread/dom/HTMLTableCellElement.ts index 0965b26ae..0fa75dafe 100644 --- a/src/worker-thread/dom/HTMLTableCellElement.ts +++ b/src/worker-thread/dom/HTMLTableCellElement.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import { HTMLElement } from './HTMLElement'; -import { DOMTokenList } from './DOMTokenList'; import { registerSubclass, definePropertyBackedAttributes } from './Element'; +import { HTMLElement } from './HTMLElement'; import { reflectProperties } from './enhanceElement'; +import { DOMTokenList } from './DOMTokenList'; import { matchNearestParent, tagNameConditionPredicate, matchChildrenElements } from './matchElements'; export class HTMLTableCellElement extends HTMLElement { diff --git a/src/worker-thread/dom/HTMLTableElement.ts b/src/worker-thread/dom/HTMLTableElement.ts index 134c84f69..7da1dd693 100644 --- a/src/worker-thread/dom/HTMLTableElement.ts +++ b/src/worker-thread/dom/HTMLTableElement.ts @@ -14,14 +14,12 @@ * limitations under the License. */ -import type { Element } from './Element'; -import type { NodeName } from './Node'; -import type { HTMLTableSectionElement } from './HTMLTableSectionElement'; -import type { HTMLTableRowElement } from './HTMLTableRowElement'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; import { matchChildElement, matchChildrenElements, tagNameConditionPredicate } from './matchElements'; +import { NodeName } from './Node'; +import { HTMLTableSectionElement } from './HTMLTableSectionElement'; +import { HTMLTableRowElement } from './HTMLTableRowElement'; import { toUpper } from '../../utils'; const removeElement = (element: Element | null): any => element && element.remove(); diff --git a/src/worker-thread/dom/HTMLTableRowElement.ts b/src/worker-thread/dom/HTMLTableRowElement.ts index 51710b657..b7a067ba4 100644 --- a/src/worker-thread/dom/HTMLTableRowElement.ts +++ b/src/worker-thread/dom/HTMLTableRowElement.ts @@ -14,14 +14,12 @@ * limitations under the License. */ -import type { HTMLTableElement } from './HTMLTableElement'; -import type { Document } from './Document'; -import type { HTMLTableCellElement } from './HTMLTableCellElement'; -import type { Element } from './Element'; - -import { registerSubclass } from './Element'; +import { registerSubclass, Element } from './Element'; import { HTMLElement } from './HTMLElement'; import { matchNearestParent, tagNameConditionPredicate, ConditionPredicate, matchChildrenElements } from './matchElements'; +import { HTMLTableElement } from './HTMLTableElement'; +import { Document } from './Document'; +import { HTMLTableCellElement } from './HTMLTableCellElement'; const TABLE_SECTION_TAGNAMES = 'TABLE TBODY THEAD TFOOT'.split(' '); diff --git a/src/worker-thread/dom/HTMLTableSectionElement.ts b/src/worker-thread/dom/HTMLTableSectionElement.ts index 4a184c221..1c8a94b8d 100644 --- a/src/worker-thread/dom/HTMLTableSectionElement.ts +++ b/src/worker-thread/dom/HTMLTableSectionElement.ts @@ -14,12 +14,12 @@ * limitations under the License. */ -import type { Document } from './Document'; -import type { HTMLTableRowElement } from './HTMLTableRowElement'; - import { registerSubclass } from './Element'; import { HTMLElement } from './HTMLElement'; import { tagNameConditionPredicate, matchChildrenElements } from './matchElements'; +import { Document } from './Document'; +import { HTMLTableRowElement } from './HTMLTableRowElement'; + export class HTMLTableSectionElement extends HTMLElement { /** * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableSectionElement diff --git a/src/worker-thread/dom/Node.ts b/src/worker-thread/dom/Node.ts index 676bed0c1..fd0cc4789 100644 --- a/src/worker-thread/dom/Node.ts +++ b/src/worker-thread/dom/Node.ts @@ -14,18 +14,16 @@ * limitations under the License. */ -import type { Event, EventHandler, AddEventListenerOptions } from '../Event'; -import type { Document } from './Document'; -import type { TransferredNode } from '../../transfer/TransferrableNodes'; - import { store as storeNodeMapping, storeOverride as storeOverrideNodeMapping } from '../nodes'; +import { Event, EventHandler, AddEventListenerOptions } from '../Event'; import { toLower } from '../../utils'; import { mutate } from '../MutationObserver'; import { MutationRecordType } from '../MutationRecord'; import { TransferrableKeys } from '../../transfer/TransferrableKeys'; import { store as storeString } from '../strings'; +import { Document } from './Document'; import { transfer } from '../MutationTransfer'; -import { NodeType } from '../../transfer/TransferrableNodes'; +import { TransferredNode, NodeType } from '../../transfer/TransferrableNodes'; import { TransferrableMutationType } from '../../transfer/TransferrableMutation'; export type NodeName = '#comment' | '#document' | '#document-fragment' | '#text' | string; diff --git a/src/worker-thread/dom/ParentNode.ts b/src/worker-thread/dom/ParentNode.ts index 5df3a29a1..665ce2545 100644 --- a/src/worker-thread/dom/ParentNode.ts +++ b/src/worker-thread/dom/ParentNode.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; - +import { Element } from './Element'; import { elementPredicate, matchAttrReference, matchChildrenElements } from './matchElements'; import { Node } from './Node'; import { containsIndexOf, toLower } from '../../utils'; diff --git a/src/worker-thread/dom/SVGElement.ts b/src/worker-thread/dom/SVGElement.ts index c213dc7e8..88932d5e8 100644 --- a/src/worker-thread/dom/SVGElement.ts +++ b/src/worker-thread/dom/SVGElement.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import type { NodeName, Node, NamespaceURI } from './Node'; - -import { registerSubclass, Element } from './Element'; +import { Element, registerSubclass } from './Element'; +import { NodeName, Node, NamespaceURI } from './Node'; import { SVG_NAMESPACE, NodeType } from '../../transfer/TransferrableNodes'; export class SVGElement extends Element { diff --git a/src/worker-thread/dom/Text.ts b/src/worker-thread/dom/Text.ts index b66e6e39b..11fef06fb 100644 --- a/src/worker-thread/dom/Text.ts +++ b/src/worker-thread/dom/Text.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import type { Node } from './Node'; - import { CharacterData } from './CharacterData'; +import { Node } from './Node'; import { NodeType } from '../../transfer/TransferrableNodes'; // @see https://developer.mozilla.org/en-US/docs/Web/API/Text diff --git a/src/worker-thread/dom/enhanceElement.ts b/src/worker-thread/dom/enhanceElement.ts index d82825028..7bf72edfe 100644 --- a/src/worker-thread/dom/enhanceElement.ts +++ b/src/worker-thread/dom/enhanceElement.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Element } from './Element'; +import { Element } from './Element'; import { toLower } from '../../utils'; type PropertyValue = string | boolean | number; diff --git a/src/worker-thread/dom/matchElements.ts b/src/worker-thread/dom/matchElements.ts index 3b99c0552..bd18c5328 100644 --- a/src/worker-thread/dom/matchElements.ts +++ b/src/worker-thread/dom/matchElements.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import type { Element } from './Element'; -import type { Node } from './Node'; - +import { Element } from './Element'; import { toLower, toUpper } from '../../utils'; +import { Node } from './Node'; import { NodeType } from '../../transfer/TransferrableNodes'; export type ConditionPredicate = (element: Element) => boolean; diff --git a/src/worker-thread/function.ts b/src/worker-thread/function.ts index 9d404a067..b03b53024 100644 --- a/src/worker-thread/function.ts +++ b/src/worker-thread/function.ts @@ -14,15 +14,13 @@ * limitations under the License. */ -import type { Document } from './dom/Document'; -import type { MessageToWorker, FunctionCallToWorker } from '../transfer/Messages'; -import type { DocumentStub } from './dom/DocumentLite'; - import { TransferrableKeys } from '../transfer/TransferrableKeys'; -import { MessageType, ResolveOrReject } from '../transfer/Messages'; +import { Document } from './dom/Document'; +import { MessageToWorker, MessageType, FunctionCallToWorker, ResolveOrReject } from '../transfer/Messages'; import { transfer } from './MutationTransfer'; import { TransferrableMutationType } from '../transfer/TransferrableMutation'; import { store } from './strings'; +import { DocumentStub } from './dom/DocumentLite'; const exportedFunctions: { [fnIdent: string]: Function } = {}; diff --git a/src/worker-thread/index.amp.ts b/src/worker-thread/index.amp.ts index ab08ae87c..e7eab7257 100644 --- a/src/worker-thread/index.amp.ts +++ b/src/worker-thread/index.amp.ts @@ -14,12 +14,17 @@ * limitations under the License. */ -import { Document } from './dom/Document'; +import { AMP } from './amp/amp'; +import { callFunctionMessageHandler, exportFunction } from './function'; import { CharacterData } from './dom/CharacterData'; import { Comment } from './dom/Comment'; +import { deleteGlobals } from './amp/delete-globals'; +import { Document } from './dom/Document'; import { DocumentFragment } from './dom/DocumentFragment'; import { DOMTokenList } from './dom/DOMTokenList'; import { Element } from './dom/Element'; +import { Event as WorkerDOMEvent } from './Event'; +import { GlobalScope, WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; import { HTMLAnchorElement } from './dom/HTMLAnchorElement'; import { HTMLButtonElement } from './dom/HTMLButtonElement'; import { HTMLCanvasElement } from './dom/HTMLCanvasElement'; @@ -51,17 +56,11 @@ import { HTMLTableElement } from './dom/HTMLTableElement'; import { HTMLTableRowElement } from './dom/HTMLTableRowElement'; import { HTMLTableSectionElement } from './dom/HTMLTableSectionElement'; import { HTMLTimeElement } from './dom/HTMLTimeElement'; +import { initialize } from './initialize'; import { MutationObserver } from './MutationObserver'; +import { rafPolyfill, cafPolyfill } from './AnimationFrame'; import { SVGElement } from './dom/SVGElement'; import { Text } from './dom/Text'; - -import { AMP } from './amp/amp'; -import { callFunctionMessageHandler, exportFunction } from './function'; -import { deleteGlobals } from './amp/delete-globals'; -import { Event as WorkerDOMEvent } from './Event'; -import { GlobalScope, WorkerDOMGlobalScope } from './WorkerDOMGlobalScope'; -import { initialize } from './initialize'; -import { rafPolyfill, cafPolyfill } from './AnimationFrame'; import { wrap as longTaskWrap } from './long-task'; import { HydrateFunction } from './hydrate'; diff --git a/src/worker-thread/index.nodom.amp.ts b/src/worker-thread/index.nodom.amp.ts index 432d38591..f106ded85 100644 --- a/src/worker-thread/index.nodom.amp.ts +++ b/src/worker-thread/index.nodom.amp.ts @@ -14,15 +14,14 @@ * limitations under the License. */ -import type { WorkerNoDOMGlobalScope } from './WorkerDOMGlobalScope'; -import type { HydrateFunction } from './hydrate'; -import type { WorkerStorageInit } from './initialize-storage'; - +import { HydrateFunction } from './hydrate'; import { AMP } from './amp/amp'; -import { DocumentStub } from './dom/DocumentLite'; import { callFunctionMessageHandler, exportFunction } from './function'; +import { WorkerNoDOMGlobalScope } from './WorkerDOMGlobalScope'; +import { DocumentStub } from './dom/DocumentLite'; import { deleteGlobals } from './amp/delete-globals'; import { initializeStorage } from './initialize-storage'; +import { WorkerStorageInit } from './initialize-storage'; const noop = () => void 0; diff --git a/src/worker-thread/index.ts b/src/worker-thread/index.ts index b30d937a6..9a653bcad 100644 --- a/src/worker-thread/index.ts +++ b/src/worker-thread/index.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { Document } from './dom/Document'; import { HTMLElement } from './dom/HTMLElement'; import { SVGElement } from './dom/SVGElement'; import { HTMLAnchorElement } from './dom/HTMLAnchorElement'; @@ -46,8 +45,11 @@ import { HTMLTableElement } from './dom/HTMLTableElement'; import { HTMLTableRowElement } from './dom/HTMLTableRowElement'; import { HTMLTableSectionElement } from './dom/HTMLTableSectionElement'; import { HTMLTimeElement } from './dom/HTMLTimeElement'; +import { Document } from './dom/Document'; import { GlobalScope } from './WorkerDOMGlobalScope'; +import { initialize } from './initialize'; import { MutationObserver } from './MutationObserver'; +import { Event as WorkerDOMEvent } from './Event'; import { Text } from './dom/Text'; import { HTMLDataListElement } from './dom/HTMLDataListElement'; import { CharacterData } from './dom/CharacterData'; @@ -55,9 +57,6 @@ import { Comment } from './dom/Comment'; import { DOMTokenList } from './dom/DOMTokenList'; import { DocumentFragment } from './dom/DocumentFragment'; import { Element } from './dom/Element'; - -import { initialize } from './initialize'; -import { Event as WorkerDOMEvent } from './Event'; import { rafPolyfill, cafPolyfill } from './AnimationFrame'; import { HydrateFunction } from './hydrate'; diff --git a/src/worker-thread/initialize.ts b/src/worker-thread/initialize.ts index 5547b085e..84f4f7ae0 100644 --- a/src/worker-thread/initialize.ts +++ b/src/worker-thread/initialize.ts @@ -14,15 +14,14 @@ * limitations under the License. */ -import type { Document } from './dom/Document'; -import type { HydrateableNode } from '../transfer/TransferrableNodes'; -import type { WorkerStorageInit } from './initialize-storage'; - import { store as storeString } from './strings'; +import { Document } from './dom/Document'; +import { HydrateableNode } from '../transfer/TransferrableNodes'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; import { appendKeys as addCssKeys } from './css/CSSStyleDeclaration'; import { appendGlobalEventProperties } from './dom/HTMLElement'; import { initializeStorage } from './initialize-storage'; +import { WorkerStorageInit } from './initialize-storage'; export function initialize( document: Document, diff --git a/src/worker-thread/long-task.ts b/src/worker-thread/long-task.ts index 4382d4eee..606ced01c 100644 --- a/src/worker-thread/long-task.ts +++ b/src/worker-thread/long-task.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import type { Node } from './dom/Node'; -import type { Document } from './dom/Document'; - +import { Node } from './dom/Node'; import { transfer } from './MutationTransfer'; +import { Document } from './dom/Document'; import { TransferrableMutationType } from '../transfer/TransferrableMutation'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; diff --git a/src/worker-thread/nodes.ts b/src/worker-thread/nodes.ts index f272c12df..41698efbb 100644 --- a/src/worker-thread/nodes.ts +++ b/src/worker-thread/nodes.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import type { Node } from './dom/Node'; - +import { Node } from './dom/Node'; import { phase } from './phase'; import { Phase } from '../transfer/Phase'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; diff --git a/src/worker-thread/serializeTransferrableObject.ts b/src/worker-thread/serializeTransferrableObject.ts index 0dee5e7e6..24f45f074 100644 --- a/src/worker-thread/serializeTransferrableObject.ts +++ b/src/worker-thread/serializeTransferrableObject.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import type { Serializable, TransferrableObject } from './worker-thread'; - import { store } from './strings'; import { TransferrableObjectType } from '../transfer/TransferrableMutation'; +import { Serializable, TransferrableObject } from './worker-thread'; import { TransferrableKeys } from '../transfer/TransferrableKeys'; const f32 = new Float32Array(1); diff --git a/src/worker-thread/server-lib.ts b/src/worker-thread/server-lib.ts index 7377b051c..0f901d3e6 100644 --- a/src/worker-thread/server-lib.ts +++ b/src/worker-thread/server-lib.ts @@ -1,6 +1,5 @@ -import type { GlobalScope } from './WorkerDOMGlobalScope'; - import { Document } from './dom/Document'; +import { GlobalScope } from './WorkerDOMGlobalScope'; export function createDocument() { const win: GlobalScope = {} as any;