devtools-tracing 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generate.ts +643 -0
- package/index.ts +16 -0
- package/lib/front_end/core/common/App.ts +7 -0
- package/lib/front_end/core/common/AppProvider.ts +32 -0
- package/lib/front_end/core/common/Base64.ts +47 -0
- package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
- package/lib/front_end/core/common/Color.ts +2506 -0
- package/lib/front_end/core/common/ColorConverter.ts +402 -0
- package/lib/front_end/core/common/ColorUtils.ts +252 -0
- package/lib/front_end/core/common/Console.ts +114 -0
- package/lib/front_end/core/common/Debouncer.ts +15 -0
- package/lib/front_end/core/common/EventTarget.ts +52 -0
- package/lib/front_end/core/common/Gzip.ts +74 -0
- package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
- package/lib/front_end/core/common/Lazy.ts +31 -0
- package/lib/front_end/core/common/Linkifier.ts +55 -0
- package/lib/front_end/core/common/MapWithDefault.ts +26 -0
- package/lib/front_end/core/common/Mutex.ts +55 -0
- package/lib/front_end/core/common/Object.ts +145 -0
- package/lib/front_end/core/common/ParsedURL.ts +554 -0
- package/lib/front_end/core/common/Progress.ts +180 -0
- package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
- package/lib/front_end/core/common/ResolverBase.ts +85 -0
- package/lib/front_end/core/common/ResourceType.ts +588 -0
- package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
- package/lib/front_end/core/common/Revealer.ts +192 -0
- package/lib/front_end/core/common/Runnable.ts +41 -0
- package/lib/front_end/core/common/SegmentedRange.ts +87 -0
- package/lib/front_end/core/common/SettingRegistration.ts +339 -0
- package/lib/front_end/core/common/Settings.ts +1497 -0
- package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
- package/lib/front_end/core/common/StringOutputStream.ts +26 -0
- package/lib/front_end/core/common/TextDictionary.ts +48 -0
- package/lib/front_end/core/common/Throttler.ts +99 -0
- package/lib/front_end/core/common/Trie.ts +152 -0
- package/lib/front_end/core/common/Worker.ts +60 -0
- package/lib/front_end/core/common/common.ts +81 -0
- package/lib/front_end/core/host/AidaClient.ts +733 -0
- package/lib/front_end/core/host/GdpClient.ts +316 -0
- package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
- package/lib/front_end/core/host/Platform.ts +76 -0
- package/lib/front_end/core/host/ResourceLoader.ts +282 -0
- package/lib/front_end/core/host/UserMetrics.ts +1230 -0
- package/lib/front_end/core/host/host.ts +23 -0
- package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
- package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
- package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
- package/lib/front_end/core/i18n/i18n.ts +17 -0
- package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
- package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
- package/lib/front_end/core/i18n/locales.js +14 -0
- package/lib/front_end/core/i18n/time-utilities.ts +174 -0
- package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
- package/lib/front_end/core/platform/Brand.ts +23 -0
- package/lib/front_end/core/platform/Constructor.ts +10 -0
- package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
- package/lib/front_end/core/platform/DateUtilities.ts +15 -0
- package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
- package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
- package/lib/front_end/core/platform/MapUtilities.ts +95 -0
- package/lib/front_end/core/platform/MimeType.ts +175 -0
- package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
- package/lib/front_end/core/platform/StringUtilities.ts +588 -0
- package/lib/front_end/core/platform/Timing.ts +17 -0
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
- package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
- package/lib/front_end/core/platform/UIString.ts +39 -0
- package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
- package/lib/front_end/core/platform/platform.ts +45 -0
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
- package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
- package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
- package/lib/front_end/core/root/Runtime.ts +609 -0
- package/lib/front_end/core/root/root.ts +6 -0
- package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
- package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
- package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
- package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
- package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
- package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
- package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
- package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
- package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
- package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
- package/lib/front_end/core/sdk/CSSRule.ts +465 -0
- package/lib/front_end/core/sdk/CSSScope.ts +30 -0
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
- package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
- package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
- package/lib/front_end/core/sdk/Connections.ts +293 -0
- package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
- package/lib/front_end/core/sdk/Cookie.ts +319 -0
- package/lib/front_end/core/sdk/CookieModel.ts +239 -0
- package/lib/front_end/core/sdk/CookieParser.ts +185 -0
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
- package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
- package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
- package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
- package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
- package/lib/front_end/core/sdk/FrameManager.ts +259 -0
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
- package/lib/front_end/core/sdk/IOModel.ts +91 -0
- package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
- package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
- package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
- package/lib/front_end/core/sdk/LogModel.ts +56 -0
- package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
- package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
- package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
- package/lib/front_end/core/sdk/PageLoad.ts +35 -0
- package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
- package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
- package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
- package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
- package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
- package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
- package/lib/front_end/core/sdk/Resource.ts +232 -0
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
- package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
- package/lib/front_end/core/sdk/SDKModel.ts +65 -0
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
- package/lib/front_end/core/sdk/Script.ts +534 -0
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
- package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
- package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
- package/lib/front_end/core/sdk/SourceMap.ts +867 -0
- package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
- package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
- package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
- package/lib/front_end/core/sdk/Target.ts +332 -0
- package/lib/front_end/core/sdk/TargetManager.ts +453 -0
- package/lib/front_end/core/sdk/TraceObject.ts +61 -0
- package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
- package/lib/front_end/core/sdk/sdk.ts +174 -0
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
- package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
- package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
- package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
- package/lib/front_end/generated/protocol.ts +22014 -0
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
- package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
- package/lib/front_end/models/formatter/formatter.ts +8 -0
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
- package/lib/front_end/models/text_utils/ContentData.ts +199 -0
- package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
- package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
- package/lib/front_end/models/text_utils/Text.ts +90 -0
- package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
- package/lib/front_end/models/text_utils/TextRange.ts +266 -0
- package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
- package/lib/front_end/models/text_utils/text_utils.ts +27 -0
- package/lib/front_end/models/trace/EntityMapper.ts +141 -0
- package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
- package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
- package/lib/front_end/models/trace/ModelImpl.ts +236 -0
- package/lib/front_end/models/trace/Name.ts +136 -0
- package/lib/front_end/models/trace/Processor.ts +652 -0
- package/lib/front_end/models/trace/Styles.ts +1138 -0
- package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
- package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
- package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
- package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
- package/lib/front_end/models/trace/extras/extras.ts +11 -0
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
- package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
- package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
- package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
- package/lib/front_end/models/trace/handlers/types.ts +75 -0
- package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
- package/lib/front_end/models/trace/helpers/Network.ts +129 -0
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
- package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
- package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
- package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
- package/lib/front_end/models/trace/insights/Cache.ts +269 -0
- package/lib/front_end/models/trace/insights/Common.ts +453 -0
- package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
- package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
- package/lib/front_end/models/trace/insights/Models.ts +22 -0
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
- package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
- package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
- package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
- package/lib/front_end/models/trace/insights/insights.ts +10 -0
- package/lib/front_end/models/trace/insights/types.ts +157 -0
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
- package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
- package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
- package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
- package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
- package/lib/front_end/models/trace/trace.ts +33 -0
- package/lib/front_end/models/trace/types/Configuration.ts +110 -0
- package/lib/front_end/models/trace/types/Extensions.ts +136 -0
- package/lib/front_end/models/trace/types/File.ts +281 -0
- package/lib/front_end/models/trace/types/Overlays.ts +138 -0
- package/lib/front_end/models/trace/types/Timing.ts +30 -0
- package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
- package/lib/front_end/models/trace/types/types.ts +10 -0
- package/lib/front_end/third_party/i18n/LICENSE +202 -0
- package/lib/front_end/third_party/i18n/README.chromium +15 -0
- package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
- package/lib/front_end/third_party/i18n/i18n.ts +11 -0
- package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
- package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
- package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
- package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
- package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
- package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
- package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
- package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
- package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
- package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
- package/lib/front_end/third_party/third-party-web/package.json +8 -0
- package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
- package/package.json +24 -0
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
// Copyright 2016 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
6
|
+
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
7
|
+
import * as Common from '../common/common.js';
|
|
8
|
+
import * as HostModule from '../host/host.js';
|
|
9
|
+
import * as Platform from '../platform/platform.js';
|
|
10
|
+
import * as Root from '../root/root.js';
|
|
11
|
+
|
|
12
|
+
import type {CSSMatchedStyles} from './CSSMatchedStyles.js';
|
|
13
|
+
import {cssMetadata, GridAreaRowRegex} from './CSSMetadata.js';
|
|
14
|
+
import type {Edit} from './CSSModel.js';
|
|
15
|
+
import {
|
|
16
|
+
type BottomUpTreeMatching,
|
|
17
|
+
type Match,
|
|
18
|
+
matchDeclaration,
|
|
19
|
+
type Matcher,
|
|
20
|
+
stripComments
|
|
21
|
+
} from './CSSPropertyParser.js';
|
|
22
|
+
import {CSSWideKeywordMatcher, FontMatcher} from './CSSPropertyParserMatchers.js';
|
|
23
|
+
import type {CSSStyleDeclaration} from './CSSStyleDeclaration.js';
|
|
24
|
+
|
|
25
|
+
export const enum Events {
|
|
26
|
+
LOCAL_VALUE_UPDATED = 'localValueUpdated',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface EventTypes {
|
|
30
|
+
[Events.LOCAL_VALUE_UPDATED]: void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
34
|
+
ownerStyle: CSSStyleDeclaration;
|
|
35
|
+
index: number;
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
important: boolean;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
parsedOk: boolean;
|
|
41
|
+
implicit: boolean;
|
|
42
|
+
text: string|null|undefined;
|
|
43
|
+
range: TextUtils.TextRange.TextRange|null;
|
|
44
|
+
#active: boolean;
|
|
45
|
+
#nameRange: TextUtils.TextRange.TextRange|null;
|
|
46
|
+
#valueRange: TextUtils.TextRange.TextRange|null;
|
|
47
|
+
#invalidString?: Common.UIString.LocalizedString;
|
|
48
|
+
#longhandProperties: CSSProperty[] = [];
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
ownerStyle: CSSStyleDeclaration, index: number, name: string, value: string, important: boolean,
|
|
52
|
+
disabled: boolean, parsedOk: boolean, implicit: boolean, text?: string|null, range?: Protocol.CSS.SourceRange,
|
|
53
|
+
longhandProperties?: Protocol.CSS.CSSProperty[]) {
|
|
54
|
+
super();
|
|
55
|
+
this.ownerStyle = ownerStyle;
|
|
56
|
+
this.index = index;
|
|
57
|
+
this.name = name;
|
|
58
|
+
this.value = value;
|
|
59
|
+
this.important = important;
|
|
60
|
+
this.disabled = disabled;
|
|
61
|
+
this.parsedOk = parsedOk;
|
|
62
|
+
this.implicit = implicit; // A longhand, implicitly set by missing values of shorthand.
|
|
63
|
+
this.text = text;
|
|
64
|
+
this.range = range ? TextUtils.TextRange.TextRange.fromObject(range) : null;
|
|
65
|
+
this.#active = true;
|
|
66
|
+
this.#nameRange = null;
|
|
67
|
+
this.#valueRange = null;
|
|
68
|
+
|
|
69
|
+
if (longhandProperties && longhandProperties.length > 0) {
|
|
70
|
+
for (const property of longhandProperties) {
|
|
71
|
+
this.#longhandProperties.push(
|
|
72
|
+
new CSSProperty(ownerStyle, ++index, property.name, property.value, important, disabled, parsedOk, true));
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
// Blink would not parse shorthands containing 'var()' functions:
|
|
76
|
+
// https://drafts.csswg.org/css-variables/#variables-in-shorthands).
|
|
77
|
+
// Therefore we manually check if the current property is a shorthand,
|
|
78
|
+
// and fills its longhand components with empty values.
|
|
79
|
+
const longhandNames = cssMetadata().getLonghands(name);
|
|
80
|
+
for (const longhandName of longhandNames || []) {
|
|
81
|
+
this.#longhandProperties.push(
|
|
82
|
+
new CSSProperty(ownerStyle, ++index, longhandName, '', important, disabled, parsedOk, true));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static parsePayload(ownerStyle: CSSStyleDeclaration, index: number, payload: Protocol.CSS.CSSProperty): CSSProperty {
|
|
88
|
+
// The following default field values are used in the payload:
|
|
89
|
+
// important: false
|
|
90
|
+
// parsedOk: true
|
|
91
|
+
// implicit: false
|
|
92
|
+
// disabled: false
|
|
93
|
+
const result = new CSSProperty(
|
|
94
|
+
ownerStyle, index, payload.name, payload.value, payload.important || false, payload.disabled || false,
|
|
95
|
+
('parsedOk' in payload) ? Boolean(payload.parsedOk) : true, Boolean(payload.implicit), payload.text,
|
|
96
|
+
payload.range, payload.longhandProperties);
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
parseExpression(expression: string, matchedStyles: CSSMatchedStyles, computedStyles: Map<string, string>|null):
|
|
101
|
+
BottomUpTreeMatching|null {
|
|
102
|
+
if (!this.parsedOk) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return matchDeclaration(this.name, expression, this.#matchers(matchedStyles, computedStyles));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
parseValue(matchedStyles: CSSMatchedStyles, computedStyles: Map<string, string>|null): BottomUpTreeMatching|null {
|
|
110
|
+
if (!this.parsedOk) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return matchDeclaration(this.name, this.value, this.#matchers(matchedStyles, computedStyles));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#matchers(matchedStyles: CSSMatchedStyles, computedStyles: Map<string, string>|null): Array<Matcher<Match>> {
|
|
118
|
+
const matchers = matchedStyles.propertyMatchers(this.ownerStyle, computedStyles);
|
|
119
|
+
|
|
120
|
+
matchers.push(new CSSWideKeywordMatcher(this, matchedStyles));
|
|
121
|
+
if (Root.Runtime.experiments.isEnabled('font-editor')) {
|
|
122
|
+
matchers.push(new FontMatcher());
|
|
123
|
+
}
|
|
124
|
+
return matchers;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private ensureRanges(): void {
|
|
128
|
+
if (this.#nameRange && this.#valueRange) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const range = this.range;
|
|
132
|
+
const text = this.text ? new TextUtils.Text.Text(this.text) : null;
|
|
133
|
+
if (!range || !text) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const nameIndex = text.value().indexOf(this.name);
|
|
138
|
+
const valueIndex = text.value().lastIndexOf(this.value);
|
|
139
|
+
if (nameIndex === -1 || valueIndex === -1 || nameIndex > valueIndex) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const nameSourceRange = new TextUtils.TextRange.SourceRange(nameIndex, this.name.length);
|
|
144
|
+
const valueSourceRange = new TextUtils.TextRange.SourceRange(valueIndex, this.value.length);
|
|
145
|
+
|
|
146
|
+
this.#nameRange = rebase(text.toTextRange(nameSourceRange), range.startLine, range.startColumn);
|
|
147
|
+
this.#valueRange = rebase(text.toTextRange(valueSourceRange), range.startLine, range.startColumn);
|
|
148
|
+
|
|
149
|
+
function rebase(oneLineRange: TextUtils.TextRange.TextRange, lineOffset: number, columnOffset: number):
|
|
150
|
+
TextUtils.TextRange.TextRange {
|
|
151
|
+
if (oneLineRange.startLine === 0) {
|
|
152
|
+
oneLineRange.startColumn += columnOffset;
|
|
153
|
+
oneLineRange.endColumn += columnOffset;
|
|
154
|
+
}
|
|
155
|
+
oneLineRange.startLine += lineOffset;
|
|
156
|
+
oneLineRange.endLine += lineOffset;
|
|
157
|
+
return oneLineRange;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
nameRange(): TextUtils.TextRange.TextRange|null {
|
|
162
|
+
this.ensureRanges();
|
|
163
|
+
return this.#nameRange;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
valueRange(): TextUtils.TextRange.TextRange|null {
|
|
167
|
+
this.ensureRanges();
|
|
168
|
+
return this.#valueRange;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
rebase(edit: Edit): void {
|
|
172
|
+
if (this.ownerStyle.styleSheetId !== edit.styleSheetId) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (this.range) {
|
|
176
|
+
this.range = this.range.rebaseAfterTextEdit(edit.oldRange, edit.newRange);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
setActive(active: boolean): void {
|
|
181
|
+
this.#active = active;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
get propertyText(): string|null {
|
|
185
|
+
if (this.text !== undefined) {
|
|
186
|
+
return this.text;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (this.name === '') {
|
|
190
|
+
return '';
|
|
191
|
+
}
|
|
192
|
+
return this.name + ': ' + this.value + (this.important ? ' !important' : '') + ';';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
activeInStyle(): boolean {
|
|
196
|
+
return this.#active;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async setText(propertyText: string, majorChange: boolean, overwrite?: boolean): Promise<boolean> {
|
|
200
|
+
if (!this.ownerStyle) {
|
|
201
|
+
throw new Error('No ownerStyle for property');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (!this.ownerStyle.styleSheetId) {
|
|
205
|
+
throw new Error('No owner style id');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!this.range || !this.ownerStyle.range) {
|
|
209
|
+
throw new Error('Style not editable');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (majorChange) {
|
|
213
|
+
HostModule.userMetrics.actionTaken(HostModule.UserMetrics.Action.StyleRuleEdited);
|
|
214
|
+
if (this.ownerStyle.parentRule?.isKeyframeRule()) {
|
|
215
|
+
HostModule.userMetrics.actionTaken(HostModule.UserMetrics.Action.StylePropertyInsideKeyframeEdited);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (this.name.startsWith('--')) {
|
|
219
|
+
HostModule.userMetrics.actionTaken(HostModule.UserMetrics.Action.CustomPropertyEdited);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (overwrite && propertyText === this.propertyText) {
|
|
224
|
+
this.ownerStyle.cssModel().domModel().markUndoableState(!majorChange);
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const range = this.range.relativeTo(this.ownerStyle.range.startLine, this.ownerStyle.range.startColumn);
|
|
229
|
+
const indentation = this.ownerStyle.cssText ?
|
|
230
|
+
this.detectIndentation(this.ownerStyle.cssText) :
|
|
231
|
+
Common.Settings.Settings.instance().moduleSetting('text-editor-indent').get();
|
|
232
|
+
const endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : '';
|
|
233
|
+
const text = new TextUtils.Text.Text(this.ownerStyle.cssText || '');
|
|
234
|
+
const newStyleText = text.replaceRange(range, Platform.StringUtilities.sprintf(';%s;', propertyText));
|
|
235
|
+
const styleText = await CSSProperty.formatStyle(newStyleText, indentation, endIndentation);
|
|
236
|
+
return await this.ownerStyle.setText(styleText, majorChange);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
static async formatStyle(styleText: string, indentation: string, endIndentation: string): Promise<string> {
|
|
240
|
+
const doubleIndent = indentation.substring(endIndentation.length) + indentation;
|
|
241
|
+
if (indentation) {
|
|
242
|
+
indentation = '\n' + indentation;
|
|
243
|
+
}
|
|
244
|
+
let result = '';
|
|
245
|
+
let propertyName = '';
|
|
246
|
+
let propertyText = '';
|
|
247
|
+
let insideProperty = false;
|
|
248
|
+
let needsSemi = false;
|
|
249
|
+
const tokenize = TextUtils.CodeMirrorUtils.createCssTokenizer();
|
|
250
|
+
|
|
251
|
+
await tokenize('*{' + styleText + '}', processToken);
|
|
252
|
+
if (insideProperty) {
|
|
253
|
+
result += propertyText;
|
|
254
|
+
}
|
|
255
|
+
result = result.substring(2, result.length - 1).trimEnd();
|
|
256
|
+
return result + (indentation ? '\n' + endIndentation : '');
|
|
257
|
+
|
|
258
|
+
function processToken(token: string, tokenType: string|null): void {
|
|
259
|
+
if (!insideProperty) {
|
|
260
|
+
const disabledProperty = tokenType?.includes('comment') && isDisabledProperty(token);
|
|
261
|
+
const isPropertyStart =
|
|
262
|
+
(tokenType?.includes('def') || tokenType?.includes('string') || tokenType?.includes('meta') ||
|
|
263
|
+
tokenType?.includes('property') ||
|
|
264
|
+
(tokenType?.includes('variableName') && tokenType !== ('variableName.function')));
|
|
265
|
+
if (disabledProperty) {
|
|
266
|
+
result = result.trimEnd() + indentation + token;
|
|
267
|
+
} else if (isPropertyStart) {
|
|
268
|
+
insideProperty = true;
|
|
269
|
+
propertyText = token;
|
|
270
|
+
} else if (token !== ';' || needsSemi) {
|
|
271
|
+
result += token;
|
|
272
|
+
if (token.trim() && !(tokenType?.includes('comment'))) {
|
|
273
|
+
needsSemi = token !== ';';
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (token === '{' && !tokenType) {
|
|
277
|
+
needsSemi = false;
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (token === '}' || token === ';') {
|
|
283
|
+
// While `propertyText` can generally be trimmed, doing so
|
|
284
|
+
// breaks valid CSS declarations such as `--foo: ;` which would
|
|
285
|
+
// then produce invalid CSS of the form `--foo:;`. This
|
|
286
|
+
// implementation takes special care to restore a single
|
|
287
|
+
// whitespace token in this edge case. https://crbug.com/1071296
|
|
288
|
+
const trimmedPropertyText = propertyText.trim();
|
|
289
|
+
result = result.trimEnd() + indentation + trimmedPropertyText + (trimmedPropertyText.endsWith(':') ? ' ' : '') +
|
|
290
|
+
token;
|
|
291
|
+
needsSemi = false;
|
|
292
|
+
insideProperty = false;
|
|
293
|
+
propertyName = '';
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (cssMetadata().isGridAreaDefiningProperty(propertyName)) {
|
|
297
|
+
const rowResult = GridAreaRowRegex.exec(token);
|
|
298
|
+
if (rowResult && rowResult.index === 0 && !propertyText.trimEnd().endsWith(']')) {
|
|
299
|
+
propertyText = propertyText.trimEnd() + '\n' + doubleIndent;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!propertyName && token === ':') {
|
|
303
|
+
propertyName = propertyText;
|
|
304
|
+
}
|
|
305
|
+
propertyText += token;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function isDisabledProperty(text: string): boolean {
|
|
309
|
+
const colon = text.indexOf(':');
|
|
310
|
+
if (colon === -1) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
const propertyName = text.substring(2, colon).trim();
|
|
314
|
+
return cssMetadata().isCSSPropertyName(propertyName);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
private detectIndentation(text: string): string {
|
|
319
|
+
const lines = text.split('\n');
|
|
320
|
+
if (lines.length < 2) {
|
|
321
|
+
return '';
|
|
322
|
+
}
|
|
323
|
+
return TextUtils.TextUtils.Utils.lineIndent(lines[1]);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
setValue(newValue: string, majorChange: boolean, overwrite: boolean, userCallback?: ((arg0: boolean) => void)): void {
|
|
327
|
+
const text = this.name + ': ' + newValue + (this.important ? ' !important' : '') + ';';
|
|
328
|
+
void this.setText(text, majorChange, overwrite).then(userCallback);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Updates the value stored locally and emits an event to signal its update.
|
|
332
|
+
setLocalValue(value: string): void {
|
|
333
|
+
this.value = value;
|
|
334
|
+
this.dispatchEventToListeners(Events.LOCAL_VALUE_UPDATED);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
async setDisabled(disabled: boolean): Promise<boolean> {
|
|
338
|
+
if (!this.ownerStyle) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
if (disabled === this.disabled) {
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
if (!this.text) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
const propertyText = this.text.trim();
|
|
348
|
+
// Ensure that if we try to enable/disable a property that has no semicolon (which is only legal
|
|
349
|
+
// in the last position of a css rule), we add it. This ensures that if we then later try
|
|
350
|
+
// to re-enable/-disable the rule, we end up with legal syntax (if the user adds more properties
|
|
351
|
+
// after the disabled rule).
|
|
352
|
+
const appendSemicolonIfMissing = (propertyText: string): string =>
|
|
353
|
+
propertyText + (propertyText.endsWith(';') ? '' : ';');
|
|
354
|
+
let text: string;
|
|
355
|
+
if (disabled) {
|
|
356
|
+
// We remove comments before wrapping comment tags around propertyText, because otherwise it will
|
|
357
|
+
// create an unmatched trailing `*/`, making the text invalid. This will result in disabled
|
|
358
|
+
// CSSProperty losing its original comments, but since escaping comments will result in the parser
|
|
359
|
+
// to completely ignore and then lose this declaration, this is the best compromise so far.
|
|
360
|
+
text = '/* ' + appendSemicolonIfMissing(stripComments(propertyText)) + ' */';
|
|
361
|
+
} else {
|
|
362
|
+
text = appendSemicolonIfMissing(this.text.substring(2, propertyText.length - 2).trim());
|
|
363
|
+
}
|
|
364
|
+
return await this.setText(text, true, true);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* This stores the warning string when a CSS Property is improperly parsed.
|
|
369
|
+
*/
|
|
370
|
+
setDisplayedStringForInvalidProperty(invalidString: Common.UIString.LocalizedString): void {
|
|
371
|
+
this.#invalidString = invalidString;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Retrieve the warning string for a screen reader to announce when editing the property.
|
|
376
|
+
*/
|
|
377
|
+
getInvalidStringForInvalidProperty(): Common.UIString.LocalizedString|undefined {
|
|
378
|
+
return this.#invalidString;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
getLonghandProperties(): CSSProperty[] {
|
|
382
|
+
return this.#longhandProperties;
|
|
383
|
+
}
|
|
384
|
+
}
|