chrome-devtools-frontend 1.0.1726686 → 1.0.1730971
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/rules/tests/test-strict-assertions-and-literal-expectations.md +1 -1
- package/.agents/rules/tests/test-view-and-presenter-isolation.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-declarative-child-widget-composition.md +5 -5
- package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-localization-and-uistrings-hygiene.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-modern-component-and-encapsulation-standards.md +3 -3
- package/.agents/rules/ui-and-widgets/ui-pure-view-and-presenter-separation.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-reactive-widget-update-lifecycle.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +2 -2
- package/.agents/skills/code-review/SKILL.md +63 -12
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +38 -10
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +1 -0
- package/.agents/skills/ui-widgets/SKILL.md +8 -2
- package/.agents/skills/write-ai-eval-test/SKILL.md +106 -0
- package/AUTHORS +2 -0
- package/DIR_METADATA +1 -2
- package/README.md +48 -26
- package/config/typescript/tsconfig.base.json +1 -0
- package/config/typescript/tsconfig.eslint.json +1 -0
- package/docs/contributing/changes.md +25 -0
- package/docs/ui_engineering.md +13 -4
- package/eslint.config.mjs +323 -41
- package/front_end/core/common/Color.ts +7 -7
- package/front_end/core/common/ParsedURL.ts +3 -3
- package/front_end/core/common/ResolverBase.ts +3 -3
- package/front_end/core/common/SegmentedRange.ts +3 -3
- package/front_end/core/common/SimpleHistoryManager.ts +14 -14
- package/front_end/core/common/Trie.ts +3 -3
- package/front_end/core/common/VersionController.ts +7 -7
- package/front_end/core/host/InspectorFrontendHost.ts +2 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +9 -1
- package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +4 -0
- package/front_end/core/host/UserMetricsEnums.ts +2 -1
- package/front_end/core/platform/StringUtilities.ts +54 -13
- package/front_end/core/platform/node/HostRuntime.ts +13 -7
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +4 -5
- package/front_end/core/root/Runtime.ts +5 -0
- package/front_end/core/sdk/AccessibilityModel.ts +5 -5
- package/front_end/core/sdk/AnimationModel.ts +17 -19
- package/front_end/core/sdk/CPUProfilerModel.ts +3 -3
- package/front_end/core/sdk/CPUThrottlingManager.ts +7 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +73 -13
- package/front_end/core/sdk/CSSMetadata.ts +7 -7
- package/front_end/core/sdk/CSSModel.ts +33 -33
- package/front_end/core/sdk/CSSProperty.ts +5 -5
- package/front_end/core/sdk/CSSRule.ts +6 -6
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -4
- package/front_end/core/sdk/Connections.ts +16 -16
- package/front_end/core/sdk/ConsoleModel.ts +44 -47
- package/front_end/core/sdk/CookieParser.ts +11 -11
- package/front_end/core/sdk/EmulationModel.ts +35 -36
- package/front_end/core/sdk/EventBreakpointsModel.ts +11 -11
- package/front_end/core/sdk/FrameManager.ts +16 -16
- package/front_end/core/sdk/IsolateManager.ts +2 -2
- package/front_end/core/sdk/IssuesModel.ts +2 -2
- package/front_end/core/sdk/OverlayModel.ts +19 -19
- package/front_end/core/sdk/PageResourceLoader.ts +14 -16
- package/front_end/core/sdk/RemoteObject.ts +9 -9
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/RuntimeModel.ts +7 -7
- package/front_end/core/sdk/Script.ts +6 -6
- package/front_end/core/sdk/ServiceWorkerManager.ts +36 -10
- package/front_end/core/sdk/SourceMap.ts +18 -20
- package/front_end/core/sdk/SourceMapManager.ts +2 -2
- package/front_end/core/sdk/TargetManager.ts +2 -2
- package/front_end/devtools_compatibility.js +7 -3
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +2 -2
- package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +203 -115
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +1 -3
- package/front_end/generated/protocol.ts +1 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +36 -12
- package/front_end/models/ai_assistance/AiConversation.ts +8 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +137 -62
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +2 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +149 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +269 -42
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +9 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +13 -2
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +23 -7
- package/front_end/models/ai_assistance/tools/Tool.ts +7 -5
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +22 -24
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +60 -60
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +24 -24
- package/front_end/models/bindings/DefaultScriptMapping.ts +8 -8
- package/front_end/models/bindings/FileUtils.ts +13 -13
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +3 -3
- package/front_end/models/bindings/ResourceScriptMapping.ts +23 -23
- package/front_end/models/comment_manager/CommentManager.ts +3 -3
- package/front_end/models/comment_manager/CommentThread.ts +50 -5
- package/front_end/models/cpu_profile/CPUProfileDataModel.ts +14 -14
- package/front_end/models/cpu_profile/ProfileTreeModel.ts +4 -4
- package/front_end/models/elements/StyleChanges.ts +38 -0
- package/front_end/models/emulation/EmulatedDevices.ts +12 -12
- package/front_end/models/har/HARFormat.ts +4 -4
- package/front_end/models/javascript_metadata/NativeFunctions.ts +5 -1
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +57 -3
- package/front_end/models/lighthouse/RunTypes.ts +9 -1
- package/front_end/models/logs/LogManager.ts +2 -2
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +3 -0
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +24 -24
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +6 -0
- package/front_end/models/persistence/NetworkPersistenceManager.ts +8 -3
- package/front_end/models/trace/LanternComputationData.ts +37 -11
- package/front_end/models/trace/Processor.ts +2 -1
- package/front_end/models/trace/extras/TraceTree.ts +36 -10
- package/front_end/models/trace/handlers/InitiatorsHandler.ts +27 -34
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +2 -6
- package/front_end/models/trace/handlers/SamplesHandler.ts +9 -6
- package/front_end/models/workspace/FileManager.ts +6 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +4 -4
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +8 -1
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +15 -17
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
- package/front_end/panels/ai_assistance/ExternalHandler.ts +10 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +27 -22
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +19 -23
- package/front_end/panels/ai_assistance/components/ExploreWidget.ts +2 -2
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +23 -9
- package/front_end/panels/ai_assistance/components/chatInput.css +1 -1
- package/front_end/panels/animation/AnimationTimeline.ts +37 -17
- package/front_end/panels/animation/animationTimeline.css +19 -3
- package/front_end/panels/application/AppManifestView.ts +1 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +143 -128
- package/front_end/panels/application/DOMStorageItemsView.ts +14 -14
- package/front_end/panels/application/DeviceBoundSessionsView.ts +10 -13
- package/front_end/panels/application/ExtensionStorageItemsView.ts +3 -4
- package/front_end/panels/application/IndexedDBViews.ts +8 -4
- package/front_end/panels/application/KeyValueStorageItemsView.ts +4 -5
- package/front_end/panels/application/PrivateVerificationTokensView.ts +53 -0
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +12 -8
- package/front_end/panels/application/ServiceWorkersView.ts +1 -2
- package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
- package/front_end/panels/application/StorageView.ts +2 -2
- package/front_end/panels/application/WebMCPView.ts +91 -109
- package/front_end/panels/application/application.ts +2 -0
- package/front_end/panels/application/components/StorageMetadataView.ts +6 -6
- package/front_end/panels/application/preloading/PreloadingView.ts +70 -37
- package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +3 -3
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +12 -0
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +10 -11
- package/front_end/panels/application/privateVerificationTokensView.css +20 -0
- package/front_end/panels/application/serviceWorkersView.css +2 -2
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +24 -24
- package/front_end/panels/changes/ChangesSidebar.ts +5 -5
- package/front_end/panels/changes/ChangesView.ts +10 -11
- package/front_end/panels/comments/CommentsPane.ts +292 -102
- package/front_end/panels/comments/commentsPane.css +93 -12
- package/front_end/panels/common/CommentThreadWidget.ts +69 -0
- package/front_end/panels/common/CommentsOverlayWidget.ts +108 -29
- package/front_end/panels/common/CommentsStatusBarPill.ts +17 -6
- package/front_end/panels/common/DOMLinkifier.ts +37 -12
- package/front_end/panels/common/ExtensionPanel.ts +13 -4
- package/front_end/panels/common/ExtensionServer.ts +27 -3
- package/front_end/panels/common/PersistenceUtils.ts +3 -3
- package/front_end/panels/common/commentThreadWidget.css +25 -1
- package/front_end/panels/common/common-meta.ts +10 -0
- package/front_end/panels/console/ConsolePinPane.ts +13 -15
- package/front_end/panels/console/ConsolePrompt.ts +173 -95
- package/front_end/panels/console/ConsoleSidebar.ts +2 -2
- package/front_end/panels/console/ConsoleView.ts +75 -79
- package/front_end/panels/console/ConsoleViewMessage.ts +52 -4
- package/front_end/panels/console/SymbolizedErrorWidget.ts +8 -4
- package/front_end/panels/console/consolePrompt.css +1 -1
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/console_counters/WarningErrorCounter.ts +3 -4
- package/front_end/panels/coverage/CoverageListView.ts +2 -2
- package/front_end/panels/coverage/CoverageView.ts +20 -5
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +4 -3
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewStartView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +8 -8
- package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +2 -3
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +4 -5
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +6 -7
- package/front_end/panels/elements/CSSValueTraceView.ts +3 -3
- package/front_end/panels/elements/ClassesPaneWidget.ts +1 -2
- package/front_end/panels/elements/ComputedStyleWidget.ts +15 -14
- package/front_end/panels/elements/DOMTreeElementWidget.ts +5 -4
- package/front_end/panels/elements/DOMTreeWidget.ts +2 -1
- package/front_end/panels/elements/ElementStatePaneWidget.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +1 -0
- package/front_end/panels/elements/EventListenersWidget.ts +2 -2
- package/front_end/panels/elements/LayoutPane.ts +2 -2
- package/front_end/panels/elements/PlatformFontsWidget.ts +3 -3
- package/front_end/panels/elements/PropertiesWidget.ts +9 -10
- package/front_end/panels/elements/PropertyRenderer.ts +72 -11
- package/front_end/panels/elements/StandaloneStylesContainer.ts +5 -10
- package/front_end/panels/elements/StyleEditorWidget.ts +30 -16
- package/front_end/panels/elements/StylePropertiesSection.ts +93 -44
- package/front_end/panels/elements/StylePropertyTreeElement.ts +230 -302
- package/front_end/panels/elements/StylesContainer.ts +2 -3
- package/front_end/panels/elements/StylesSidebarPane.ts +4 -13
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +66 -37
- package/front_end/panels/elements/components/CSSHintDetailsView.ts +51 -41
- package/front_end/panels/elements/components/CSSPropertyDocsView.ts +75 -65
- package/front_end/panels/elements/components/CSSQuery.ts +112 -74
- package/front_end/panels/elements/components/CSSVariableValueView.ts +109 -68
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +64 -45
- package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +35 -28
- package/front_end/panels/elements/components/QueryContainer.ts +104 -74
- package/front_end/panels/elements/components/accessibilityTreeNode.css +22 -20
- package/front_end/panels/elements/components/computedStyleProperty.css +2 -0
- package/front_end/panels/elements/components/cssHintDetailsView.css +23 -21
- package/front_end/panels/elements/components/cssPropertyDocsView.css +38 -36
- package/front_end/panels/elements/components/cssVariableValueView.css +42 -40
- package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -2
- package/front_end/panels/elements/components/queryContainer.css +23 -21
- package/front_end/panels/elements/stylesSidebarPane.css +3 -3
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -2
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +2 -2
- package/front_end/panels/emulation/MediaQueryInspector.ts +9 -10
- package/front_end/panels/emulation/mediaQueryInspector.css +1 -1
- package/front_end/panels/event_listeners/EventListenersView.ts +2 -2
- package/front_end/panels/issues/AffectedCookiesView.ts +144 -101
- package/front_end/panels/issues/AffectedDescendantsWithinSelectElementView.ts +83 -31
- package/front_end/panels/issues/AffectedDirectivesView.ts +218 -135
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +84 -34
- package/front_end/panels/issues/AffectedElementsView.ts +86 -23
- package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +2 -2
- package/front_end/panels/issues/AffectedMetadataAllowedSitesView.ts +2 -2
- package/front_end/panels/issues/AffectedPartitioningBlobURLView.ts +36 -11
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +135 -58
- package/front_end/panels/issues/AffectedSourcesView.ts +49 -28
- package/front_end/panels/issues/AffectedTrackingSitesView.ts +3 -4
- package/front_end/panels/issues/CorsIssueDetailsView.ts +490 -269
- package/front_end/panels/issues/GenericIssueDetailsView.ts +2 -2
- package/front_end/panels/issues/IssueKindView.ts +63 -48
- package/front_end/panels/issues/IssueView.ts +14 -18
- package/front_end/panels/issues/components/ElementsPanelLink.ts +70 -34
- package/front_end/panels/issues/components/HideIssuesMenu.ts +56 -32
- package/front_end/panels/issues/components/elementsPanelLink.css +10 -6
- package/front_end/panels/issues/components/hideIssuesMenu.css +16 -14
- package/front_end/panels/issues/issues.ts +2 -0
- package/front_end/panels/issues/issuesTree.css +4 -4
- package/front_end/panels/lighthouse/LighthouseController.ts +6 -6
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +12 -13
- package/front_end/panels/lighthouse/lighthouseStartView.css +1 -1
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +159 -161
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorView.ts +228 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +32 -41
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
- package/front_end/panels/linear_memory_inspector/linear_memory_inspector.ts +2 -0
- package/front_end/panels/media/EventDisplayTable.ts +2 -2
- package/front_end/panels/media/MainView.ts +132 -66
- package/front_end/panels/media/PlayerDetailView.ts +32 -14
- package/front_end/panels/media/PlayerListView.ts +83 -23
- package/front_end/panels/media/PlayerPropertiesView.ts +2 -2
- package/front_end/panels/media/TickingFlameChart.ts +153 -63
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -2
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +615 -464
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +43 -0
- package/front_end/panels/network/EventSourceMessagesView.ts +3 -3
- package/front_end/panels/network/NetworkConfigView.ts +6 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +2 -1
- package/front_end/panels/network/NetworkItemView.ts +27 -26
- package/front_end/panels/network/NetworkManageCustomHeadersView.ts +236 -97
- package/front_end/panels/network/NetworkOverview.ts +8 -10
- package/front_end/panels/network/RequestConditionsDrawer.ts +8 -4
- package/front_end/panels/network/RequestDeviceBoundSessionsView.ts +2 -4
- package/front_end/panels/network/RequestHTMLView.ts +26 -7
- package/front_end/panels/network/RequestHeadersView.ts +2 -2
- package/front_end/panels/network/RequestInitiatorView.ts +21 -22
- package/front_end/panels/network/RequestPayloadView.ts +2 -16
- package/front_end/panels/network/RequestPreviewView.ts +5 -5
- package/front_end/panels/network/RequestTimingView.ts +6 -6
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +5 -6
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +4 -3
- package/front_end/panels/network/ShowMoreDetailsWidget.ts +11 -12
- package/front_end/panels/network/SignedExchangeInfoView.ts +2 -2
- package/front_end/panels/network/networkLogView.css +2 -2
- package/front_end/panels/network/networkManageCustomHeadersView.css +27 -6
- package/front_end/panels/network/requestConditionsDrawer.css +1 -1
- package/front_end/panels/network/requestInitiatorView.css +5 -3
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -2
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +1 -2
- package/front_end/panels/profiler/HeapTimelineOverview.ts +77 -15
- package/front_end/panels/profiler/IsolateSelector.ts +258 -187
- package/front_end/panels/profiler/ProfileLauncherView.ts +7 -29
- package/front_end/panels/profiler/profileLauncherView.css +6 -1
- package/front_end/panels/protocol_monitor/JSONEditor.ts +4 -5
- package/front_end/panels/recorder/ControlButton.ts +1 -1
- package/front_end/panels/recorder/RecordingListView.ts +2 -4
- package/front_end/panels/recorder/RecordingView.ts +1 -2
- package/front_end/panels/recorder/SelectorPicker.ts +2 -4
- package/front_end/panels/recorder/StepView.ts +24 -10
- package/front_end/panels/recorder/TimelineSection.ts +1 -1
- package/front_end/panels/recorder/recordingView.css +1 -1
- package/front_end/panels/screencast/ScreencastApp.ts +1 -1
- package/front_end/panels/search/SearchResultsPane.ts +11 -12
- package/front_end/panels/search/SearchView.ts +8 -10
- package/front_end/panels/security/SecurityPanel.ts +1 -8
- package/front_end/panels/security/SecurityPanelSidebar.ts +2 -2
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -2
- package/front_end/panels/settings/AISettingsTab.ts +1 -1
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +34 -20
- package/front_end/panels/settings/EditFileSystemView.ts +2 -2
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +375 -197
- package/front_end/panels/settings/KeybindsSettingsTab.ts +570 -414
- package/front_end/panels/settings/SettingsScreen.ts +312 -114
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -2
- package/front_end/panels/settings/aiSettingsTab.css +1 -4
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +924 -578
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +9 -2
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +39 -0
- package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +37 -8
- package/front_end/panels/settings/settingsScreen.css +0 -24
- package/front_end/panels/sources/BreakpointEditDialog.ts +9 -6
- package/front_end/panels/sources/BreakpointsView.ts +25 -4
- package/front_end/panels/sources/CallStackSidebarPane.ts +7 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
- package/front_end/panels/sources/GoToLineQuickOpen.ts +8 -8
- package/front_end/panels/sources/NavigatorView.ts +521 -439
- package/front_end/panels/sources/PersistenceActions.ts +11 -12
- package/front_end/panels/sources/ProfilePlugin.ts +28 -17
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -4
- package/front_end/panels/sources/SourcesNavigator.ts +9 -9
- package/front_end/panels/sources/SourcesPanel.ts +2 -2
- package/front_end/panels/sources/SourcesView.ts +3 -3
- package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -2
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -2
- package/front_end/panels/sources/components/HeadersView.ts +1 -2
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +5 -6
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +73 -34
- package/front_end/panels/timeline/IsolateSelector.ts +25 -37
- package/front_end/panels/timeline/StatusDialog.ts +5 -7
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +10 -13
- package/front_end/panels/timeline/TimelineDetailsView.ts +40 -21
- package/front_end/panels/timeline/TimelineEventOverview.ts +130 -34
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineMiniMap.ts +255 -103
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +19 -11
- package/front_end/panels/timeline/TimelinePanel.ts +1 -0
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +11 -12
- package/front_end/panels/timeline/TimelineTreeView.ts +240 -122
- package/front_end/panels/timeline/TimelineUIUtils.ts +12 -0
- package/front_end/panels/timeline/components/BreadcrumbsUI.ts +5 -4
- package/front_end/panels/timeline/components/DetailsView.ts +97 -65
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +2 -2
- package/front_end/panels/timeline/components/MetricCard.ts +2 -2
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +11 -12
- package/front_end/panels/timeline/components/NetworkTrackWidget.ts +57 -50
- package/front_end/panels/timeline/components/RelatedInsightChips.ts +2 -2
- package/front_end/panels/timeline/components/Sidebar.ts +161 -109
- package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +33 -12
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +3 -0
- package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +11 -11
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +6 -7
- package/front_end/panels/timeline/components/networkTrackWidget.css +24 -22
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
- package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +15 -10
- package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +1 -1
- package/front_end/panels/timeline/timelinePanel.css +5 -0
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/web_audio/WebAudioView.ts +2 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/legacy-javascript/README.chromium +2 -2
- package/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +2 -2
- package/front_end/third_party/legacy-javascript/package.json +1 -1
- package/front_end/third_party/lighthouse/README.chromium +2 -2
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1983 -2022
- package/front_end/third_party/lighthouse/locales/ar-XB.json +157 -142
- package/front_end/third_party/lighthouse/locales/ar.json +157 -142
- package/front_end/third_party/lighthouse/locales/bg.json +154 -139
- package/front_end/third_party/lighthouse/locales/ca.json +157 -142
- package/front_end/third_party/lighthouse/locales/cs.json +148 -133
- package/front_end/third_party/lighthouse/locales/da.json +153 -138
- package/front_end/third_party/lighthouse/locales/de.json +152 -137
- package/front_end/third_party/lighthouse/locales/el.json +153 -138
- package/front_end/third_party/lighthouse/locales/en-GB.json +160 -145
- package/front_end/third_party/lighthouse/locales/en-US.json +239 -218
- package/front_end/third_party/lighthouse/locales/en-XL.json +239 -218
- package/front_end/third_party/lighthouse/locales/es-419.json +150 -135
- package/front_end/third_party/lighthouse/locales/es.json +149 -134
- package/front_end/third_party/lighthouse/locales/fi.json +151 -136
- package/front_end/third_party/lighthouse/locales/fil.json +154 -139
- package/front_end/third_party/lighthouse/locales/fr.json +150 -135
- package/front_end/third_party/lighthouse/locales/he.json +160 -145
- package/front_end/third_party/lighthouse/locales/hi.json +156 -141
- package/front_end/third_party/lighthouse/locales/hr.json +154 -139
- package/front_end/third_party/lighthouse/locales/hu.json +111 -96
- package/front_end/third_party/lighthouse/locales/id.json +153 -138
- package/front_end/third_party/lighthouse/locales/it.json +153 -138
- package/front_end/third_party/lighthouse/locales/ja.json +150 -135
- package/front_end/third_party/lighthouse/locales/ko.json +42 -27
- package/front_end/third_party/lighthouse/locales/lt.json +152 -137
- package/front_end/third_party/lighthouse/locales/lv.json +93 -78
- package/front_end/third_party/lighthouse/locales/nl.json +149 -134
- package/front_end/third_party/lighthouse/locales/no.json +152 -137
- package/front_end/third_party/lighthouse/locales/pl.json +153 -138
- package/front_end/third_party/lighthouse/locales/pt-PT.json +152 -137
- package/front_end/third_party/lighthouse/locales/pt.json +157 -142
- package/front_end/third_party/lighthouse/locales/ro.json +149 -134
- package/front_end/third_party/lighthouse/locales/ru.json +76 -61
- package/front_end/third_party/lighthouse/locales/sk.json +153 -138
- package/front_end/third_party/lighthouse/locales/sl.json +149 -134
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +151 -136
- package/front_end/third_party/lighthouse/locales/sr.json +151 -136
- package/front_end/third_party/lighthouse/locales/sv.json +152 -137
- package/front_end/third_party/lighthouse/locales/ta.json +156 -141
- package/front_end/third_party/lighthouse/locales/te.json +157 -142
- package/front_end/third_party/lighthouse/locales/th.json +111 -96
- package/front_end/third_party/lighthouse/locales/tr.json +153 -138
- package/front_end/third_party/lighthouse/locales/uk.json +149 -134
- package/front_end/third_party/lighthouse/locales/vi.json +162 -147
- package/front_end/third_party/lighthouse/locales/zh-HK.json +150 -135
- package/front_end/third_party/lighthouse/locales/zh-TW.json +154 -139
- package/front_end/third_party/lighthouse/locales/zh.json +152 -137
- package/front_end/third_party/lighthouse/report/bundle.d.ts +9 -8
- package/front_end/third_party/lighthouse/report/bundle.js +10 -10
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +2 -7
- package/front_end/tsconfig.compatibility.json +1 -0
- package/front_end/tsconfig.json +3 -2
- package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +0 -2
- package/front_end/ui/components/dialogs/typeToAllowDialog.css +0 -4
- package/front_end/ui/components/icon_button/fileSourceIcon.css +1 -1
- package/front_end/ui/components/input/textInput.css +1 -1
- package/front_end/ui/components/lists/List.ts +26 -14
- package/front_end/ui/components/menus/menus.ts +0 -2
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +351 -138
- package/front_end/ui/components/survey_link/surveyLink.css +3 -3
- package/front_end/ui/components/switch/switch.css +6 -6
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +2 -3
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +53 -4
- package/front_end/ui/components/tree_outline/treeOutline.css +7 -7
- package/front_end/ui/helpers/OpenInNewTab.ts +8 -3
- package/front_end/ui/legacy/EmptyWidget.ts +4 -4
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +1 -1
- package/front_end/ui/legacy/KeyboardShortcut.ts +7 -7
- package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +2 -2
- package/front_end/ui/legacy/TabbedPane.ts +198 -66
- package/front_end/ui/legacy/TargetCrashedScreen.ts +2 -2
- package/front_end/ui/legacy/UIUtils.ts +71 -68
- package/front_end/ui/legacy/View.ts +7 -4
- package/front_end/ui/legacy/ViewManager.ts +49 -37
- package/front_end/ui/legacy/Widget.ts +32 -12
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +2 -3
- package/front_end/ui/legacy/components/inline_editor/AnimationTimingUI.ts +8 -8
- package/front_end/ui/legacy/components/inline_editor/BezierUI.ts +8 -9
- package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +2 -2
- package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +45 -11
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +10 -12
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +102 -29
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +148 -122
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +20 -14
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +1 -1
- package/front_end/ui/legacy/components/source_frame/FontView.ts +29 -5
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +79 -12
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +20 -2
- package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +2 -2
- package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +6 -10
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +11 -11
- package/front_end/ui/legacy/components/source_frame/fontView.css +7 -0
- package/front_end/ui/legacy/components/source_frame/imageView.css +7 -0
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +14 -3
- package/front_end/ui/legacy/components/utils/Linkifier.ts +126 -2
- package/front_end/ui/legacy/emptyWidget.css +2 -1
- package/front_end/ui/legacy/inspectorCommon.css +3 -3
- package/front_end/ui/legacy/smallBubble.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -0
- package/front_end/ui/lit/Directives.ts +35 -18
- package/front_end/ui/lit/lit.ts +0 -2
- package/front_end/ui/lit/render.ts +0 -7
- package/front_end/ui/visual_logging/KnownContextValues.ts +5 -0
- package/package.json +1 -1
- package/vpython.toml +8 -0
- package/vpython.toml.uv.lock +3 -0
- package/.agents/skills/review-models-core/SKILL.md +0 -73
- package/.agents/skills/review-tests/SKILL.md +0 -67
- package/.agents/skills/review-ui-widgets/SKILL.md +0 -115
- package/front_end/generated/ARIAProperties.ts +0 -2686
- package/front_end/ui/components/menus/README.md +0 -119
- package/front_end/ui/components/menus/SelectMenu.ts +0 -473
- package/front_end/ui/components/menus/selectMenu.css +0 -54
- package/front_end/ui/components/menus/selectMenuButton.css +0 -108
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
// Copyright 2015 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
5
|
+
import '../../../ui/components/lists/lists.js';
|
|
6
6
|
import '../../../ui/kit/kit.js';
|
|
7
7
|
|
|
8
8
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
9
|
+
import * as Platform from '../../../core/platform/platform.js';
|
|
9
10
|
import * as Root from '../../../core/root/root.js';
|
|
11
|
+
import type * as Protocol from '../../../generated/protocol.js';
|
|
10
12
|
import * as EmulationModel from '../../../models/emulation/emulation.js';
|
|
11
|
-
import
|
|
13
|
+
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
14
|
+
import * as Input from '../../../ui/components/input/input.js';
|
|
15
|
+
import type * as Lists from '../../../ui/components/lists/lists.js';
|
|
12
16
|
import * as UI from '../../../ui/legacy/legacy.js';
|
|
17
|
+
import {Directives, html, type LitTemplate, nothing, render} from '../../../ui/lit/lit.js';
|
|
13
18
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
14
19
|
|
|
15
20
|
import * as EmulationComponents from './components/components.js';
|
|
16
21
|
import devicesSettingsTabStyles from './devicesSettingsTab.css.js';
|
|
17
22
|
|
|
23
|
+
const {classMap, ifDefined, live, ref} = Directives;
|
|
24
|
+
const {widget} = UI.Widget;
|
|
25
|
+
|
|
18
26
|
const UIStrings = {
|
|
19
27
|
/**
|
|
20
28
|
* @description Title for a section of the UI that shows all of the custom devices the user can emulate, in the device toolbar.
|
|
@@ -208,6 +216,18 @@ const UIStrings = {
|
|
|
208
216
|
* @description Error message shown when a circular display cutout is outside its cutout bounds.
|
|
209
217
|
*/
|
|
210
218
|
circleMustFitCutoutBounds: 'Circle must fit within the cutout bounds',
|
|
219
|
+
/**
|
|
220
|
+
* @description Button text to cancel editing a custom device in the Devices settings tab.
|
|
221
|
+
*/
|
|
222
|
+
cancel: 'Cancel',
|
|
223
|
+
/**
|
|
224
|
+
* @description Button text to save changes when editing a custom device in the Devices settings tab.
|
|
225
|
+
*/
|
|
226
|
+
save: 'Save',
|
|
227
|
+
/**
|
|
228
|
+
* @description Button text to add a new custom device in the Devices settings tab.
|
|
229
|
+
*/
|
|
230
|
+
add: 'Add',
|
|
211
231
|
} as const;
|
|
212
232
|
const str_ = i18n.i18n.registerUIStrings('panels/settings/emulation/DevicesSettingsTab.ts', UIStrings);
|
|
213
233
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -230,146 +250,622 @@ function parseOptionalNonNegativeInteger(value: string): number|null {
|
|
|
230
250
|
|
|
231
251
|
const NO_CUSTOM_CUTOUT = 'none';
|
|
232
252
|
|
|
233
|
-
type
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
253
|
+
export type EditorFieldName =
|
|
254
|
+
|'title'|'width'|'height'|'scale'|'user-agent'|'ua-type'|'safe-area-left'|'safe-area-top'|'safe-area-right'|
|
|
255
|
+
'safe-area-bottom'|'landscape-safe-area-left'|'landscape-safe-area-top'|'landscape-safe-area-right'|
|
|
256
|
+
'landscape-safe-area-bottom'|'cutout-shape'|'cutout-x'|'cutout-y'|'cutout-width'|'cutout-height'|
|
|
257
|
+
'cutout-border-radius'|'cutout-upper-radius'|'cutout-lower-radius'|'cutout-cx'|'cutout-cy'|'cutout-radius';
|
|
258
|
+
|
|
259
|
+
export type EditorValues = Record<EditorFieldName, string>;
|
|
260
|
+
|
|
261
|
+
const EMPTY_EDITOR_VALUES: EditorValues = {
|
|
262
|
+
title: '',
|
|
263
|
+
width: '',
|
|
264
|
+
height: '',
|
|
265
|
+
scale: '',
|
|
266
|
+
'user-agent': '',
|
|
267
|
+
'ua-type': EmulationModel.DeviceModeModel.UA.MOBILE,
|
|
268
|
+
'safe-area-left': '',
|
|
269
|
+
'safe-area-top': '',
|
|
270
|
+
'safe-area-right': '',
|
|
271
|
+
'safe-area-bottom': '',
|
|
272
|
+
'landscape-safe-area-left': '',
|
|
273
|
+
'landscape-safe-area-top': '',
|
|
274
|
+
'landscape-safe-area-right': '',
|
|
275
|
+
'landscape-safe-area-bottom': '',
|
|
276
|
+
'cutout-shape': NO_CUSTOM_CUTOUT,
|
|
277
|
+
'cutout-x': '',
|
|
278
|
+
'cutout-y': '',
|
|
279
|
+
'cutout-width': '',
|
|
280
|
+
'cutout-height': '',
|
|
281
|
+
'cutout-border-radius': '',
|
|
282
|
+
'cutout-upper-radius': '',
|
|
283
|
+
'cutout-lower-radius': '',
|
|
284
|
+
'cutout-cx': '',
|
|
285
|
+
'cutout-cy': '',
|
|
286
|
+
'cutout-radius': '',
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export interface DeviceGroupViewInput {
|
|
290
|
+
title: string;
|
|
291
|
+
hidden: boolean;
|
|
292
|
+
devices: EmulationModel.EmulatedDevices.EmulatedDevice[];
|
|
248
293
|
}
|
|
249
294
|
|
|
250
|
-
export
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
private editor?: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>;
|
|
263
|
-
readonly #userAgentClientHintsForm = new EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm();
|
|
264
|
-
|
|
265
|
-
constructor() {
|
|
266
|
-
super({jslog: `${VisualLogging.pane('devices')}`});
|
|
267
|
-
this.registerRequiredCSS(devicesSettingsTabStyles);
|
|
268
|
-
|
|
269
|
-
this.containerElement =
|
|
270
|
-
this.contentElement.createChild('div', 'settings-card-container-wrapper').createChild('div');
|
|
271
|
-
this.containerElement.classList.add('settings-card-container', 'ignore-list-settings');
|
|
272
|
-
|
|
273
|
-
this.muteUpdate = false;
|
|
274
|
-
this.emulatedDevicesList = EmulationModel.EmulatedDevices.EmulatedDevicesList.instance();
|
|
275
|
-
this.emulatedDevicesList.addEventListener(
|
|
276
|
-
EmulationModel.EmulatedDevices.Events.CUSTOM_DEVICES_UPDATED, this.devicesUpdated, this);
|
|
277
|
-
this.emulatedDevicesList.addEventListener(
|
|
278
|
-
EmulationModel.EmulatedDevices.Events.STANDARD_DEVICES_UPDATED, this.devicesUpdated, this);
|
|
279
|
-
|
|
280
|
-
this.ariaSuccessMessageElement = this.contentElement.createChild('div', 'device-success-message');
|
|
281
|
-
UI.ARIAUtils.markAsPoliteLiveRegion(this.ariaSuccessMessageElement, false);
|
|
282
|
-
|
|
283
|
-
this.addCustomButton = UI.UIUtils.createTextButton(
|
|
284
|
-
i18nString(UIStrings.addCustomDevice), this.addCustomDevice.bind(this), {jslogContext: 'add-custom-device'});
|
|
285
|
-
this.addCustomButton.id = 'custom-device-add-button';
|
|
286
|
-
|
|
287
|
-
const customSettings = document.createElement('div');
|
|
288
|
-
customSettings.classList.add('device-card-content');
|
|
289
|
-
customSettings.appendChild(this.ariaSuccessMessageElement);
|
|
290
|
-
const deviceList = customSettings.createChild('div');
|
|
291
|
-
customSettings.appendChild(this.addCustomButton);
|
|
292
|
-
|
|
293
|
-
const customDevicesCard = this.containerElement.createChild('devtools-card');
|
|
294
|
-
customDevicesCard.heading = i18nString(UIStrings.customDevices);
|
|
295
|
-
customDevicesCard.append(customSettings);
|
|
296
|
-
|
|
297
|
-
this.#customDeviceList = new UI.ListWidget.ListWidget(this, false /* delegatesFocus */);
|
|
298
|
-
this.#customDeviceList.registerRequiredCSS(devicesSettingsTabStyles);
|
|
299
|
-
this.#customDeviceList.element.classList.add('devices-list');
|
|
300
|
-
this.#customDeviceList.show(deviceList);
|
|
301
|
-
|
|
302
|
-
const defaultDevicesCard = this.containerElement.createChild('devtools-card');
|
|
303
|
-
defaultDevicesCard.heading = i18nString(UIStrings.defaultDevices);
|
|
295
|
+
export interface EditorStateViewInput {
|
|
296
|
+
index: number;
|
|
297
|
+
isNew: boolean;
|
|
298
|
+
values: EditorValues;
|
|
299
|
+
showSafeAreaAndCutout: boolean;
|
|
300
|
+
clientHintsValue: EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsFormData;
|
|
301
|
+
invalidFields: ReadonlySet<EditorFieldName>;
|
|
302
|
+
isClientHintsInvalid: boolean;
|
|
303
|
+
errorMessages: readonly string[];
|
|
304
|
+
hasErrors: boolean;
|
|
305
|
+
showValidationErrors: boolean;
|
|
306
|
+
}
|
|
304
307
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
+
export interface ViewInput {
|
|
309
|
+
customDevices: EmulationModel.EmulatedDevices.EmulatedDevice[];
|
|
310
|
+
defaultDeviceGroups: DeviceGroupViewInput[];
|
|
311
|
+
editorState: EditorStateViewInput|null;
|
|
312
|
+
successMessage: string;
|
|
313
|
+
onAddCustomDevice: () => void;
|
|
314
|
+
onToggleDevice: (device: EmulationModel.EmulatedDevices.EmulatedDevice, custom: boolean, show: boolean) => void;
|
|
315
|
+
onBeginEdit: (index: number) => void;
|
|
316
|
+
onRemoveDevice: (index: number) => void;
|
|
317
|
+
onEditorInput: (field: EditorFieldName, value: string) => void;
|
|
318
|
+
onClientHintsChange: (metaData: Protocol.Emulation.UserAgentMetadata) => void;
|
|
319
|
+
onCommitEdit: () => void;
|
|
320
|
+
onCancelEdit: () => void;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface ViewOutput {
|
|
324
|
+
focusAddCustomButton?: () => void;
|
|
325
|
+
focusDeviceNameField?: () => void;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
|
|
329
|
+
|
|
330
|
+
interface DeviceItemViewInput {
|
|
331
|
+
title: string;
|
|
332
|
+
checked: boolean;
|
|
333
|
+
onToggle: (checked: boolean) => void;
|
|
334
|
+
}
|
|
308
335
|
|
|
309
|
-
|
|
310
|
-
|
|
336
|
+
function renderDeviceItem(input: DeviceItemViewInput): LitTemplate {
|
|
337
|
+
// clang-format off
|
|
338
|
+
return html`
|
|
339
|
+
<label class="devices-list-item" tabindex="-1">
|
|
340
|
+
<input
|
|
341
|
+
class="devices-list-checkbox"
|
|
342
|
+
type="checkbox"
|
|
343
|
+
.checked=${live(input.checked)}
|
|
344
|
+
jslog=${VisualLogging.toggle().track({click: true})}
|
|
345
|
+
@click=${(event: Event) => {
|
|
346
|
+
const checkbox = event.currentTarget as HTMLInputElement;
|
|
347
|
+
input.onToggle(checkbox.checked);
|
|
348
|
+
event.consume();
|
|
349
|
+
}}
|
|
350
|
+
/>
|
|
351
|
+
<span class="device-name">${input.title}</span>
|
|
352
|
+
</label>
|
|
353
|
+
`;
|
|
354
|
+
// clang-format on
|
|
355
|
+
}
|
|
311
356
|
|
|
312
|
-
|
|
357
|
+
function renderEditorInput(
|
|
358
|
+
editorState: EditorStateViewInput,
|
|
359
|
+
onEditorInput: (field: EditorFieldName, value: string) => void,
|
|
360
|
+
output: ViewOutput,
|
|
361
|
+
name: EditorFieldName,
|
|
362
|
+
placeholder: string,
|
|
363
|
+
options?: {id?: string, fixedWidth?: boolean, hidden?: boolean},
|
|
364
|
+
): LitTemplate {
|
|
365
|
+
const isInvalid = editorState.showValidationErrors && editorState.invalidFields.has(name);
|
|
366
|
+
// clang-format off
|
|
367
|
+
return html`
|
|
368
|
+
<input
|
|
369
|
+
id=${ifDefined(options?.id)}
|
|
370
|
+
name=${name}
|
|
371
|
+
class=${classMap({
|
|
372
|
+
'harmony-input': true,
|
|
373
|
+
'device-edit-fixed': Boolean(options?.fixedWidth),
|
|
374
|
+
'error-input': isInvalid,
|
|
375
|
+
})}
|
|
376
|
+
type="text"
|
|
377
|
+
placeholder=${placeholder}
|
|
378
|
+
aria-label=${placeholder}
|
|
379
|
+
aria-invalid=${ifDefined(isInvalid ? 'true' : undefined)}
|
|
380
|
+
?hidden=${Boolean(options?.hidden)}
|
|
381
|
+
.value=${editorState.values[name]}
|
|
382
|
+
jslog=${VisualLogging.textField().track({change: true, keydown: 'Enter'}).context(name)}
|
|
383
|
+
@input=${(e: Event) => onEditorInput(name, (e.target as HTMLInputElement).value)}
|
|
384
|
+
${options?.id === 'custom-device-name-field' ? ref(el => {
|
|
385
|
+
if (el instanceof HTMLInputElement) {
|
|
386
|
+
output.focusDeviceNameField = () => el.focus();
|
|
387
|
+
} else {
|
|
388
|
+
output.focusDeviceNameField = undefined;
|
|
389
|
+
}
|
|
390
|
+
}) : nothing}
|
|
391
|
+
/>
|
|
392
|
+
`;
|
|
393
|
+
// clang-format on
|
|
394
|
+
}
|
|
313
395
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
396
|
+
function renderSafeAreaGroup(
|
|
397
|
+
editorState: EditorStateViewInput,
|
|
398
|
+
onEditorInput: (field: EditorFieldName, value: string) => void,
|
|
399
|
+
output: ViewOutput,
|
|
400
|
+
headingId: string,
|
|
401
|
+
title: string,
|
|
402
|
+
prefix: ''|'landscape-',
|
|
403
|
+
): LitTemplate {
|
|
404
|
+
// clang-format off
|
|
405
|
+
return html`
|
|
406
|
+
<div class="devices-edit-safe-area-group" role="group" aria-labelledby=${headingId}>
|
|
407
|
+
<b id=${headingId}>${title}</b>
|
|
408
|
+
<div class="hbox">
|
|
409
|
+
${renderEditorInput(editorState, onEditorInput, output, `${prefix}safe-area-left`, i18nString(UIStrings.safeAreaLeft))}
|
|
410
|
+
${renderEditorInput(editorState, onEditorInput, output, `${prefix}safe-area-top`, i18nString(UIStrings.safeAreaTop))}
|
|
411
|
+
${renderEditorInput(editorState, onEditorInput, output, `${prefix}safe-area-right`, i18nString(UIStrings.safeAreaRight))}
|
|
412
|
+
${renderEditorInput(editorState, onEditorInput, output, `${prefix}safe-area-bottom`, i18nString(UIStrings.safeAreaBottom))}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
`;
|
|
416
|
+
// clang-format on
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function renderCutoutFields(
|
|
420
|
+
editorState: EditorStateViewInput,
|
|
421
|
+
onEditorInput: (field: EditorFieldName, value: string) => void,
|
|
422
|
+
output: ViewOutput,
|
|
423
|
+
): LitTemplate {
|
|
424
|
+
const headingId = 'cutout-heading';
|
|
425
|
+
const shape = editorState.values['cutout-shape'];
|
|
426
|
+
const noCutout = shape === NO_CUSTOM_CUTOUT;
|
|
427
|
+
const isPill = shape === EmulationModel.EmulatedDevices.CutoutShape.PILL;
|
|
428
|
+
const isNotch = shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH;
|
|
429
|
+
const isCircle = shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE;
|
|
430
|
+
const rectRowHidden = noCutout;
|
|
431
|
+
const radiusRowHidden = noCutout || !(isPill || isNotch || isCircle);
|
|
432
|
+
const shapeOptions = [
|
|
433
|
+
{value: NO_CUSTOM_CUTOUT, label: i18nString(UIStrings.noDisplayCutout)},
|
|
434
|
+
{value: EmulationModel.EmulatedDevices.CutoutShape.PILL, label: i18nString(UIStrings.pillDisplayCutout)},
|
|
435
|
+
{value: EmulationModel.EmulatedDevices.CutoutShape.NOTCH, label: i18nString(UIStrings.notchDisplayCutout)},
|
|
436
|
+
{value: EmulationModel.EmulatedDevices.CutoutShape.CIRCLE, label: i18nString(UIStrings.circleDisplayCutout)},
|
|
437
|
+
{value: EmulationModel.EmulatedDevices.CutoutShape.RECTANGLE, label: i18nString(UIStrings.rectangleDisplayCutout)},
|
|
438
|
+
];
|
|
439
|
+
// clang-format off
|
|
440
|
+
return html`
|
|
441
|
+
<div class="devices-edit-fields devices-edit-cutout-fields" role="group" aria-labelledby=${headingId}>
|
|
442
|
+
<b id=${headingId}>${i18nString(UIStrings.displayCutout)}</b>
|
|
443
|
+
<div class="hbox">
|
|
444
|
+
<select
|
|
445
|
+
name="cutout-shape"
|
|
446
|
+
title=${i18nString(UIStrings.displayCutout)}
|
|
447
|
+
aria-label=${i18nString(UIStrings.displayCutout)}
|
|
448
|
+
.value=${shape}
|
|
449
|
+
jslog=${VisualLogging.dropDown().track({change: true}).context('cutout-shape')}
|
|
450
|
+
@input=${(e: Event) => onEditorInput('cutout-shape', (e.target as HTMLSelectElement).value)}
|
|
451
|
+
@change=${(e: Event) => onEditorInput('cutout-shape', (e.target as HTMLSelectElement).value)}>
|
|
452
|
+
${shapeOptions.map(option => html`
|
|
453
|
+
<option
|
|
454
|
+
value=${option.value}
|
|
455
|
+
.selected=${shape === option.value}
|
|
456
|
+
jslog=${VisualLogging.item(Platform.StringUtilities.toKebabCase(option.value)).track({click: true})}>
|
|
457
|
+
${option.label}
|
|
458
|
+
</option>
|
|
459
|
+
`)}
|
|
460
|
+
</select>
|
|
461
|
+
</div>
|
|
462
|
+
<div class="hbox devices-edit-cutout-rect-row" ?hidden=${rectRowHidden}>
|
|
463
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-x', i18nString(UIStrings.cutoutX))}
|
|
464
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-y', i18nString(UIStrings.cutoutY))}
|
|
465
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-width', i18nString(UIStrings.cutoutWidth))}
|
|
466
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-height', i18nString(UIStrings.cutoutHeight))}
|
|
467
|
+
</div>
|
|
468
|
+
<div class="hbox devices-edit-cutout-radius-row" ?hidden=${radiusRowHidden}>
|
|
469
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-border-radius', i18nString(UIStrings.cutoutBorderRadius), {hidden: !isPill})}
|
|
470
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-upper-radius', i18nString(UIStrings.cutoutUpperRadius), {hidden: !isNotch})}
|
|
471
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-lower-radius', i18nString(UIStrings.cutoutLowerRadius), {hidden: !isNotch})}
|
|
472
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-cx', i18nString(UIStrings.cutoutCenterX), {hidden: !isCircle})}
|
|
473
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-cy', i18nString(UIStrings.cutoutCenterY), {hidden: !isCircle})}
|
|
474
|
+
${renderEditorInput(editorState, onEditorInput, output, 'cutout-radius', i18nString(UIStrings.cutoutRadius), {hidden: !isCircle})}
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
`;
|
|
478
|
+
// clang-format on
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const EMPTY_EDITOR_STATE: EditorStateViewInput = {
|
|
482
|
+
index: 0,
|
|
483
|
+
isNew: false,
|
|
484
|
+
values: EMPTY_EDITOR_VALUES,
|
|
485
|
+
showSafeAreaAndCutout: false,
|
|
486
|
+
clientHintsValue: {},
|
|
487
|
+
invalidFields: new Set(),
|
|
488
|
+
isClientHintsInvalid: false,
|
|
489
|
+
errorMessages: [],
|
|
490
|
+
hasErrors: false,
|
|
491
|
+
showValidationErrors: false,
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
function renderEditor(input: ViewInput, output: ViewOutput): LitTemplate {
|
|
495
|
+
const editorState = input.editorState ?? EMPTY_EDITOR_STATE;
|
|
496
|
+
const uaTypeOptions = [
|
|
497
|
+
EmulationModel.DeviceModeModel.UA.MOBILE,
|
|
498
|
+
EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH,
|
|
499
|
+
EmulationModel.DeviceModeModel.UA.DESKTOP,
|
|
500
|
+
EmulationModel.DeviceModeModel.UA.DESKTOP_TOUCH,
|
|
501
|
+
];
|
|
502
|
+
const uaType = editorState.values['ua-type'];
|
|
503
|
+
|
|
504
|
+
// clang-format off
|
|
505
|
+
return html`
|
|
506
|
+
<div
|
|
507
|
+
class="editor-container"
|
|
508
|
+
?hidden=${!input.editorState}
|
|
509
|
+
jslog=${VisualLogging.pane('editor').track({resize: true})}
|
|
510
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
511
|
+
if (Platform.KeyboardUtilities.isEscKey(e)) {
|
|
512
|
+
e.consume(true);
|
|
513
|
+
input.onCancelEdit();
|
|
514
|
+
}
|
|
515
|
+
}}>
|
|
516
|
+
<div
|
|
517
|
+
class="editor-content"
|
|
518
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
519
|
+
if (e.key === 'Enter' && !e.isComposing && !(e.target instanceof HTMLSelectElement)) {
|
|
520
|
+
e.consume(true);
|
|
521
|
+
if (!editorState.hasErrors) {
|
|
522
|
+
input.onCommitEdit();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}}>
|
|
526
|
+
<div class="devices-edit-fields">
|
|
527
|
+
<b>${i18nString(UIStrings.device)}</b>
|
|
528
|
+
<div class="hbox">
|
|
529
|
+
${renderEditorInput(editorState, input.onEditorInput, output, 'title', i18nString(UIStrings.deviceName), {
|
|
530
|
+
id: 'custom-device-name-field',
|
|
531
|
+
})}
|
|
532
|
+
</div>
|
|
533
|
+
<div class="hbox">
|
|
534
|
+
${renderEditorInput(editorState, input.onEditorInput, output, 'width', i18nString(UIStrings.width))}
|
|
535
|
+
${renderEditorInput(editorState, input.onEditorInput, output, 'height', i18nString(UIStrings.height))}
|
|
536
|
+
${renderEditorInput(editorState, input.onEditorInput, output, 'scale', i18nString(UIStrings.devicePixelRatio), {
|
|
537
|
+
fixedWidth: true,
|
|
538
|
+
})}
|
|
539
|
+
</div>
|
|
540
|
+
${editorState.showSafeAreaAndCutout ? html`
|
|
541
|
+
${renderSafeAreaGroup(editorState, input.onEditorInput, output, 'portrait-safe-area-heading', i18nString(UIStrings.portraitSafeArea), '')}
|
|
542
|
+
${renderSafeAreaGroup(editorState, input.onEditorInput, output, 'landscape-safe-area-heading', i18nString(UIStrings.landscapeSafeArea), 'landscape-')}
|
|
543
|
+
` : nothing}
|
|
544
|
+
</div>
|
|
545
|
+
${editorState.showSafeAreaAndCutout
|
|
546
|
+
? renderCutoutFields(editorState, input.onEditorInput, output)
|
|
547
|
+
: nothing}
|
|
548
|
+
<div class="devices-edit-fields">
|
|
549
|
+
<b>${i18nString(UIStrings.userAgentString)}</b>
|
|
550
|
+
<div class="hbox">
|
|
551
|
+
${renderEditorInput(editorState, input.onEditorInput, output, 'user-agent', i18nString(UIStrings.userAgentString))}
|
|
552
|
+
<select
|
|
553
|
+
name="ua-type"
|
|
554
|
+
class="device-edit-fixed"
|
|
555
|
+
title=${i18nString(UIStrings.userAgentType)}
|
|
556
|
+
aria-label=${i18nString(UIStrings.userAgentType)}
|
|
557
|
+
.value=${uaType}
|
|
558
|
+
jslog=${VisualLogging.dropDown().track({change: true}).context('ua-type')}
|
|
559
|
+
@input=${(e: Event) => input.onEditorInput('ua-type', (e.target as HTMLSelectElement).value)}
|
|
560
|
+
@change=${(e: Event) => input.onEditorInput('ua-type', (e.target as HTMLSelectElement).value)}>
|
|
561
|
+
${uaTypeOptions.map(option => html`
|
|
562
|
+
<option
|
|
563
|
+
value=${option}
|
|
564
|
+
.selected=${uaType === option}
|
|
565
|
+
jslog=${VisualLogging.item(Platform.StringUtilities.toKebabCase(option)).track({click: true})}>
|
|
566
|
+
${option}
|
|
567
|
+
</option>
|
|
568
|
+
`)}
|
|
569
|
+
</select>
|
|
570
|
+
</div>
|
|
571
|
+
</div>
|
|
572
|
+
<devtools-widget
|
|
573
|
+
class=${classMap({
|
|
574
|
+
'error-input': editorState.showValidationErrors && editorState.isClientHintsInvalid,
|
|
575
|
+
})}
|
|
576
|
+
aria-invalid=${ifDefined(editorState.showValidationErrors && editorState.isClientHintsInvalid ? 'true' : undefined)}
|
|
577
|
+
${widget(EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm, {
|
|
578
|
+
value: editorState.clientHintsValue,
|
|
579
|
+
})}
|
|
580
|
+
@clienthintschange=${(e: CustomEvent<Protocol.Emulation.UserAgentMetadata>) => input.onClientHintsChange(e.detail)}>
|
|
581
|
+
</devtools-widget>
|
|
582
|
+
</div>
|
|
583
|
+
<div class="editor-buttons">
|
|
584
|
+
<devtools-button
|
|
585
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
586
|
+
.jslogContext=${'cancel'}
|
|
587
|
+
jslog=${VisualLogging.action('cancel').track({click: true})}
|
|
588
|
+
@click=${input.onCancelEdit}>
|
|
589
|
+
${i18nString(UIStrings.cancel)}
|
|
590
|
+
</devtools-button>
|
|
591
|
+
<devtools-button
|
|
592
|
+
.variant=${Buttons.Button.Variant.PRIMARY}
|
|
593
|
+
.jslogContext=${'commit'}
|
|
594
|
+
.disabled=${editorState.hasErrors}
|
|
595
|
+
@click=${() => {
|
|
596
|
+
if (!editorState.hasErrors) {
|
|
597
|
+
input.onCommitEdit();
|
|
598
|
+
}
|
|
599
|
+
}}>
|
|
600
|
+
${editorState.isNew ? i18nString(UIStrings.add) : i18nString(UIStrings.save)}
|
|
601
|
+
</devtools-button>
|
|
602
|
+
</div>
|
|
603
|
+
<div class="list-widget-input-validation-error" role="alert" aria-live="polite">
|
|
604
|
+
${editorState.showValidationErrors && editorState.errorMessages.length > 0
|
|
605
|
+
? html`<span>${editorState.errorMessages.map((msg, i) => html`${i > 0 ? html`<br>` : nothing}${msg}`)}</span>`
|
|
606
|
+
: nothing}
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
`;
|
|
610
|
+
// clang-format on
|
|
611
|
+
}
|
|
318
612
|
|
|
319
|
-
|
|
613
|
+
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
614
|
+
const editingIndex = input.editorState?.index ?? null;
|
|
615
|
+
const customBefore = editingIndex !== null ? input.customDevices.slice(0, editingIndex) : input.customDevices;
|
|
616
|
+
const customAfter = editingIndex !== null ? input.customDevices.slice(editingIndex + 1) : [];
|
|
617
|
+
|
|
618
|
+
// clang-format off
|
|
619
|
+
render(html`
|
|
620
|
+
<style>${Input.checkboxStyles}</style>
|
|
621
|
+
<style>${devicesSettingsTabStyles}</style>
|
|
622
|
+
<div class="settings-card-container-wrapper">
|
|
623
|
+
<div class="settings-card-container ignore-list-settings">
|
|
624
|
+
<devtools-card heading=${i18nString(UIStrings.customDevices)}>
|
|
625
|
+
<div class="device-card-content">
|
|
626
|
+
<div
|
|
627
|
+
class="device-success-message"
|
|
628
|
+
aria-live="polite"
|
|
629
|
+
aria-atomic="false"
|
|
630
|
+
aria-label=${input.successMessage}
|
|
631
|
+
></div>
|
|
632
|
+
<div>
|
|
633
|
+
${customBefore.length > 0 ? html`
|
|
634
|
+
<devtools-list
|
|
635
|
+
class="devices-list"
|
|
636
|
+
.editable=${true}
|
|
637
|
+
.deletable=${true}
|
|
638
|
+
@edit=${(e: Lists.List.ItemEditEvent) => input.onBeginEdit(e.detail.index)}
|
|
639
|
+
@delete=${(e: Lists.List.ItemRemoveEvent) => input.onRemoveDevice(e.detail.index)}>
|
|
640
|
+
${customBefore.map(device => renderDeviceItem({
|
|
641
|
+
title: device.title,
|
|
642
|
+
checked: device.show(),
|
|
643
|
+
onToggle: checked => input.onToggleDevice(device, true, checked),
|
|
644
|
+
}))}
|
|
645
|
+
</devtools-list>
|
|
646
|
+
` : nothing}
|
|
647
|
+
${renderEditor(input, output)}
|
|
648
|
+
${editingIndex !== null && customAfter.length > 0 ? html`
|
|
649
|
+
<devtools-list
|
|
650
|
+
class="devices-list"
|
|
651
|
+
.editable=${true}
|
|
652
|
+
.deletable=${true}
|
|
653
|
+
@edit=${(e: Lists.List.ItemEditEvent) => input.onBeginEdit(editingIndex + 1 + e.detail.index)}
|
|
654
|
+
@delete=${(e: Lists.List.ItemRemoveEvent) => input.onRemoveDevice(editingIndex + 1 + e.detail.index)}>
|
|
655
|
+
${customAfter.map(device => renderDeviceItem({
|
|
656
|
+
title: device.title,
|
|
657
|
+
checked: device.show(),
|
|
658
|
+
onToggle: checked => input.onToggleDevice(device, true, checked),
|
|
659
|
+
}))}
|
|
660
|
+
</devtools-list>
|
|
661
|
+
` : nothing}
|
|
662
|
+
</div>
|
|
663
|
+
<devtools-button
|
|
664
|
+
id="custom-device-add-button"
|
|
665
|
+
?hidden=${Boolean(input.editorState)}
|
|
666
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
667
|
+
.jslogContext=${'add-custom-device'}
|
|
668
|
+
@click=${input.onAddCustomDevice}
|
|
669
|
+
${ref(el => {
|
|
670
|
+
if (el instanceof HTMLElement) {
|
|
671
|
+
output.focusAddCustomButton = () => {
|
|
672
|
+
el.scrollIntoViewIfNeeded();
|
|
673
|
+
el.focus();
|
|
674
|
+
};
|
|
675
|
+
} else {
|
|
676
|
+
output.focusAddCustomButton = undefined;
|
|
677
|
+
}
|
|
678
|
+
})}
|
|
679
|
+
>${i18nString(UIStrings.addCustomDevice)}</devtools-button>
|
|
680
|
+
</div>
|
|
681
|
+
</devtools-card>
|
|
682
|
+
<devtools-card heading=${i18nString(UIStrings.defaultDevices)}>
|
|
683
|
+
${input.defaultDeviceGroups.map(group => html`
|
|
684
|
+
<div class="device-group-container" ?hidden=${group.hidden}>
|
|
685
|
+
<div class="device-group-title">${group.title}</div>
|
|
686
|
+
<devtools-list class="devices-list device-card-content" .disableListItemFocus=${true}>
|
|
687
|
+
${group.devices.map(device => renderDeviceItem({
|
|
688
|
+
title: device.title,
|
|
689
|
+
checked: device.show(),
|
|
690
|
+
onToggle: checked => input.onToggleDevice(device, false, checked),
|
|
691
|
+
}))}
|
|
692
|
+
</devtools-list>
|
|
693
|
+
</div>
|
|
694
|
+
`)}
|
|
695
|
+
</devtools-card>
|
|
696
|
+
</div>
|
|
697
|
+
</div>
|
|
698
|
+
`, target, {
|
|
699
|
+
container: {
|
|
700
|
+
attributes: {
|
|
701
|
+
jslog: `${VisualLogging.pane('devices')}`,
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
});
|
|
705
|
+
// clang-format on
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
const FIELD_LABELS: Partial<Record<EditorFieldName, () => string>> = {
|
|
709
|
+
'safe-area-left': () => i18nString(UIStrings.safeAreaLeft),
|
|
710
|
+
'safe-area-top': () => i18nString(UIStrings.safeAreaTop),
|
|
711
|
+
'safe-area-right': () => i18nString(UIStrings.safeAreaRight),
|
|
712
|
+
'safe-area-bottom': () => i18nString(UIStrings.safeAreaBottom),
|
|
713
|
+
'landscape-safe-area-left': () => i18nString(UIStrings.safeAreaLeft),
|
|
714
|
+
'landscape-safe-area-top': () => i18nString(UIStrings.safeAreaTop),
|
|
715
|
+
'landscape-safe-area-right': () => i18nString(UIStrings.safeAreaRight),
|
|
716
|
+
'landscape-safe-area-bottom': () => i18nString(UIStrings.safeAreaBottom),
|
|
717
|
+
'cutout-x': () => i18nString(UIStrings.cutoutX),
|
|
718
|
+
'cutout-y': () => i18nString(UIStrings.cutoutY),
|
|
719
|
+
'cutout-width': () => i18nString(UIStrings.cutoutWidth),
|
|
720
|
+
'cutout-height': () => i18nString(UIStrings.cutoutHeight),
|
|
721
|
+
'cutout-border-radius': () => i18nString(UIStrings.cutoutBorderRadius),
|
|
722
|
+
'cutout-upper-radius': () => i18nString(UIStrings.cutoutUpperRadius),
|
|
723
|
+
'cutout-lower-radius': () => i18nString(UIStrings.cutoutLowerRadius),
|
|
724
|
+
'cutout-cx': () => i18nString(UIStrings.cutoutCenterX),
|
|
725
|
+
'cutout-cy': () => i18nString(UIStrings.cutoutCenterY),
|
|
726
|
+
'cutout-radius': () => i18nString(UIStrings.cutoutRadius),
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
export class DevicesSettingsTab extends UI.Widget.VBox {
|
|
730
|
+
readonly #view: View;
|
|
731
|
+
readonly #viewOutput: ViewOutput = {};
|
|
732
|
+
#successMessage = '';
|
|
733
|
+
#customDevices: EmulationModel.EmulatedDevices.EmulatedDevice[] = [];
|
|
734
|
+
readonly #defaultDeviceLists = new Map<EmulationModel.EmulatedDevices.Category, DeviceGroupViewInput>();
|
|
735
|
+
#muteUpdate = false;
|
|
736
|
+
readonly #emulatedDevicesList: EmulationModel.EmulatedDevices.EmulatedDevicesList;
|
|
737
|
+
#editingDevice: EmulationModel.EmulatedDevices.EmulatedDevice|null = null;
|
|
738
|
+
#editingIndex: number|null = null;
|
|
739
|
+
#isNewDevice = false;
|
|
740
|
+
#editorValues: EditorValues = {...EMPTY_EDITOR_VALUES};
|
|
741
|
+
#clientHintsValue: EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsFormData = {};
|
|
742
|
+
#clientHintsMetaData?: Protocol.Emulation.UserAgentMetadata;
|
|
743
|
+
#showValidationErrors = false;
|
|
744
|
+
|
|
745
|
+
readonly #onAddCustomDeviceBound = this.#addCustomDevice.bind(this);
|
|
746
|
+
readonly #onToggleDeviceBound = this.#onToggleDevice.bind(this);
|
|
747
|
+
readonly #onBeginEditBound = this.#onBeginEditByIndex.bind(this);
|
|
748
|
+
readonly #onRemoveDeviceBound = this.#onRemoveDevice.bind(this);
|
|
749
|
+
readonly #onEditorInputBound = this.#onEditorInput.bind(this);
|
|
750
|
+
readonly #onClientHintsChangeBound = this.#onClientHintsChange.bind(this);
|
|
751
|
+
readonly #onCommitEditBound = this.commitEdit.bind(this);
|
|
752
|
+
readonly #onCancelEditBound = this.#cancelEdit.bind(this);
|
|
753
|
+
|
|
754
|
+
constructor(view: View = DEFAULT_VIEW) {
|
|
755
|
+
super();
|
|
756
|
+
this.#view = view;
|
|
757
|
+
|
|
758
|
+
this.#emulatedDevicesList = EmulationModel.EmulatedDevices.EmulatedDevicesList.instance();
|
|
759
|
+
|
|
760
|
+
for (const category of EmulationModel.EmulatedDevices.CATEGORY_ORDER) {
|
|
761
|
+
this.#defaultDeviceLists.set(category, {
|
|
762
|
+
title: EmulationModel.EmulatedDevices.getCategoryTitle(category),
|
|
763
|
+
hidden: false,
|
|
764
|
+
devices: [],
|
|
765
|
+
});
|
|
320
766
|
}
|
|
767
|
+
this.#devicesUpdated();
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
override performUpdate(): void {
|
|
771
|
+
let editorState: EditorStateViewInput|null = null;
|
|
772
|
+
if (this.#editingDevice !== null && this.#editingIndex !== null) {
|
|
773
|
+
const showSafeAreaAndCutout = Boolean(Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled);
|
|
774
|
+
const validation = this.#validateEditor(showSafeAreaAndCutout);
|
|
775
|
+
editorState = {
|
|
776
|
+
index: this.#editingIndex,
|
|
777
|
+
isNew: this.#isNewDevice,
|
|
778
|
+
values: this.#editorValues,
|
|
779
|
+
showSafeAreaAndCutout,
|
|
780
|
+
clientHintsValue: this.#clientHintsValue,
|
|
781
|
+
invalidFields: validation.invalidFields,
|
|
782
|
+
isClientHintsInvalid: validation.isClientHintsInvalid,
|
|
783
|
+
errorMessages: validation.errorMessages,
|
|
784
|
+
hasErrors: validation.hasErrors,
|
|
785
|
+
showValidationErrors: this.#showValidationErrors,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const viewInput: ViewInput = {
|
|
790
|
+
customDevices: this.#customDevices,
|
|
791
|
+
defaultDeviceGroups: [...this.#defaultDeviceLists.values()],
|
|
792
|
+
editorState,
|
|
793
|
+
successMessage: this.#successMessage,
|
|
794
|
+
onAddCustomDevice: this.#onAddCustomDeviceBound,
|
|
795
|
+
onToggleDevice: this.#onToggleDeviceBound,
|
|
796
|
+
onBeginEdit: this.#onBeginEditBound,
|
|
797
|
+
onRemoveDevice: this.#onRemoveDeviceBound,
|
|
798
|
+
onEditorInput: this.#onEditorInputBound,
|
|
799
|
+
onClientHintsChange: this.#onClientHintsChangeBound,
|
|
800
|
+
onCommitEdit: this.#onCommitEditBound,
|
|
801
|
+
onCancelEdit: this.#onCancelEditBound,
|
|
802
|
+
};
|
|
803
|
+
this.#view(viewInput, this.#viewOutput, this.contentElement);
|
|
321
804
|
}
|
|
322
805
|
|
|
323
806
|
override wasShown(): void {
|
|
324
807
|
super.wasShown();
|
|
325
|
-
this.
|
|
808
|
+
this.#emulatedDevicesList.addEventListener(EmulationModel.EmulatedDevices.Events.CUSTOM_DEVICES_UPDATED,
|
|
809
|
+
this.#devicesUpdated, this);
|
|
810
|
+
this.#emulatedDevicesList.addEventListener(EmulationModel.EmulatedDevices.Events.STANDARD_DEVICES_UPDATED,
|
|
811
|
+
this.#devicesUpdated, this);
|
|
812
|
+
this.#devicesUpdated();
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
override willHide(): void {
|
|
816
|
+
super.willHide();
|
|
817
|
+
this.#emulatedDevicesList.removeEventListener(EmulationModel.EmulatedDevices.Events.CUSTOM_DEVICES_UPDATED,
|
|
818
|
+
this.#devicesUpdated, this);
|
|
819
|
+
this.#emulatedDevicesList.removeEventListener(EmulationModel.EmulatedDevices.Events.STANDARD_DEVICES_UPDATED,
|
|
820
|
+
this.#devicesUpdated, this);
|
|
326
821
|
}
|
|
327
822
|
|
|
328
|
-
|
|
329
|
-
if (this
|
|
823
|
+
#devicesUpdated(): void {
|
|
824
|
+
if (this.#muteUpdate) {
|
|
330
825
|
return;
|
|
331
826
|
}
|
|
332
827
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
this.#customDeviceList.clear();
|
|
828
|
+
this.#customDevices = this.#emulatedDevicesList.custom().slice();
|
|
829
|
+
this.#cancelEdit();
|
|
337
830
|
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
this.#customDeviceList.appendItem(customDevices[i], true);
|
|
831
|
+
for (const group of this.#defaultDeviceLists.values()) {
|
|
832
|
+
group.devices = [];
|
|
341
833
|
}
|
|
342
834
|
|
|
343
|
-
const standardDevices = this
|
|
835
|
+
const standardDevices = this.#emulatedDevicesList.standard().slice();
|
|
344
836
|
standardDevices.sort(EmulationModel.EmulatedDevices.EmulatedDevice.deviceComparator);
|
|
345
837
|
|
|
346
|
-
const categoryItemCounts = new Map<EmulationModel.EmulatedDevices.Category, number>();
|
|
347
838
|
for (const device of standardDevices) {
|
|
348
839
|
const cat = EmulationModel.EmulatedDevices.deviceCategory(device);
|
|
349
840
|
const group = this.#defaultDeviceLists.get(cat);
|
|
350
841
|
if (group) {
|
|
351
|
-
group.
|
|
352
|
-
categoryItemCounts.set(cat, (categoryItemCounts.get(cat) || 0) + 1);
|
|
842
|
+
group.devices.push(device);
|
|
353
843
|
}
|
|
354
844
|
}
|
|
355
845
|
|
|
356
|
-
for (const
|
|
357
|
-
|
|
358
|
-
group.container.style.display = count > 0 ? '' : 'none';
|
|
846
|
+
for (const group of this.#defaultDeviceLists.values()) {
|
|
847
|
+
group.hidden = group.devices.length === 0;
|
|
359
848
|
}
|
|
849
|
+
this.performUpdate();
|
|
360
850
|
}
|
|
361
851
|
|
|
362
|
-
|
|
363
|
-
this
|
|
852
|
+
#muteAndSaveDeviceList(custom: boolean): void {
|
|
853
|
+
this.#muteUpdate = true;
|
|
364
854
|
if (custom) {
|
|
365
|
-
this
|
|
855
|
+
this.#emulatedDevicesList.saveCustomDevices();
|
|
366
856
|
} else {
|
|
367
|
-
this
|
|
857
|
+
this.#emulatedDevicesList.saveStandardDevices();
|
|
368
858
|
}
|
|
369
|
-
this
|
|
859
|
+
this.#muteUpdate = false;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
#onToggleDevice(device: EmulationModel.EmulatedDevices.EmulatedDevice, custom: boolean, show: boolean): void {
|
|
863
|
+
device.setShow(show);
|
|
864
|
+
this.#muteAndSaveDeviceList(custom);
|
|
865
|
+
this.performUpdate();
|
|
370
866
|
}
|
|
371
867
|
|
|
372
|
-
|
|
868
|
+
#addCustomDevice(): void {
|
|
373
869
|
const device = new EmulationModel.EmulatedDevices.EmulatedDevice();
|
|
374
870
|
device.deviceScaleFactor = 0;
|
|
375
871
|
device.horizontal.width = 700;
|
|
@@ -377,75 +873,149 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
377
873
|
device.vertical.width = 400;
|
|
378
874
|
device.vertical.height = 700;
|
|
379
875
|
device.userAgent = navigator.userAgent;
|
|
380
|
-
this
|
|
876
|
+
this.beginEdit(device, this.#customDevices.length, true);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
#onBeginEditByIndex(index: number): void {
|
|
880
|
+
const device = this.#customDevices[index];
|
|
881
|
+
if (device) {
|
|
882
|
+
this.beginEdit(device, index, false);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
#onRemoveDevice(index: number): void {
|
|
887
|
+
const device = this.#customDevices[index];
|
|
888
|
+
if (device) {
|
|
889
|
+
this.#emulatedDevicesList.removeCustomDevice(device);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
#cancelEdit(): void {
|
|
894
|
+
if (this.#editingDevice === null && this.#editingIndex === null) {
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
this.#editingDevice = null;
|
|
898
|
+
this.#editingIndex = null;
|
|
899
|
+
this.#isNewDevice = false;
|
|
900
|
+
this.#editorValues = {...EMPTY_EDITOR_VALUES};
|
|
901
|
+
this.#clientHintsMetaData = undefined;
|
|
902
|
+
this.#clientHintsValue = {};
|
|
903
|
+
this.#showValidationErrors = false;
|
|
904
|
+
this.performUpdate();
|
|
381
905
|
}
|
|
382
906
|
|
|
383
|
-
|
|
907
|
+
#onEditorInput(field: EditorFieldName, value: string): void {
|
|
908
|
+
if (this.#editorValues[field] === value && this.#showValidationErrors) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
this.#editorValues[field] = value;
|
|
912
|
+
this.#showValidationErrors = true;
|
|
913
|
+
this.performUpdate();
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
#onClientHintsChange(metaData: Protocol.Emulation.UserAgentMetadata): void {
|
|
917
|
+
this.#clientHintsMetaData = metaData;
|
|
918
|
+
this.#showValidationErrors = true;
|
|
919
|
+
this.performUpdate();
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
#toNumericInputValue(value: number): string {
|
|
384
923
|
return value ? String(value) : '';
|
|
385
924
|
}
|
|
386
925
|
|
|
387
|
-
|
|
388
|
-
|null {
|
|
926
|
+
#verticalMode(device: EmulationModel.EmulatedDevices.EmulatedDevice): EmulationModel.EmulatedDevices.Mode|null {
|
|
389
927
|
return device.modes.find(mode => mode.orientation === EmulationModel.EmulatedDevices.Vertical) || null;
|
|
390
928
|
}
|
|
391
929
|
|
|
392
|
-
|
|
393
|
-
|null {
|
|
930
|
+
#horizontalMode(device: EmulationModel.EmulatedDevices.EmulatedDevice): EmulationModel.EmulatedDevices.Mode|null {
|
|
394
931
|
return device.modes.find(mode => mode.orientation === EmulationModel.EmulatedDevices.Horizontal) || null;
|
|
395
932
|
}
|
|
396
933
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return parseOptionalNonNegativeInteger(editor.control(controlName).value) ?? 0;
|
|
934
|
+
#editorIntegerValue(controlName: EditorFieldName): number {
|
|
935
|
+
return parseOptionalNonNegativeInteger(this.#editorValues[controlName]) ?? 0;
|
|
400
936
|
}
|
|
401
937
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
function onItemClicked(this: DevicesSettingsTab, event: Event): void {
|
|
417
|
-
const show = checkbox.checked;
|
|
418
|
-
device.setShow(show);
|
|
419
|
-
this.muteAndSaveDeviceList(editable);
|
|
420
|
-
event.consume();
|
|
938
|
+
beginEdit(device: EmulationModel.EmulatedDevices.EmulatedDevice, index = 0, isNew = false): void {
|
|
939
|
+
this.#editingDevice = device;
|
|
940
|
+
this.#editingIndex = index;
|
|
941
|
+
this.#isNewDevice = isNew;
|
|
942
|
+
this.#showValidationErrors = false;
|
|
943
|
+
|
|
944
|
+
let uaType: string;
|
|
945
|
+
if (device.mobile()) {
|
|
946
|
+
uaType =
|
|
947
|
+
device.touch() ? EmulationModel.DeviceModeModel.UA.MOBILE : EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH;
|
|
948
|
+
} else {
|
|
949
|
+
uaType =
|
|
950
|
+
device.touch() ? EmulationModel.DeviceModeModel.UA.DESKTOP_TOUCH : EmulationModel.DeviceModeModel.UA.DESKTOP;
|
|
421
951
|
}
|
|
422
|
-
}
|
|
423
952
|
|
|
424
|
-
|
|
425
|
-
this
|
|
953
|
+
const safeAreaInsets = this.#verticalMode(device)?.safeAreaInsets;
|
|
954
|
+
const landscapeSafeAreaInsets = this.#horizontalMode(device)?.safeAreaInsets;
|
|
955
|
+
const cutout = this.#verticalMode(device)?.cutout;
|
|
956
|
+
|
|
957
|
+
this.#editorValues = {
|
|
958
|
+
title: device.title,
|
|
959
|
+
width: this.#toNumericInputValue(device.vertical.width),
|
|
960
|
+
height: this.#toNumericInputValue(device.vertical.height),
|
|
961
|
+
scale: this.#toNumericInputValue(device.deviceScaleFactor),
|
|
962
|
+
'user-agent': device.userAgent,
|
|
963
|
+
'ua-type': uaType,
|
|
964
|
+
'safe-area-left': this.#toNumericInputValue(safeAreaInsets?.left || 0),
|
|
965
|
+
'safe-area-top': this.#toNumericInputValue(safeAreaInsets?.top || 0),
|
|
966
|
+
'safe-area-right': this.#toNumericInputValue(safeAreaInsets?.right || 0),
|
|
967
|
+
'safe-area-bottom': this.#toNumericInputValue(safeAreaInsets?.bottom || 0),
|
|
968
|
+
'landscape-safe-area-left': this.#toNumericInputValue(landscapeSafeAreaInsets?.left || 0),
|
|
969
|
+
'landscape-safe-area-top': this.#toNumericInputValue(landscapeSafeAreaInsets?.top || 0),
|
|
970
|
+
'landscape-safe-area-right': this.#toNumericInputValue(landscapeSafeAreaInsets?.right || 0),
|
|
971
|
+
'landscape-safe-area-bottom': this.#toNumericInputValue(landscapeSafeAreaInsets?.bottom || 0),
|
|
972
|
+
'cutout-shape': cutout?.shape || NO_CUSTOM_CUTOUT,
|
|
973
|
+
'cutout-x': String(cutout?.x ?? ''),
|
|
974
|
+
'cutout-y': String(cutout?.y ?? ''),
|
|
975
|
+
'cutout-width': String(cutout?.width ?? ''),
|
|
976
|
+
'cutout-height': String(cutout?.height ?? ''),
|
|
977
|
+
'cutout-border-radius':
|
|
978
|
+
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.PILL ? cutout.borderRadius : ''),
|
|
979
|
+
'cutout-upper-radius':
|
|
980
|
+
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.upperRadius : ''),
|
|
981
|
+
'cutout-lower-radius':
|
|
982
|
+
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.lowerRadius : ''),
|
|
983
|
+
'cutout-cx': String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cx : ''),
|
|
984
|
+
'cutout-cy': String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cy : ''),
|
|
985
|
+
'cutout-radius': String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.radius : ''),
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
this.#clientHintsMetaData = device.userAgentMetadata || undefined;
|
|
989
|
+
this.#clientHintsValue = {metaData: this.#clientHintsMetaData};
|
|
990
|
+
this.performUpdate();
|
|
991
|
+
this.#viewOutput.focusDeviceNameField?.();
|
|
426
992
|
}
|
|
427
993
|
|
|
428
|
-
commitEdit(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
994
|
+
commitEdit(): void {
|
|
995
|
+
const device = this.#editingDevice;
|
|
996
|
+
if (!device) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
const isNew = this.#isNewDevice;
|
|
1000
|
+
|
|
1001
|
+
device.title = this.#editorValues.title.trim();
|
|
1002
|
+
device.vertical.width = this.#editorValues.width ? parseInt(this.#editorValues.width, 10) : 0;
|
|
1003
|
+
device.vertical.height = this.#editorValues.height ? parseInt(this.#editorValues.height, 10) : 0;
|
|
434
1004
|
device.horizontal.width = device.vertical.height;
|
|
435
1005
|
device.horizontal.height = device.vertical.width;
|
|
436
|
-
device.deviceScaleFactor =
|
|
437
|
-
device.userAgent =
|
|
1006
|
+
device.deviceScaleFactor = this.#editorValues.scale ? parseFloat(this.#editorValues.scale) : 0;
|
|
1007
|
+
device.userAgent = this.#editorValues['user-agent'];
|
|
438
1008
|
device.modes = [];
|
|
439
1009
|
const verticalMode: EmulationModel.EmulatedDevices.Mode = {
|
|
440
1010
|
title: '',
|
|
441
1011
|
orientation: EmulationModel.EmulatedDevices.Vertical,
|
|
442
1012
|
};
|
|
443
1013
|
if (Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled) {
|
|
444
|
-
const safeAreaInsets = this
|
|
1014
|
+
const safeAreaInsets = this.#safeAreaInsetsFromValues('');
|
|
445
1015
|
if (safeAreaInsets) {
|
|
446
1016
|
verticalMode.safeAreaInsets = safeAreaInsets;
|
|
447
1017
|
}
|
|
448
|
-
const cutout = this
|
|
1018
|
+
const cutout = this.#cutoutFromValues();
|
|
449
1019
|
if (cutout) {
|
|
450
1020
|
verticalMode.cutout = cutout;
|
|
451
1021
|
}
|
|
@@ -456,14 +1026,14 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
456
1026
|
orientation: EmulationModel.EmulatedDevices.Horizontal,
|
|
457
1027
|
};
|
|
458
1028
|
if (Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled) {
|
|
459
|
-
const landscapeSafeAreaInsets = this
|
|
1029
|
+
const landscapeSafeAreaInsets = this.#safeAreaInsetsFromValues('landscape-');
|
|
460
1030
|
if (landscapeSafeAreaInsets) {
|
|
461
1031
|
horizontalMode.safeAreaInsets = landscapeSafeAreaInsets;
|
|
462
1032
|
}
|
|
463
1033
|
}
|
|
464
1034
|
device.modes.push(horizontalMode);
|
|
465
1035
|
device.capabilities = [];
|
|
466
|
-
const uaType =
|
|
1036
|
+
const uaType = this.#editorValues['ua-type'];
|
|
467
1037
|
if (uaType === EmulationModel.DeviceModeModel.UA.MOBILE ||
|
|
468
1038
|
uaType === EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH) {
|
|
469
1039
|
device.capabilities.push(EmulationModel.EmulatedDevices.Capability.MOBILE);
|
|
@@ -472,7 +1042,7 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
472
1042
|
uaType === EmulationModel.DeviceModeModel.UA.DESKTOP_TOUCH) {
|
|
473
1043
|
device.capabilities.push(EmulationModel.EmulatedDevices.Capability.TOUCH);
|
|
474
1044
|
}
|
|
475
|
-
const userAgentControlValue = this.#
|
|
1045
|
+
const userAgentControlValue = this.#clientHintsMetaData;
|
|
476
1046
|
const hasUserAgentOverride = device.userAgent.trim().length > 0;
|
|
477
1047
|
device.userAgentMetadata = null;
|
|
478
1048
|
if (hasUserAgentOverride && userAgentControlValue) {
|
|
@@ -483,84 +1053,65 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
483
1053
|
uaType === EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH),
|
|
484
1054
|
};
|
|
485
1055
|
}
|
|
1056
|
+
|
|
1057
|
+
this.#editingDevice = null;
|
|
1058
|
+
this.#editingIndex = null;
|
|
1059
|
+
this.#isNewDevice = false;
|
|
1060
|
+
this.#editorValues = {...EMPTY_EDITOR_VALUES};
|
|
1061
|
+
this.#clientHintsMetaData = undefined;
|
|
1062
|
+
this.#clientHintsValue = {};
|
|
1063
|
+
this.#showValidationErrors = false;
|
|
1064
|
+
|
|
486
1065
|
if (isNew) {
|
|
487
|
-
this
|
|
1066
|
+
this.#emulatedDevicesList.addCustomDevice(device);
|
|
488
1067
|
} else {
|
|
489
|
-
this
|
|
1068
|
+
this.#emulatedDevicesList.saveCustomDevices();
|
|
490
1069
|
}
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
'aria-label', i18nString(UIStrings.deviceAddedOrUpdated, {PH1: device.title}));
|
|
1070
|
+
this.#successMessage = i18nString(UIStrings.deviceAddedOrUpdated, {PH1: device.title});
|
|
1071
|
+
this.performUpdate();
|
|
1072
|
+
this.#viewOutput.focusAddCustomButton?.();
|
|
495
1073
|
}
|
|
496
1074
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
editor.control('height').value = this.toNumericInputValue(device.vertical.height);
|
|
503
|
-
editor.control('scale').value = this.toNumericInputValue(device.deviceScaleFactor);
|
|
504
|
-
editor.control('user-agent').value = device.userAgent;
|
|
505
|
-
if (Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled) {
|
|
506
|
-
this.populateSafeAreaEditor(editor, device);
|
|
507
|
-
this.populateCutoutEditor(editor, device);
|
|
508
|
-
}
|
|
509
|
-
let uaType;
|
|
510
|
-
if (device.mobile()) {
|
|
511
|
-
uaType =
|
|
512
|
-
device.touch() ? EmulationModel.DeviceModeModel.UA.MOBILE : EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH;
|
|
513
|
-
} else {
|
|
514
|
-
uaType =
|
|
515
|
-
device.touch() ? EmulationModel.DeviceModeModel.UA.DESKTOP_TOUCH : EmulationModel.DeviceModeModel.UA.DESKTOP;
|
|
516
|
-
}
|
|
517
|
-
editor.control('ua-type').value = uaType;
|
|
518
|
-
this.#userAgentClientHintsForm.value = {metaData: device.userAgentMetadata || undefined};
|
|
519
|
-
return editor;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
private safeAreaInsetsFromEditor(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>,
|
|
523
|
-
controlPrefix = ''): EmulationModel.DeviceModeModel.Insets|null {
|
|
524
|
-
const left = this.editorIntegerValue(editor, `${controlPrefix}safe-area-left`);
|
|
525
|
-
const top = this.editorIntegerValue(editor, `${controlPrefix}safe-area-top`);
|
|
526
|
-
const right = this.editorIntegerValue(editor, `${controlPrefix}safe-area-right`);
|
|
527
|
-
const bottom = this.editorIntegerValue(editor, `${controlPrefix}safe-area-bottom`);
|
|
1075
|
+
#safeAreaInsetsFromValues(controlPrefix: ''|'landscape-'): EmulationModel.DeviceModeModel.Insets|null {
|
|
1076
|
+
const left = this.#editorIntegerValue(`${controlPrefix}safe-area-left`);
|
|
1077
|
+
const top = this.#editorIntegerValue(`${controlPrefix}safe-area-top`);
|
|
1078
|
+
const right = this.#editorIntegerValue(`${controlPrefix}safe-area-right`);
|
|
1079
|
+
const bottom = this.#editorIntegerValue(`${controlPrefix}safe-area-bottom`);
|
|
528
1080
|
if (!left && !top && !right && !bottom) {
|
|
529
1081
|
return null;
|
|
530
1082
|
}
|
|
531
1083
|
return new EmulationModel.DeviceModeModel.Insets(left, top, right, bottom);
|
|
532
1084
|
}
|
|
533
1085
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const shape = editor.control('cutout-shape').value;
|
|
1086
|
+
#cutoutFromValues(): EmulationModel.EmulatedDevices.Cutout|null {
|
|
1087
|
+
const shape = this.#editorValues['cutout-shape'];
|
|
537
1088
|
const baseCutout = {
|
|
538
|
-
x: this
|
|
539
|
-
y: this
|
|
540
|
-
width: this
|
|
541
|
-
height: this
|
|
1089
|
+
x: this.#editorIntegerValue('cutout-x'),
|
|
1090
|
+
y: this.#editorIntegerValue('cutout-y'),
|
|
1091
|
+
width: this.#editorIntegerValue('cutout-width'),
|
|
1092
|
+
height: this.#editorIntegerValue('cutout-height'),
|
|
542
1093
|
};
|
|
543
1094
|
switch (shape) {
|
|
544
1095
|
case EmulationModel.EmulatedDevices.CutoutShape.PILL:
|
|
545
1096
|
return {
|
|
546
1097
|
shape,
|
|
547
1098
|
...baseCutout,
|
|
548
|
-
borderRadius: this
|
|
1099
|
+
borderRadius: this.#editorIntegerValue('cutout-border-radius'),
|
|
549
1100
|
};
|
|
550
1101
|
case EmulationModel.EmulatedDevices.CutoutShape.NOTCH:
|
|
551
1102
|
return {
|
|
552
1103
|
shape,
|
|
553
1104
|
...baseCutout,
|
|
554
|
-
upperRadius: this
|
|
555
|
-
lowerRadius: this
|
|
1105
|
+
upperRadius: this.#editorIntegerValue('cutout-upper-radius'),
|
|
1106
|
+
lowerRadius: this.#editorIntegerValue('cutout-lower-radius'),
|
|
556
1107
|
};
|
|
557
1108
|
case EmulationModel.EmulatedDevices.CutoutShape.CIRCLE:
|
|
558
1109
|
return {
|
|
559
1110
|
shape,
|
|
560
1111
|
...baseCutout,
|
|
561
|
-
cx: this
|
|
562
|
-
cy: this
|
|
563
|
-
radius: this
|
|
1112
|
+
cx: this.#editorIntegerValue('cutout-cx'),
|
|
1113
|
+
cy: this.#editorIntegerValue('cutout-cy'),
|
|
1114
|
+
radius: this.#editorIntegerValue('cutout-radius'),
|
|
564
1115
|
};
|
|
565
1116
|
case EmulationModel.EmulatedDevices.CutoutShape.RECTANGLE:
|
|
566
1117
|
return {shape, ...baseCutout};
|
|
@@ -569,211 +1120,68 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
569
1120
|
}
|
|
570
1121
|
}
|
|
571
1122
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const cutout = this.verticalMode(device)?.cutout;
|
|
590
|
-
editor.control('cutout-shape').value = cutout?.shape || NO_CUSTOM_CUTOUT;
|
|
591
|
-
editor.control('cutout-x').value = String(cutout?.x ?? '');
|
|
592
|
-
editor.control('cutout-y').value = String(cutout?.y ?? '');
|
|
593
|
-
editor.control('cutout-width').value = String(cutout?.width ?? '');
|
|
594
|
-
editor.control('cutout-height').value = String(cutout?.height ?? '');
|
|
595
|
-
editor.control('cutout-border-radius').value =
|
|
596
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.PILL ? cutout.borderRadius : '');
|
|
597
|
-
editor.control('cutout-upper-radius').value =
|
|
598
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.upperRadius : '');
|
|
599
|
-
editor.control('cutout-lower-radius').value =
|
|
600
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.lowerRadius : '');
|
|
601
|
-
editor.control('cutout-cx').value =
|
|
602
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cx : '');
|
|
603
|
-
editor.control('cutout-cy').value =
|
|
604
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cy : '');
|
|
605
|
-
editor.control('cutout-radius').value =
|
|
606
|
-
String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.radius : '');
|
|
607
|
-
this.updateCutoutFieldsVisibility(editor);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
private updateCutoutFieldsVisibility(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>):
|
|
611
|
-
void {
|
|
612
|
-
const shape = editor.control('cutout-shape').value;
|
|
613
|
-
const noCutout = shape === NO_CUSTOM_CUTOUT;
|
|
614
|
-
const isPill = shape === EmulationModel.EmulatedDevices.CutoutShape.PILL;
|
|
615
|
-
const isNotch = shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH;
|
|
616
|
-
const isCircle = shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE;
|
|
617
|
-
const content = editor.contentElement();
|
|
618
|
-
const rectRow = content.querySelector<HTMLElement>('.devices-edit-cutout-rect-row');
|
|
619
|
-
const radiusRow = content.querySelector<HTMLElement>('.devices-edit-cutout-radius-row');
|
|
620
|
-
if (rectRow) {
|
|
621
|
-
rectRow.hidden = noCutout;
|
|
622
|
-
}
|
|
623
|
-
if (radiusRow) {
|
|
624
|
-
radiusRow.hidden = noCutout || !(isPill || isNotch || isCircle);
|
|
625
|
-
}
|
|
626
|
-
(editor.control('cutout-border-radius') as HTMLElement).hidden = !isPill;
|
|
627
|
-
(editor.control('cutout-upper-radius') as HTMLElement).hidden = !isNotch;
|
|
628
|
-
(editor.control('cutout-lower-radius') as HTMLElement).hidden = !isNotch;
|
|
629
|
-
(editor.control('cutout-cx') as HTMLElement).hidden = !isCircle;
|
|
630
|
-
(editor.control('cutout-cy') as HTMLElement).hidden = !isCircle;
|
|
631
|
-
(editor.control('cutout-radius') as HTMLElement).hidden = !isCircle;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
private createEditor(): UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice> {
|
|
635
|
-
if (this.editor) {
|
|
636
|
-
return this.editor;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
const editor = new UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>();
|
|
640
|
-
this.editor = editor;
|
|
641
|
-
const content = editor.contentElement();
|
|
642
|
-
|
|
643
|
-
const deviceFields = content.createChild('div', 'devices-edit-fields');
|
|
644
|
-
UI.UIUtils.createTextChild(deviceFields.createChild('b'), i18nString(UIStrings.device));
|
|
645
|
-
const deviceNameField = editor.createInput('title', 'text', i18nString(UIStrings.deviceName), titleValidator);
|
|
646
|
-
deviceFields.createChild('div', 'hbox').appendChild(deviceNameField);
|
|
647
|
-
deviceNameField.id = 'custom-device-name-field';
|
|
648
|
-
const screen = deviceFields.createChild('div', 'hbox');
|
|
649
|
-
screen.appendChild(editor.createInput('width', 'text', i18nString(UIStrings.width), widthValidator));
|
|
650
|
-
screen.appendChild(editor.createInput('height', 'text', i18nString(UIStrings.height), heightValidator));
|
|
651
|
-
const dpr = editor.createInput('scale', 'text', i18nString(UIStrings.devicePixelRatio), scaleValidator);
|
|
652
|
-
dpr.classList.add('device-edit-fixed');
|
|
653
|
-
screen.appendChild(dpr);
|
|
654
|
-
|
|
655
|
-
if (Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled) {
|
|
656
|
-
this.appendSafeAreaFields(editor, deviceFields, i18nString(UIStrings.portraitSafeArea), '',
|
|
657
|
-
portraitSafeAreaValidator);
|
|
658
|
-
this.appendSafeAreaFields(editor, deviceFields, i18nString(UIStrings.landscapeSafeArea), 'landscape-',
|
|
659
|
-
landscapeSafeAreaValidator);
|
|
660
|
-
this.appendCutoutFields(editor, content, {
|
|
661
|
-
shape: cutoutShapeValidator,
|
|
662
|
-
x: cutoutXValidator,
|
|
663
|
-
y: cutoutYValidator,
|
|
664
|
-
width: cutoutWidthValidator,
|
|
665
|
-
height: cutoutHeightValidator,
|
|
666
|
-
pillRadius: cutoutPillRadiusValidator,
|
|
667
|
-
notchUpperRadius: cutoutNotchUpperRadiusValidator,
|
|
668
|
-
notchLowerRadius: cutoutNotchLowerRadiusValidator,
|
|
669
|
-
circleCenterX: cutoutCircleCenterXValidator,
|
|
670
|
-
circleCenterY: cutoutCircleCenterYValidator,
|
|
671
|
-
circleRadius: cutoutCircleRadiusValidator,
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
const uaStringFields = content.createChild('div', 'devices-edit-fields');
|
|
676
|
-
UI.UIUtils.createTextChild(uaStringFields.createChild('b'), i18nString(UIStrings.userAgentString));
|
|
677
|
-
|
|
678
|
-
const ua = uaStringFields.createChild('div', 'hbox');
|
|
679
|
-
ua.appendChild(editor.createInput('user-agent', 'text', i18nString(UIStrings.userAgentString), userAgentValidator));
|
|
680
|
-
const uaTypeOptions = [
|
|
681
|
-
EmulationModel.DeviceModeModel.UA.MOBILE,
|
|
682
|
-
EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH,
|
|
683
|
-
EmulationModel.DeviceModeModel.UA.DESKTOP,
|
|
684
|
-
EmulationModel.DeviceModeModel.UA.DESKTOP_TOUCH,
|
|
685
|
-
];
|
|
686
|
-
const uaType = editor.createSelect('ua-type', uaTypeOptions, () => {
|
|
687
|
-
return {valid: true};
|
|
688
|
-
}, i18nString(UIStrings.userAgentType));
|
|
689
|
-
uaType.classList.add('device-edit-fixed');
|
|
690
|
-
ua.appendChild(uaType);
|
|
691
|
-
|
|
692
|
-
const uaMetadata = this.#userAgentClientHintsForm;
|
|
693
|
-
uaMetadata.value = {};
|
|
694
|
-
uaMetadata.addEventListener(EmulationComponents.UserAgentClientHintsForm.Events.CLIENT_HINTS_CHANGE,
|
|
695
|
-
() => editor.requestValidation());
|
|
696
|
-
// The editor content is not in the DOM yet, so show the form as a root widget.
|
|
697
|
-
uaMetadata.show(content, undefined, /* suppressOrphanWidgetError= */ true);
|
|
698
|
-
editor.addCustomControl(uaMetadata.element, () => uaMetadata.validate());
|
|
699
|
-
|
|
700
|
-
return editor;
|
|
701
|
-
|
|
702
|
-
function userAgentValidator(
|
|
703
|
-
_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
704
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
705
|
-
if (input.value.trim().length > 0) {
|
|
706
|
-
return {valid: true};
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
return {valid: false, errorMessage: i18nString(UIStrings.userAgentStringCannotBeEmpty)};
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
function titleValidator(
|
|
713
|
-
_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
714
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
715
|
-
let valid = false;
|
|
716
|
-
let errorMessage;
|
|
717
|
-
|
|
718
|
-
const value = input.value.trim();
|
|
719
|
-
if (value.length >= EmulationModel.DeviceModeModel.MaxDeviceNameLength) {
|
|
720
|
-
errorMessage =
|
|
721
|
-
i18nString(UIStrings.deviceNameMustBeLessThanS, {PH1: EmulationModel.DeviceModeModel.MaxDeviceNameLength});
|
|
722
|
-
} else if (value.length === 0) {
|
|
723
|
-
errorMessage = i18nString(UIStrings.deviceNameCannotBeEmpty);
|
|
724
|
-
} else {
|
|
725
|
-
valid = true;
|
|
1123
|
+
#validateEditor(showSafeAreaAndCutout: boolean): {
|
|
1124
|
+
invalidFields: Set<EditorFieldName>,
|
|
1125
|
+
isClientHintsInvalid: boolean,
|
|
1126
|
+
errorMessages: string[],
|
|
1127
|
+
hasErrors: boolean,
|
|
1128
|
+
} {
|
|
1129
|
+
const invalidFields = new Set<EditorFieldName>();
|
|
1130
|
+
const errorMessages: string[] = [];
|
|
1131
|
+
let hasErrors = false;
|
|
1132
|
+
|
|
1133
|
+
const recordResult = (field: EditorFieldName, result: UI.ListWidget.ValidatorResult): void => {
|
|
1134
|
+
if (!result.valid) {
|
|
1135
|
+
hasErrors = true;
|
|
1136
|
+
invalidFields.add(field);
|
|
1137
|
+
if (result.errorMessage) {
|
|
1138
|
+
errorMessages.push(result.errorMessage);
|
|
1139
|
+
}
|
|
726
1140
|
}
|
|
1141
|
+
};
|
|
727
1142
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
733
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
734
|
-
return EmulationModel.DeviceModeModel.DeviceModeModel.widthValidator(input.value);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function heightValidator(
|
|
738
|
-
_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
739
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
740
|
-
return EmulationModel.DeviceModeModel.DeviceModeModel.heightValidator(input.value);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
function scaleValidator(
|
|
744
|
-
_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
745
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
746
|
-
return EmulationModel.DeviceModeModel.DeviceModeModel.scaleValidator(input.value);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
function nonNegativeIntegerValue(controlName: string): number|null {
|
|
750
|
-
return parseOptionalNonNegativeInteger(editor.control(controlName).value);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
function positiveIntegerValue(controlName: string): number|null {
|
|
1143
|
+
const values = this.#editorValues;
|
|
1144
|
+
const nonNegativeIntegerValue = (controlName: EditorFieldName): number|null =>
|
|
1145
|
+
parseOptionalNonNegativeInteger(values[controlName]);
|
|
1146
|
+
const positiveIntegerValue = (controlName: EditorFieldName): number|null => {
|
|
754
1147
|
const value = nonNegativeIntegerValue(controlName);
|
|
755
1148
|
return value && value > 0 ? value : null;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const value = editor.control(controlName).value.trim();
|
|
1149
|
+
};
|
|
1150
|
+
const requiredIntegerValue = (controlName: EditorFieldName): number|null => {
|
|
1151
|
+
const value = values[controlName].trim();
|
|
760
1152
|
return value ? parseOptionalNonNegativeInteger(value) : null;
|
|
761
|
-
}
|
|
1153
|
+
};
|
|
1154
|
+
const controlLabel = (field: EditorFieldName): string => FIELD_LABELS[field]?.() ?? '';
|
|
762
1155
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1156
|
+
const validateTitle = (): UI.ListWidget.ValidatorResult => {
|
|
1157
|
+
const value = values.title.trim();
|
|
1158
|
+
if (value.length >= EmulationModel.DeviceModeModel.MaxDeviceNameLength) {
|
|
1159
|
+
return {
|
|
1160
|
+
valid: false,
|
|
1161
|
+
errorMessage: i18nString(UIStrings.deviceNameMustBeLessThanS,
|
|
1162
|
+
{PH1: EmulationModel.DeviceModeModel.MaxDeviceNameLength}),
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
if (value.length === 0) {
|
|
1166
|
+
return {valid: false, errorMessage: i18nString(UIStrings.deviceNameCannotBeEmpty)};
|
|
1167
|
+
}
|
|
1168
|
+
return {valid: true};
|
|
1169
|
+
};
|
|
766
1170
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1171
|
+
const validateSafeArea = (
|
|
1172
|
+
controlPrefix: ''|'landscape-',
|
|
1173
|
+
orientationLabel: string,
|
|
1174
|
+
widthControlName: EditorFieldName,
|
|
1175
|
+
heightControlName: EditorFieldName,
|
|
1176
|
+
field: EditorFieldName,
|
|
1177
|
+
): UI.ListWidget.ValidatorResult => {
|
|
1178
|
+
const ownValue = parseOptionalNonNegativeInteger(values[field]);
|
|
771
1179
|
if (ownValue === null) {
|
|
772
1180
|
return {
|
|
773
1181
|
valid: false,
|
|
774
1182
|
errorMessage: i18nString(UIStrings.safeAreaValueMustBeInRange, {
|
|
775
1183
|
PH1: orientationLabel,
|
|
776
|
-
PH2:
|
|
1184
|
+
PH2: controlLabel(field),
|
|
777
1185
|
PH3: EmulationModel.DeviceModeModel.MaxDeviceSize,
|
|
778
1186
|
}),
|
|
779
1187
|
};
|
|
@@ -785,41 +1193,31 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
785
1193
|
const bottom = nonNegativeIntegerValue(`${controlPrefix}safe-area-bottom`);
|
|
786
1194
|
const width = positiveIntegerValue(widthControlName);
|
|
787
1195
|
const height = positiveIntegerValue(heightControlName);
|
|
788
|
-
if (
|
|
789
|
-
|
|
1196
|
+
if (field === `${controlPrefix}safe-area-right` && left !== null && right !== null && width !== null &&
|
|
1197
|
+
left + right > width) {
|
|
790
1198
|
return {
|
|
791
1199
|
valid: false,
|
|
792
1200
|
errorMessage: i18nString(UIStrings.safeAreaHorizontalInsetsExceedWidth, {PH1: orientationLabel}),
|
|
793
1201
|
};
|
|
794
1202
|
}
|
|
795
|
-
if (
|
|
796
|
-
|
|
1203
|
+
if (field === `${controlPrefix}safe-area-bottom` && top !== null && bottom !== null && height !== null &&
|
|
1204
|
+
top + bottom > height) {
|
|
797
1205
|
return {
|
|
798
1206
|
valid: false,
|
|
799
1207
|
errorMessage: i18nString(UIStrings.safeAreaVerticalInsetsExceedHeight, {PH1: orientationLabel}),
|
|
800
1208
|
};
|
|
801
1209
|
}
|
|
802
1210
|
return {valid: true};
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function portraitSafeAreaValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
806
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
807
|
-
return safeAreaValidator('', i18nString(UIStrings.portraitSafeArea), 'width', 'height', input);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function landscapeSafeAreaValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
811
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
812
|
-
return safeAreaValidator('landscape-', i18nString(UIStrings.landscapeSafeArea), 'height', 'width', input);
|
|
813
|
-
}
|
|
1211
|
+
};
|
|
814
1212
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1213
|
+
const isCutoutFieldActive = (shape?: EmulationModel.EmulatedDevices.CutoutShape): boolean => {
|
|
1214
|
+
const selectedShape = values['cutout-shape'];
|
|
1215
|
+
return selectedShape !== NO_CUSTOM_CUTOUT && (shape === undefined || selectedShape === shape);
|
|
1216
|
+
};
|
|
818
1217
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
const value = input.value.trim();
|
|
1218
|
+
const validateCutoutValue = (field: EditorFieldName, mustBePositive = false): UI.ListWidget.ValidatorResult => {
|
|
1219
|
+
const label = controlLabel(field);
|
|
1220
|
+
const value = values[field].trim();
|
|
823
1221
|
if (!value) {
|
|
824
1222
|
return {valid: false, errorMessage: i18nString(UIStrings.cutoutFieldRequired, {PH1: label})};
|
|
825
1223
|
}
|
|
@@ -837,187 +1235,135 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
|
|
|
837
1235
|
return {valid: false, errorMessage: i18nString(UIStrings.cutoutValueMustBePositiveInteger, {PH1: label})};
|
|
838
1236
|
}
|
|
839
1237
|
return {valid: true};
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function isCutoutFieldActive(shape?: EmulationModel.EmulatedDevices.CutoutShape): boolean {
|
|
843
|
-
const selectedShape = editor.control('cutout-shape').value;
|
|
844
|
-
return selectedShape !== NO_CUSTOM_CUTOUT && (shape === undefined || selectedShape === shape);
|
|
845
|
-
}
|
|
1238
|
+
};
|
|
846
1239
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1240
|
+
recordResult('title', validateTitle());
|
|
1241
|
+
recordResult('width', EmulationModel.DeviceModeModel.DeviceModeModel.widthValidator(values.width));
|
|
1242
|
+
recordResult('height', EmulationModel.DeviceModeModel.DeviceModeModel.heightValidator(values.height));
|
|
1243
|
+
recordResult('scale', EmulationModel.DeviceModeModel.DeviceModeModel.scaleValidator(values.scale));
|
|
851
1244
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
function cutoutWidthValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
858
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
859
|
-
if (!isCutoutFieldActive()) {
|
|
860
|
-
return {valid: true};
|
|
861
|
-
}
|
|
862
|
-
const validation = cutoutValueValidator(input, true);
|
|
863
|
-
if (!validation.valid) {
|
|
864
|
-
return validation;
|
|
1245
|
+
if (showSafeAreaAndCutout) {
|
|
1246
|
+
const portraitLabel = i18nString(UIStrings.portraitSafeArea);
|
|
1247
|
+
for (const field of ['safe-area-left', 'safe-area-top', 'safe-area-right', 'safe-area-bottom'] as const) {
|
|
1248
|
+
recordResult(field, validateSafeArea('', portraitLabel, 'width', 'height', field));
|
|
865
1249
|
}
|
|
866
1250
|
|
|
867
|
-
const
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1251
|
+
const landscapeLabel = i18nString(UIStrings.landscapeSafeArea);
|
|
1252
|
+
for (const field of ['landscape-safe-area-left',
|
|
1253
|
+
'landscape-safe-area-top',
|
|
1254
|
+
'landscape-safe-area-right',
|
|
1255
|
+
'landscape-safe-area-bottom',
|
|
1256
|
+
] as const) {
|
|
1257
|
+
recordResult(field, validateSafeArea('landscape-', landscapeLabel, 'height', 'width', field));
|
|
872
1258
|
}
|
|
873
|
-
return {valid: true};
|
|
874
|
-
}
|
|
875
1259
|
|
|
876
|
-
|
|
877
|
-
|
|
1260
|
+
recordResult('cutout-shape', {valid: true});
|
|
1261
|
+
recordResult('cutout-x', isCutoutFieldActive() ? validateCutoutValue('cutout-x') : {valid: true});
|
|
1262
|
+
recordResult('cutout-y', isCutoutFieldActive() ? validateCutoutValue('cutout-y') : {valid: true});
|
|
1263
|
+
|
|
878
1264
|
if (!isCutoutFieldActive()) {
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1265
|
+
recordResult('cutout-width', {valid: true});
|
|
1266
|
+
} else {
|
|
1267
|
+
const widthValidation = validateCutoutValue('cutout-width', true);
|
|
1268
|
+
if (!widthValidation.valid) {
|
|
1269
|
+
recordResult('cutout-width', widthValidation);
|
|
1270
|
+
} else {
|
|
1271
|
+
const cutoutX = requiredIntegerValue('cutout-x');
|
|
1272
|
+
const cutoutWidth = positiveIntegerValue('cutout-width');
|
|
1273
|
+
const width = positiveIntegerValue('width');
|
|
1274
|
+
if (width !== null && cutoutX !== null && cutoutWidth !== null && cutoutX + cutoutWidth > width) {
|
|
1275
|
+
recordResult('cutout-width',
|
|
1276
|
+
{valid: false, errorMessage: i18nString(UIStrings.cutoutXAndWidthExceedDeviceWidth)});
|
|
1277
|
+
} else {
|
|
1278
|
+
recordResult('cutout-width', {valid: true});
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
884
1281
|
}
|
|
885
1282
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1283
|
+
if (!isCutoutFieldActive()) {
|
|
1284
|
+
recordResult('cutout-height', {valid: true});
|
|
1285
|
+
} else {
|
|
1286
|
+
const heightValidation = validateCutoutValue('cutout-height', true);
|
|
1287
|
+
if (!heightValidation.valid) {
|
|
1288
|
+
recordResult('cutout-height', heightValidation);
|
|
1289
|
+
} else {
|
|
1290
|
+
const cutoutY = requiredIntegerValue('cutout-y');
|
|
1291
|
+
const cutoutHeight = positiveIntegerValue('cutout-height');
|
|
1292
|
+
const height = positiveIntegerValue('height');
|
|
1293
|
+
if (height !== null && cutoutY !== null && cutoutHeight !== null && cutoutY + cutoutHeight > height) {
|
|
1294
|
+
recordResult('cutout-height',
|
|
1295
|
+
{valid: false, errorMessage: i18nString(UIStrings.cutoutYAndHeightExceedDeviceHeight)});
|
|
1296
|
+
} else {
|
|
1297
|
+
recordResult('cutout-height', {valid: true});
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
891
1300
|
}
|
|
892
|
-
return {valid: true};
|
|
893
|
-
}
|
|
894
1301
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1302
|
+
recordResult('cutout-border-radius',
|
|
1303
|
+
isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.PILL) ?
|
|
1304
|
+
validateCutoutValue('cutout-border-radius') :
|
|
1305
|
+
{valid: true});
|
|
1306
|
+
recordResult('cutout-upper-radius',
|
|
1307
|
+
isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ?
|
|
1308
|
+
validateCutoutValue('cutout-upper-radius') :
|
|
1309
|
+
{valid: true});
|
|
1310
|
+
recordResult('cutout-lower-radius',
|
|
1311
|
+
isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ?
|
|
1312
|
+
validateCutoutValue('cutout-lower-radius') :
|
|
1313
|
+
{valid: true});
|
|
1314
|
+
recordResult('cutout-cx',
|
|
1315
|
+
isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ?
|
|
1316
|
+
validateCutoutValue('cutout-cx') :
|
|
1317
|
+
{valid: true});
|
|
1318
|
+
recordResult('cutout-cy',
|
|
1319
|
+
isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ?
|
|
1320
|
+
validateCutoutValue('cutout-cy') :
|
|
1321
|
+
{valid: true});
|
|
900
1322
|
|
|
901
|
-
function cutoutNotchUpperRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
902
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
903
|
-
return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ? cutoutValueValidator(input) :
|
|
904
|
-
{valid: true};
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
function cutoutNotchLowerRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
908
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
909
|
-
return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ? cutoutValueValidator(input) :
|
|
910
|
-
{valid: true};
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
function cutoutCircleCenterXValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
914
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
915
|
-
return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ? cutoutValueValidator(input) :
|
|
916
|
-
{valid: true};
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
function cutoutCircleCenterYValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
920
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
921
|
-
return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ? cutoutValueValidator(input) :
|
|
922
|
-
{valid: true};
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
function cutoutCircleRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
|
|
926
|
-
input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
|
|
927
1323
|
if (!isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE)) {
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1324
|
+
recordResult('cutout-radius', {valid: true});
|
|
1325
|
+
} else {
|
|
1326
|
+
const radiusValidation = validateCutoutValue('cutout-radius', true);
|
|
1327
|
+
if (!radiusValidation.valid) {
|
|
1328
|
+
recordResult('cutout-radius', radiusValidation);
|
|
1329
|
+
} else {
|
|
1330
|
+
const cutoutX = requiredIntegerValue('cutout-x');
|
|
1331
|
+
const cutoutY = requiredIntegerValue('cutout-y');
|
|
1332
|
+
const cutoutWidth = positiveIntegerValue('cutout-width');
|
|
1333
|
+
const cutoutHeight = positiveIntegerValue('cutout-height');
|
|
1334
|
+
const centerX = requiredIntegerValue('cutout-cx');
|
|
1335
|
+
const centerY = requiredIntegerValue('cutout-cy');
|
|
1336
|
+
const radius = positiveIntegerValue('cutout-radius');
|
|
1337
|
+
if (cutoutX !== null && cutoutY !== null && cutoutWidth !== null && cutoutHeight !== null &&
|
|
1338
|
+
centerX !== null && centerY !== null && radius !== null &&
|
|
1339
|
+
(centerX - radius < cutoutX || centerX + radius > cutoutX + cutoutWidth || centerY - radius < cutoutY ||
|
|
1340
|
+
centerY + radius > cutoutY + cutoutHeight)) {
|
|
1341
|
+
recordResult('cutout-radius',
|
|
1342
|
+
{valid: false, errorMessage: i18nString(UIStrings.circleMustFitCutoutBounds)});
|
|
1343
|
+
} else {
|
|
1344
|
+
recordResult('cutout-radius', {valid: true});
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
933
1347
|
}
|
|
1348
|
+
}
|
|
934
1349
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1350
|
+
recordResult('user-agent',
|
|
1351
|
+
values['user-agent'].trim().length > 0 ?
|
|
1352
|
+
{valid: true} :
|
|
1353
|
+
{valid: false, errorMessage: i18nString(UIStrings.userAgentStringCannotBeEmpty)});
|
|
1354
|
+
recordResult('ua-type', {valid: true});
|
|
1355
|
+
|
|
1356
|
+
let isClientHintsInvalid = false;
|
|
1357
|
+
const clientHintsResult = EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm.validateMetaData(
|
|
1358
|
+
this.#clientHintsMetaData);
|
|
1359
|
+
if (!clientHintsResult.valid) {
|
|
1360
|
+
hasErrors = true;
|
|
1361
|
+
isClientHintsInvalid = true;
|
|
1362
|
+
if (clientHintsResult.errorMessage) {
|
|
1363
|
+
errorMessages.push(clientHintsResult.errorMessage);
|
|
947
1364
|
}
|
|
948
|
-
return {valid: true};
|
|
949
1365
|
}
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
private appendSafeAreaFields(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>,
|
|
953
|
-
deviceFields: HTMLElement, title: string, controlPrefix: string,
|
|
954
|
-
safeAreaValidator:
|
|
955
|
-
(item: EmulationModel.EmulatedDevices.EmulatedDevice, index: number,
|
|
956
|
-
input: UI.ListWidget.EditorControl) => UI.ListWidget.ValidatorResult): void {
|
|
957
|
-
const safeAreaGroup = deviceFields.createChild('div', 'devices-edit-safe-area-group');
|
|
958
|
-
UI.ARIAUtils.markAsGroup(safeAreaGroup);
|
|
959
|
-
const heading = safeAreaGroup.createChild('b');
|
|
960
|
-
heading.id = UI.ARIAUtils.nextId('safe-area-heading-');
|
|
961
|
-
UI.UIUtils.createTextChild(heading, title);
|
|
962
|
-
safeAreaGroup.setAttribute('aria-labelledby', heading.id);
|
|
963
|
-
const safeAreaRow = safeAreaGroup.createChild('div', 'hbox');
|
|
964
|
-
safeAreaRow.appendChild(editor.createInput(`${controlPrefix}safe-area-left`, 'text',
|
|
965
|
-
i18nString(UIStrings.safeAreaLeft), safeAreaValidator));
|
|
966
|
-
safeAreaRow.appendChild(editor.createInput(`${controlPrefix}safe-area-top`, 'text',
|
|
967
|
-
i18nString(UIStrings.safeAreaTop), safeAreaValidator));
|
|
968
|
-
safeAreaRow.appendChild(editor.createInput(`${controlPrefix}safe-area-right`, 'text',
|
|
969
|
-
i18nString(UIStrings.safeAreaRight), safeAreaValidator));
|
|
970
|
-
safeAreaRow.appendChild(editor.createInput(`${controlPrefix}safe-area-bottom`, 'text',
|
|
971
|
-
i18nString(UIStrings.safeAreaBottom), safeAreaValidator));
|
|
972
|
-
}
|
|
973
1366
|
|
|
974
|
-
|
|
975
|
-
content: Element, validators: CutoutFieldValidators): void {
|
|
976
|
-
const cutoutFields = content.createChild('div', 'devices-edit-fields');
|
|
977
|
-
cutoutFields.classList.add('devices-edit-cutout-fields');
|
|
978
|
-
UI.ARIAUtils.markAsGroup(cutoutFields);
|
|
979
|
-
const heading = cutoutFields.createChild('b');
|
|
980
|
-
heading.id = UI.ARIAUtils.nextId('cutout-heading-');
|
|
981
|
-
UI.UIUtils.createTextChild(heading, i18nString(UIStrings.displayCutout));
|
|
982
|
-
cutoutFields.setAttribute('aria-labelledby', heading.id);
|
|
983
|
-
const shapeOptions = [
|
|
984
|
-
NO_CUSTOM_CUTOUT,
|
|
985
|
-
EmulationModel.EmulatedDevices.CutoutShape.PILL,
|
|
986
|
-
EmulationModel.EmulatedDevices.CutoutShape.NOTCH,
|
|
987
|
-
EmulationModel.EmulatedDevices.CutoutShape.CIRCLE,
|
|
988
|
-
EmulationModel.EmulatedDevices.CutoutShape.RECTANGLE,
|
|
989
|
-
];
|
|
990
|
-
const shapeControl =
|
|
991
|
-
editor.createSelect('cutout-shape', shapeOptions, validators.shape, i18nString(UIStrings.displayCutout));
|
|
992
|
-
shapeControl.options[0].textContent = i18nString(UIStrings.noDisplayCutout);
|
|
993
|
-
shapeControl.options[1].textContent = i18nString(UIStrings.pillDisplayCutout);
|
|
994
|
-
shapeControl.options[2].textContent = i18nString(UIStrings.notchDisplayCutout);
|
|
995
|
-
shapeControl.options[3].textContent = i18nString(UIStrings.circleDisplayCutout);
|
|
996
|
-
shapeControl.options[4].textContent = i18nString(UIStrings.rectangleDisplayCutout);
|
|
997
|
-
cutoutFields.createChild('div', 'hbox').appendChild(shapeControl);
|
|
998
|
-
shapeControl.addEventListener('input', () => this.updateCutoutFieldsVisibility(editor), false);
|
|
999
|
-
|
|
1000
|
-
const rectRow = cutoutFields.createChild('div', 'hbox devices-edit-cutout-rect-row');
|
|
1001
|
-
rectRow.appendChild(editor.createInput('cutout-x', 'text', i18nString(UIStrings.cutoutX), validators.x));
|
|
1002
|
-
rectRow.appendChild(editor.createInput('cutout-y', 'text', i18nString(UIStrings.cutoutY), validators.y));
|
|
1003
|
-
rectRow.appendChild(
|
|
1004
|
-
editor.createInput('cutout-width', 'text', i18nString(UIStrings.cutoutWidth), validators.width));
|
|
1005
|
-
rectRow.appendChild(
|
|
1006
|
-
editor.createInput('cutout-height', 'text', i18nString(UIStrings.cutoutHeight), validators.height));
|
|
1007
|
-
|
|
1008
|
-
const radiusRow = cutoutFields.createChild('div', 'hbox devices-edit-cutout-radius-row');
|
|
1009
|
-
radiusRow.appendChild(editor.createInput('cutout-border-radius', 'text', i18nString(UIStrings.cutoutBorderRadius),
|
|
1010
|
-
validators.pillRadius));
|
|
1011
|
-
radiusRow.appendChild(editor.createInput('cutout-upper-radius', 'text', i18nString(UIStrings.cutoutUpperRadius),
|
|
1012
|
-
validators.notchUpperRadius));
|
|
1013
|
-
radiusRow.appendChild(editor.createInput('cutout-lower-radius', 'text', i18nString(UIStrings.cutoutLowerRadius),
|
|
1014
|
-
validators.notchLowerRadius));
|
|
1015
|
-
radiusRow.appendChild(
|
|
1016
|
-
editor.createInput('cutout-cx', 'text', i18nString(UIStrings.cutoutCenterX), validators.circleCenterX));
|
|
1017
|
-
radiusRow.appendChild(
|
|
1018
|
-
editor.createInput('cutout-cy', 'text', i18nString(UIStrings.cutoutCenterY), validators.circleCenterY));
|
|
1019
|
-
radiusRow.appendChild(
|
|
1020
|
-
editor.createInput('cutout-radius', 'text', i18nString(UIStrings.cutoutRadius), validators.circleRadius));
|
|
1021
|
-
this.updateCutoutFieldsVisibility(editor);
|
|
1367
|
+
return {invalidFields, isClientHintsInvalid, errorMessages, hasErrors};
|
|
1022
1368
|
}
|
|
1023
1369
|
}
|