chrome-devtools-frontend 1.0.944427 → 1.0.945677
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/config/gni/devtools_grd_files.gni +4 -0
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +3 -1
- package/front_end/core/i18n/i18nImpl.ts +7 -4
- package/front_end/core/i18n/locales/en-US.json +3 -60
- package/front_end/core/i18n/locales/en-XL.json +15 -72
- package/front_end/core/protocol_client/NodeURL.ts +1 -0
- package/front_end/core/sdk/CSSMetadata.ts +0 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -3
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -3
- package/front_end/core/sdk/Cookie.ts +17 -0
- package/front_end/core/sdk/CookieModel.ts +1 -0
- package/front_end/core/sdk/DebuggerModel.ts +5 -4
- package/front_end/core/sdk/NetworkManager.ts +4 -1
- package/front_end/core/sdk/NetworkRequest.ts +2 -2
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/Script.ts +2 -3
- package/front_end/entrypoints/main/MainImpl.ts +6 -0
- package/front_end/generated/protocol.d.ts +0 -4
- package/front_end/models/bindings/BreakpointManager.ts +3 -4
- package/front_end/models/bindings/ResourceMapping.ts +1 -2
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
- package/front_end/models/emulation/EmulatedDevices.ts +2 -4
- package/front_end/models/persistence/IsolatedFileSystem.ts +7 -6
- package/front_end/models/persistence/PersistenceActions.ts +4 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +3 -4
- package/front_end/models/text_utils/ContentProvider.ts +1 -2
- package/front_end/models/text_utils/StaticContentProvider.ts +2 -3
- package/front_end/models/timeline_model/TimelineJSProfile.ts +16 -3
- package/front_end/models/timeline_model/TimelineModel.ts +1 -0
- package/front_end/models/workspace/UISourceCode.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/animation/animationTimeline.css +2 -0
- package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
- package/front_end/panels/application/BackForwardCacheView.ts +8 -1
- package/front_end/panels/application/ReportingApiView.ts +15 -1
- package/front_end/panels/application/components/EndpointsGrid.ts +63 -4
- package/front_end/panels/application/components/FrameDetailsView.ts +21 -34
- package/front_end/panels/changes/ChangesView.ts +8 -7
- package/front_end/panels/elements/StyleEditorWidget.ts +7 -7
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -15
- package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
- package/front_end/panels/emulation/DeviceModeView.ts +3 -0
- package/front_end/panels/help/ReleaseNoteText.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +7 -1
- package/front_end/panels/profiler/heapProfiler.css +2 -5
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/NavigatorView.ts +1 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/timeline/TimelineController.ts +3 -0
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -34
- package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
- package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
- package/front_end/services/window_bounds/WindowBoundsService.ts +27 -0
- package/front_end/services/window_bounds/window_bounds.ts +9 -0
- package/front_end/third_party/acorn/README.chromium +2 -2
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
- package/front_end/third_party/acorn/package/README.md +1 -1
- package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
- package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
- package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
- package/front_end/third_party/acorn/package/dist/bin.js +47 -21
- package/front_end/third_party/acorn/package/package.json +1 -1
- package/front_end/third_party/acorn-loose/README.chromium +2 -2
- package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
- package/front_end/third_party/acorn-loose/package/package.json +2 -2
- package/front_end/third_party/codemirror.next/bundle.ts +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +1 -1
- package/front_end/third_party/i18n/i18n-impl.ts +1 -1
- package/front_end/third_party/lit-html/README.chromium +2 -2
- package/front_end/third_party/lit-html/package/CHANGELOG.md +216 -28
- package/front_end/third_party/lit-html/package/LICENSE +9 -9
- package/front_end/third_party/lit-html/package/README.md +12 -162
- package/front_end/third_party/lit-html/package/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/async-directive.js +2 -7
- package/front_end/third_party/lit-html/package/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.js +44 -194
- package/front_end/third_party/lit-html/package/development/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.js +25 -9
- package/front_end/third_party/lit-html/package/development/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/development/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.js +6 -1
- package/front_end/third_party/lit-html/package/development/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.js +17 -58
- package/front_end/third_party/lit-html/package/development/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js +57 -37
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.js +4 -6
- package/front_end/third_party/lit-html/package/development/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.js +17 -7
- package/front_end/third_party/lit-html/package/development/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.js +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.js +5 -7
- package/front_end/third_party/lit-html/package/development/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js +85 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/ref.js +13 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.js +23 -9
- package/front_end/third_party/lit-html/package/development/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/template-content.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js +7 -5
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js +3 -0
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.js +63 -23
- package/front_end/third_party/lit-html/package/development/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js +9 -8
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.js +249 -76
- package/front_end/third_party/lit-html/package/development/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.js +40 -21
- package/front_end/third_party/lit-html/package/development/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js +11 -3
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.js +6 -5
- package/front_end/third_party/lit-html/package/development/static.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.js +2 -2
- package/front_end/third_party/lit-html/package/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive.js +1 -1
- package/front_end/third_party/lit-html/package/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.js +2 -6
- package/front_end/third_party/lit-html/package/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.js +2 -5
- package/front_end/third_party/lit-html/package/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.js +2 -5
- package/front_end/third_party/lit-html/package/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.js +2 -4
- package/front_end/third_party/lit-html/package/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.js +1 -4
- package/front_end/third_party/lit-html/package/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js +7 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/ref.js +2 -5
- package/front_end/third_party/lit-html/package/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.js +2 -5
- package/front_end/third_party/lit-html/package/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/template-content.js +2 -4
- package/front_end/third_party/lit-html/package/directives/template-content.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js +2 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.js +2 -6
- package/front_end/third_party/lit-html/package/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.js +2 -5
- package/front_end/third_party/lit-html/package/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/package.json +75 -24
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.js +2 -2
- package/front_end/third_party/lit-html/package/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/static.js +1 -1
- package/front_end/third_party/lit-html/package/static.js.map +1 -1
- package/front_end/third_party/marked/README.chromium +2 -2
- package/front_end/third_party/marked/marked.ts +2 -2
- package/front_end/third_party/marked/package/README.md +7 -1
- package/front_end/third_party/marked/package/bin/marked.js +214 -0
- package/front_end/third_party/marked/package/lib/marked.cjs +2907 -0
- package/front_end/third_party/marked/package/lib/marked.esm.d.ts +1 -3
- package/front_end/third_party/marked/package/lib/marked.esm.js +627 -586
- package/front_end/third_party/marked/package/lib/marked.umd.js +2913 -0
- package/front_end/third_party/marked/package/man/marked.1 +5 -24
- package/front_end/third_party/marked/package/man/marked.1.txt +21 -31
- package/front_end/third_party/marked/package/marked.min.js +1 -1
- package/front_end/third_party/marked/package/package.json +41 -32
- package/front_end/third_party/marked/package/src/Lexer.js +109 -108
- package/front_end/third_party/marked/package/src/Parser.js +38 -15
- package/front_end/third_party/marked/package/src/Renderer.js +5 -5
- package/front_end/third_party/marked/package/src/Slugger.js +2 -2
- package/front_end/third_party/marked/package/src/TextRenderer.js +2 -2
- package/front_end/third_party/marked/package/src/Tokenizer.js +215 -190
- package/front_end/third_party/marked/package/src/defaults.js +6 -9
- package/front_end/third_party/marked/package/src/helpers.js +16 -27
- package/front_end/third_party/marked/package/src/marked.js +146 -63
- package/front_end/third_party/marked/package/src/rules.js +20 -45
- package/front_end/third_party/wasmparser/README.chromium +2 -2
- package/front_end/third_party/wasmparser/package/.github/workflows/main.yml +47 -0
- package/front_end/third_party/wasmparser/package/CHANGELOG.md +12 -0
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/package.json +1 -1
- package/front_end/third_party/wasmparser/package/src/WasmParser.ts +53 -53
- package/front_end/ui/components/adorners/Adorner.ts +14 -14
- package/front_end/ui/components/buttons/Button.ts +133 -42
- package/front_end/ui/components/buttons/button.css +31 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
- package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/docs/button/basic.html +3 -0
- package/front_end/ui/components/docs/button/basic.ts +58 -0
- package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
- package/front_end/ui/components/icon_button/Icon.ts +24 -21
- package/front_end/ui/components/icon_button/IconButton.ts +31 -31
- package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +25 -25
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
- package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
- package/front_end/ui/components/report_view/ReportView.ts +18 -18
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
- package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
- package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
- package/front_end/ui/components/text_editor/TextEditor.ts +68 -36
- package/front_end/ui/components/text_editor/config.ts +4 -2
- package/front_end/ui/components/text_editor/javascript.ts +6 -6
- package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
- package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
- package/front_end/ui/legacy/Infobar.ts +9 -0
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/ViewManager.ts +6 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +20 -0
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/inspector_overlay/main.ts +3 -0
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
6
|
import { Disconnectable, Part } from './lit-html';
|
|
7
|
-
export { AttributePart, BooleanAttributePart, ChildPart, ElementPart, EventPart, Part, } from './lit-html';
|
|
7
|
+
export { AttributePart, BooleanAttributePart, ChildPart, ElementPart, EventPart, Part, PropertyPart, } from './lit-html';
|
|
8
8
|
export interface DirectiveClass {
|
|
9
9
|
new (part: PartInfo): Directive;
|
|
10
10
|
}
|
|
@@ -18,10 +18,6 @@ export declare type DirectiveParameters<C extends Directive> = Parameters<C['ren
|
|
|
18
18
|
* returns a DirectiveResult object that captures the arguments.
|
|
19
19
|
*/
|
|
20
20
|
export interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {
|
|
21
|
-
/** @internal */
|
|
22
|
-
_$litDirective$: C;
|
|
23
|
-
/** @internal */
|
|
24
|
-
values: DirectiveParameters<InstanceType<C>>;
|
|
25
21
|
}
|
|
26
22
|
export declare const PartType: {
|
|
27
23
|
readonly ATTRIBUTE: 1;
|
|
@@ -61,18 +57,9 @@ export declare const directive: <C extends DirectiveClass>(c: C) => (...values:
|
|
|
61
57
|
* implement `render` and/or `update`, and then pass their subclass to
|
|
62
58
|
* `directive`.
|
|
63
59
|
*/
|
|
64
|
-
export declare abstract class Directive {
|
|
65
|
-
__part: Part;
|
|
66
|
-
__attributeIndex: number | undefined;
|
|
67
|
-
__directive?: Directive;
|
|
68
|
-
_$parent: Disconnectable;
|
|
69
|
-
_$disconnetableChildren?: Set<Disconnectable>;
|
|
70
|
-
_$setDirectiveConnected?(isConnected: boolean): void;
|
|
60
|
+
export declare abstract class Directive implements Disconnectable {
|
|
71
61
|
constructor(_partInfo: PartInfo);
|
|
72
|
-
|
|
73
|
-
_$initialize(part: Part, parent: Disconnectable, attributeIndex: number | undefined): void;
|
|
74
|
-
/** @internal */
|
|
75
|
-
_$resolve(part: Part, props: Array<unknown>): unknown;
|
|
62
|
+
get _$isConnected(): boolean;
|
|
76
63
|
abstract render(...props: Array<unknown>): unknown;
|
|
77
64
|
update(_part: Part, props: Array<unknown>): unknown;
|
|
78
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,IAAI,
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,IAAI,EACJ,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,KAAK,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;CACjC;AAED;;;GAGG;AACH,oBAAY,mBAAmB,CAAC,CAAC,SAAS,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;CAOzE;AAED,eAAO,MAAM,QAAQ;;;;;;;CAOX,CAAC;AAEX,oBAAY,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EACT,OAAO,QAAQ,CAAC,SAAS,GACzB,OAAO,QAAQ,CAAC,QAAQ,GACxB,OAAO,QAAQ,CAAC,iBAAiB,GACjC,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;CACxC;AAED;;;;;GAKG;AACH,oBAAY,QAAQ,GAAG,aAAa,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,SAAS,8GAMlB,CAAC;AAEL;;;;GAIG;AACH,8BAAsB,SAAU,YAAW,cAAc;gBAkB3C,SAAS,EAAE,QAAQ;IAG/B,IAAI,aAAa,YAEhB;IAiBD,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;IAElD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;CAGpD"}
|
|
@@ -16,7 +16,8 @@ export const PartType = {
|
|
|
16
16
|
* function has the same parameters as the directive's render() method.
|
|
17
17
|
*/
|
|
18
18
|
export const directive = (c) => (...values) => ({
|
|
19
|
-
|
|
19
|
+
// This property needs to remain unminified.
|
|
20
|
+
['_$litDirective$']: c,
|
|
20
21
|
values,
|
|
21
22
|
});
|
|
22
23
|
/**
|
|
@@ -26,6 +27,10 @@ export const directive = (c) => (...values) => ({
|
|
|
26
27
|
*/
|
|
27
28
|
export class Directive {
|
|
28
29
|
constructor(_partInfo) { }
|
|
30
|
+
// See comment in Disconnectable interface for why this is a getter
|
|
31
|
+
get _$isConnected() {
|
|
32
|
+
return this._$parent._$isConnected;
|
|
33
|
+
}
|
|
29
34
|
/** @internal */
|
|
30
35
|
_$initialize(part, parent, attributeIndex) {
|
|
31
36
|
this.__part = part;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.js","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"directive.js","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,iBAAiB,EAAE,CAAC;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;CACF,CAAC;AA+BX;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GACpB,CAA2B,CAAI,EAAE,EAAE,CACnC,CAAC,GAAG,MAA4C,EAAsB,EAAE,CAAC,CAAC;IACxE,4CAA4C;IAC5C,CAAC,iBAAiB,CAAC,EAAE,CAAC;IACtB,MAAM;CACP,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,OAAgB,SAAS;IAkB7B,YAAY,SAAmB,IAAG,CAAC;IAEnC,mEAAmE;IACnE,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,gBAAgB;IAChB,YAAY,CACV,IAAU,EACV,MAAsB,EACtB,cAAkC;QAElC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC;IACzC,CAAC;IACD,gBAAgB;IAChB,SAAS,CAAC,IAAU,EAAE,KAAqB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAID,MAAM,CAAC,KAAW,EAAE,KAAqB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = typeof PartType[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n"]}
|
|
@@ -3,21 +3,14 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ChildPart } from '../lit-html.js';
|
|
7
7
|
import { DirectiveParameters, PartInfo } from '../directive.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare class AsyncAppendDirective extends AsyncDirective {
|
|
12
|
-
private _value?;
|
|
13
|
-
private _reconnectResolver?;
|
|
14
|
-
private _reconnectPromise?;
|
|
8
|
+
import { AsyncReplaceDirective } from './async-replace.js';
|
|
9
|
+
declare class AsyncAppendDirective extends AsyncReplaceDirective {
|
|
10
|
+
private __childPart;
|
|
15
11
|
constructor(partInfo: PartInfo);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
private __iterate;
|
|
19
|
-
disconnected(): void;
|
|
20
|
-
reconnected(): void;
|
|
12
|
+
update(part: ChildPart, params: DirectiveParameters<this>): typeof import("../lit-html.js").noChange | undefined;
|
|
13
|
+
protected commitValue(value: unknown, index: number): void;
|
|
21
14
|
}
|
|
22
15
|
/**
|
|
23
16
|
* A directive that renders the items of an async iterable[1], appending new
|
|
@@ -37,7 +30,7 @@ declare class AsyncAppendDirective extends AsyncDirective {
|
|
|
37
30
|
* @param mapper An optional function that maps from (value, index) to another
|
|
38
31
|
* value. Useful for generating templates for each item in the iterable.
|
|
39
32
|
*/
|
|
40
|
-
export declare const asyncAppend: (value: AsyncIterable<unknown>, _mapper?:
|
|
33
|
+
export declare const asyncAppend: (value: AsyncIterable<unknown>, _mapper?: ((v: unknown, index?: number | undefined) => unknown) | undefined) => import("../directive.js").DirectiveResult<typeof AsyncAppendDirective>;
|
|
41
34
|
/**
|
|
42
35
|
* The type of the class that powers this directive. Necessary for naming the
|
|
43
36
|
* directive's return type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-append.d.ts","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"async-append.d.ts","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAEL,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAOzD,cAAM,oBAAqB,SAAQ,qBAAqB;IACtD,OAAO,CAAC,WAAW,CAAa;gBAGpB,QAAQ,EAAE,QAAQ;IAQrB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC;cAM/C,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CAU7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,wLAAkC,CAAC;AAE3D;;;GAGG;AACH,YAAY,EAAC,oBAAoB,EAAC,CAAC"}
|
|
@@ -3,73 +3,32 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import { AsyncDirective } from '../async-directive.js';
|
|
7
|
-
import { clearPart, insertPart, setChildPartValue, } from '../directive-helpers.js';
|
|
8
6
|
import { directive, PartType, } from '../directive.js';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
class AsyncAppendDirective extends
|
|
7
|
+
import { AsyncReplaceDirective } from './async-replace.js';
|
|
8
|
+
import { clearPart, insertPart, setChildPartValue, } from '../directive-helpers.js';
|
|
9
|
+
class AsyncAppendDirective extends AsyncReplaceDirective {
|
|
10
|
+
// Override AsyncReplace to narrow the allowed part type to ChildPart only
|
|
12
11
|
constructor(partInfo) {
|
|
13
12
|
super(partInfo);
|
|
14
13
|
if (partInfo.type !== PartType.CHILD) {
|
|
15
14
|
throw new Error('asyncAppend can only be used in child expressions');
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
update(part, [value, mapper]) {
|
|
24
|
-
// If we've already set up this particular iterable, we don't need
|
|
25
|
-
// to do anything.
|
|
26
|
-
if (value === this._value) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
this._value = value;
|
|
30
|
-
this.__iterate(part, mapper);
|
|
31
|
-
return noChange;
|
|
17
|
+
// Override AsyncReplace to save the part since we need to append into it
|
|
18
|
+
update(part, params) {
|
|
19
|
+
this.__childPart = part;
|
|
20
|
+
return super.update(part, params);
|
|
32
21
|
}
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Check to make sure that value is the still the current value of
|
|
40
|
-
// the part, and if not bail because a new value owns this part
|
|
41
|
-
if (this._value !== value) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
// If we were disconnected, pause until reconnected
|
|
45
|
-
if (this._reconnectPromise) {
|
|
46
|
-
await this._reconnectPromise;
|
|
47
|
-
}
|
|
48
|
-
// When we get the first value, clear the part. This lets the
|
|
49
|
-
// previous value display until we can replace it.
|
|
50
|
-
if (i === 0) {
|
|
51
|
-
clearPart(part);
|
|
52
|
-
}
|
|
53
|
-
// As a convenience, because functional-programming-style
|
|
54
|
-
// transforms of iterables and async iterables requires a library,
|
|
55
|
-
// we accept a mapper function. This is especially convenient for
|
|
56
|
-
// rendering a template for each item.
|
|
57
|
-
if (mapper !== undefined) {
|
|
58
|
-
v = mapper(v, i);
|
|
59
|
-
}
|
|
60
|
-
const newPart = insertPart(part);
|
|
61
|
-
setChildPartValue(newPart, v);
|
|
62
|
-
i++;
|
|
22
|
+
// Override AsyncReplace to append rather than replace
|
|
23
|
+
commitValue(value, index) {
|
|
24
|
+
// When we get the first value, clear the part. This lets the
|
|
25
|
+
// previous value display until we can replace it.
|
|
26
|
+
if (index === 0) {
|
|
27
|
+
clearPart(this.__childPart);
|
|
63
28
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this._reconnectPromise = new Promise((resolve) => (this._reconnectResolver = resolve));
|
|
68
|
-
}
|
|
69
|
-
reconnected() {
|
|
70
|
-
// Resume iteration when reconnected
|
|
71
|
-
this._reconnectPromise = undefined;
|
|
72
|
-
this._reconnectResolver();
|
|
29
|
+
// Create and insert a new part and set its value to the next value
|
|
30
|
+
const newPart = insertPart(this.__childPart);
|
|
31
|
+
setChildPartValue(newPart, value);
|
|
73
32
|
}
|
|
74
33
|
}
|
|
75
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-append.js","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"async-append.js","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,SAAS,EAGT,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,oBAAqB,SAAQ,qBAAqB;IAGtD,0EAA0E;IAC1E,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACtE;IACH,CAAC;IAED,yEAAyE;IAChE,MAAM,CAAC,IAAe,EAAE,MAAiC;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,sDAAsD;IACnC,WAAW,CAAC,KAAc,EAAE,KAAa;QAC1D,6DAA6D;QAC7D,kDAAkD;QAClD,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC7B;QACD,mEAAmE;QACnE,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7C,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart} from '../lit-html.js';\nimport {\n directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\nimport {AsyncReplaceDirective} from './async-replace.js';\nimport {\n clearPart,\n insertPart,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nclass AsyncAppendDirective extends AsyncReplaceDirective {\n private __childPart!: ChildPart;\n\n // Override AsyncReplace to narrow the allowed part type to ChildPart only\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('asyncAppend can only be used in child expressions');\n }\n }\n\n // Override AsyncReplace to save the part since we need to append into it\n override update(part: ChildPart, params: DirectiveParameters<this>) {\n this.__childPart = part;\n return super.update(part, params);\n }\n\n // Override AsyncReplace to append rather than replace\n protected override commitValue(value: unknown, index: number) {\n // When we get the first value, clear the part. This lets the\n // previous value display until we can replace it.\n if (index === 0) {\n clearPart(this.__childPart);\n }\n // Create and insert a new part and set its value to the next value\n const newPart = insertPart(this.__childPart);\n setChildPartValue(newPart, value);\n }\n}\n\n/**\n * A directive that renders the items of an async iterable[1], appending new\n * values after previous values, similar to the built-in support for iterables.\n * This directive is usable only in child expressions.\n *\n * Async iterables are objects with a [Symbol.asyncIterator] method, which\n * returns an iterator who's `next()` method returns a Promise. When a new\n * value is available, the Promise resolves and the value is appended to the\n * Part controlled by the directive. If another value other than this\n * directive has been set on the Part, the iterable will no longer be listened\n * to and new values won't be written to the Part.\n *\n * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n *\n * @param value An async iterable\n * @param mapper An optional function that maps from (value, index) to another\n * value. Useful for generating templates for each item in the iterable.\n */\nexport const asyncAppend = directive(AsyncAppendDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {AsyncAppendDirective};\n"]}
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import { AsyncDirective } from '../async-directive.js';
|
|
7
|
-
import { DirectiveParameters } from '../directive.js';
|
|
8
6
|
import { ChildPart, noChange } from '../lit-html.js';
|
|
9
|
-
|
|
7
|
+
import { DirectiveParameters } from '../directive.js';
|
|
8
|
+
import { AsyncDirective } from '../async-directive.js';
|
|
10
9
|
declare type Mapper<T> = (v: T, index?: number) => unknown;
|
|
11
|
-
declare class AsyncReplaceDirective extends AsyncDirective {
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private
|
|
10
|
+
export declare class AsyncReplaceDirective extends AsyncDirective {
|
|
11
|
+
private __value?;
|
|
12
|
+
private __weakThis;
|
|
13
|
+
private __pauser;
|
|
15
14
|
render<T>(value: AsyncIterable<T>, _mapper?: Mapper<T>): symbol;
|
|
16
15
|
update(_part: ChildPart, [value, mapper]: DirectiveParameters<this>): typeof noChange | undefined;
|
|
17
|
-
|
|
16
|
+
protected commitValue(value: unknown, _index: number): void;
|
|
18
17
|
disconnected(): void;
|
|
19
18
|
reconnected(): void;
|
|
20
19
|
}
|
|
@@ -23,7 +22,7 @@ declare class AsyncReplaceDirective extends AsyncDirective {
|
|
|
23
22
|
* previous values with new values, so that only one value is ever rendered
|
|
24
23
|
* at a time. This directive may be used in any expression type.
|
|
25
24
|
*
|
|
26
|
-
* Async iterables are objects with a [Symbol.asyncIterator] method, which
|
|
25
|
+
* Async iterables are objects with a `[Symbol.asyncIterator]` method, which
|
|
27
26
|
* returns an iterator who's `next()` method returns a Promise. When a new
|
|
28
27
|
* value is available, the Promise resolves and the value is rendered to the
|
|
29
28
|
* Part controlled by the directive. If another value other than this
|
|
@@ -37,9 +36,5 @@ declare class AsyncReplaceDirective extends AsyncDirective {
|
|
|
37
36
|
* value. Useful for generating templates for each item in the iterable.
|
|
38
37
|
*/
|
|
39
38
|
export declare const asyncReplace: (value: AsyncIterable<unknown>, _mapper?: Mapper<unknown> | undefined) => import("../directive.js").DirectiveResult<typeof AsyncReplaceDirective>;
|
|
40
|
-
|
|
41
|
-
* The type of the class that powers this directive. Necessary for naming the
|
|
42
|
-
* directive's return type.
|
|
43
|
-
*/
|
|
44
|
-
export type { AsyncReplaceDirective };
|
|
39
|
+
export {};
|
|
45
40
|
//# sourceMappingURL=async-replace.d.ts.map
|
package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-replace.d.ts","sourceRoot":"","sources":["../../src/directives/async-replace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAY,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"async-replace.d.ts","sourceRoot":"","sources":["../../src/directives/async-replace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAY,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAGrD,aAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAEnD,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,OAAO,CAAC,OAAO,CAAC,CAAyB;IACzC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAIhC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAI7C,MAAM,CACb,KAAK,EAAE,SAAS,EAChB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;IAqD5C,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAI3C,YAAY;IAKZ,WAAW;CAIrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,mJAAmC,CAAC"}
|
|
@@ -3,60 +3,80 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import { AsyncDirective } from '../async-directive.js';
|
|
7
|
-
import { directive } from '../directive.js';
|
|
8
6
|
import { noChange } from '../lit-html.js';
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { directive } from '../directive.js';
|
|
8
|
+
import { AsyncDirective } from '../async-directive.js';
|
|
9
|
+
import { Pauser, PseudoWeakRef, forAwaitOf } from './private-async-helpers.js';
|
|
10
|
+
export class AsyncReplaceDirective extends AsyncDirective {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.__weakThis = new PseudoWeakRef(this);
|
|
14
|
+
this.__pauser = new Pauser();
|
|
15
|
+
}
|
|
11
16
|
// @ts-expect-error value not used, but we want a nice parameter for docs
|
|
12
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
18
|
render(value, _mapper) {
|
|
14
19
|
return noChange;
|
|
15
20
|
}
|
|
16
21
|
update(_part, [value, mapper]) {
|
|
22
|
+
// If our initial render occurs while disconnected, ensure that the pauser
|
|
23
|
+
// and weakThis are in the disconnected state
|
|
24
|
+
if (!this.isConnected) {
|
|
25
|
+
this.disconnected();
|
|
26
|
+
}
|
|
17
27
|
// If we've already set up this particular iterable, we don't need
|
|
18
28
|
// to do anything.
|
|
19
|
-
if (value === this.
|
|
29
|
+
if (value === this.__value) {
|
|
20
30
|
return;
|
|
21
31
|
}
|
|
22
|
-
this.
|
|
23
|
-
this.__iterate(mapper);
|
|
24
|
-
return noChange;
|
|
25
|
-
}
|
|
26
|
-
// Separate function to avoid an iffe in update; update can't be async
|
|
27
|
-
// because its return value must be `noChange`
|
|
28
|
-
async __iterate(mapper) {
|
|
32
|
+
this.__value = value;
|
|
29
33
|
let i = 0;
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
await
|
|
34
|
+
const { __weakThis: weakThis, __pauser: pauser } = this;
|
|
35
|
+
// Note, the callback avoids closing over `this` so that the directive
|
|
36
|
+
// can be gc'ed before the promise resolves; instead `this` is retrieved
|
|
37
|
+
// from `weakThis`, which can break the hard reference in the closure when
|
|
38
|
+
// the directive disconnects
|
|
39
|
+
forAwaitOf(value, async (v) => {
|
|
40
|
+
// The while loop here handles the case that the connection state
|
|
41
|
+
// thrashes, causing the pauser to resume and then get re-paused
|
|
42
|
+
while (pauser.get()) {
|
|
43
|
+
await pauser.get();
|
|
40
44
|
}
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
// If the callback gets here and there is no `this`, it means that the
|
|
46
|
+
// directive has been disconnected and garbage collected and we don't
|
|
47
|
+
// need to do anything else
|
|
48
|
+
const _this = weakThis.deref();
|
|
49
|
+
if (_this !== undefined) {
|
|
50
|
+
// Check to make sure that value is the still the current value of
|
|
51
|
+
// the part, and if not bail because a new value owns this part
|
|
52
|
+
if (_this.__value !== value) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// As a convenience, because functional-programming-style
|
|
56
|
+
// transforms of iterables and async iterables requires a library,
|
|
57
|
+
// we accept a mapper function. This is especially convenient for
|
|
58
|
+
// rendering a template for each item.
|
|
59
|
+
if (mapper !== undefined) {
|
|
60
|
+
v = mapper(v, i);
|
|
61
|
+
}
|
|
62
|
+
_this.commitValue(v, i);
|
|
63
|
+
i++;
|
|
47
64
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
return noChange;
|
|
68
|
+
}
|
|
69
|
+
// Override point for AsyncAppend to append rather than replace
|
|
70
|
+
commitValue(value, _index) {
|
|
71
|
+
this.setValue(value);
|
|
51
72
|
}
|
|
52
73
|
disconnected() {
|
|
53
|
-
|
|
54
|
-
this.
|
|
74
|
+
this.__weakThis.disconnect();
|
|
75
|
+
this.__pauser.pause();
|
|
55
76
|
}
|
|
56
77
|
reconnected() {
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
this._reconnectResolver();
|
|
78
|
+
this.__weakThis.reconnect(this);
|
|
79
|
+
this.__pauser.resume();
|
|
60
80
|
}
|
|
61
81
|
}
|
|
62
82
|
/**
|
|
@@ -64,7 +84,7 @@ class AsyncReplaceDirective extends AsyncDirective {
|
|
|
64
84
|
* previous values with new values, so that only one value is ever rendered
|
|
65
85
|
* at a time. This directive may be used in any expression type.
|
|
66
86
|
*
|
|
67
|
-
* Async iterables are objects with a [Symbol.asyncIterator] method, which
|
|
87
|
+
* Async iterables are objects with a `[Symbol.asyncIterator]` method, which
|
|
68
88
|
* returns an iterator who's `next()` method returns a Promise. When a new
|
|
69
89
|
* value is available, the Promise resolves and the value is rendered to the
|
|
70
90
|
* Part controlled by the directive. If another value other than this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-replace.js","sourceRoot":"","sources":["../../src/directives/async-replace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAY,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"async-replace.js","sourceRoot":"","sources":["../../src/directives/async-replace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAY,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,4BAA4B,CAAC;AAI7E,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IAAzD;;QAEU,eAAU,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;QACrC,aAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;IA4ElC,CAAC;IA1EC,yEAAyE;IACzE,6DAA6D;IAC7D,MAAM,CAAI,KAAuB,EAAE,OAAmB;QACpD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEQ,MAAM,CACb,KAAgB,EAChB,CAAC,KAAK,EAAE,MAAM,CAA4B;QAE1C,0EAA0E;QAC1E,6CAA6C;QAC7C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;QACD,kEAAkE;QAClE,kBAAkB;QAClB,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE;YAC1B,OAAO;SACR;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,EAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,IAAI,CAAC;QACtD,sEAAsE;QACtE,wEAAwE;QACxE,0EAA0E;QAC1E,4BAA4B;QAC5B,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,CAAU,EAAE,EAAE;YACrC,iEAAiE;YACjE,gEAAgE;YAChE,OAAO,MAAM,CAAC,GAAG,EAAE,EAAE;gBACnB,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;aACpB;YACD,sEAAsE;YACtE,qEAAqE;YACrE,2BAA2B;YAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC/B,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,kEAAkE;gBAClE,+DAA+D;gBAC/D,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,EAAE;oBAC3B,OAAO,KAAK,CAAC;iBACd;gBAED,yDAAyD;gBACzD,kEAAkE;gBAClE,iEAAiE;gBACjE,sCAAsC;gBACtC,IAAI,MAAM,KAAK,SAAS,EAAE;oBACxB,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBAClB;gBAED,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxB,CAAC,EAAE,CAAC;aACL;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IACrD,WAAW,CAAC,KAAc,EAAE,MAAc;QAClD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAEQ,YAAY;QACnB,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEQ,WAAW;QAClB,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart, noChange} from '../lit-html.js';\nimport {directive, DirectiveParameters} from '../directive.js';\nimport {AsyncDirective} from '../async-directive.js';\nimport {Pauser, PseudoWeakRef, forAwaitOf} from './private-async-helpers.js';\n\ntype Mapper<T> = (v: T, index?: number) => unknown;\n\nexport class AsyncReplaceDirective extends AsyncDirective {\n private __value?: AsyncIterable<unknown>;\n private __weakThis = new PseudoWeakRef(this);\n private __pauser = new Pauser();\n\n // @ts-expect-error value not used, but we want a nice parameter for docs\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render<T>(value: AsyncIterable<T>, _mapper?: Mapper<T>) {\n return noChange;\n }\n\n override update(\n _part: ChildPart,\n [value, mapper]: DirectiveParameters<this>\n ) {\n // If our initial render occurs while disconnected, ensure that the pauser\n // and weakThis are in the disconnected state\n if (!this.isConnected) {\n this.disconnected();\n }\n // If we've already set up this particular iterable, we don't need\n // to do anything.\n if (value === this.__value) {\n return;\n }\n this.__value = value;\n let i = 0;\n const {__weakThis: weakThis, __pauser: pauser} = this;\n // Note, the callback avoids closing over `this` so that the directive\n // can be gc'ed before the promise resolves; instead `this` is retrieved\n // from `weakThis`, which can break the hard reference in the closure when\n // the directive disconnects\n forAwaitOf(value, async (v: unknown) => {\n // The while loop here handles the case that the connection state\n // thrashes, causing the pauser to resume and then get re-paused\n while (pauser.get()) {\n await pauser.get();\n }\n // If the callback gets here and there is no `this`, it means that the\n // directive has been disconnected and garbage collected and we don't\n // need to do anything else\n const _this = weakThis.deref();\n if (_this !== undefined) {\n // Check to make sure that value is the still the current value of\n // the part, and if not bail because a new value owns this part\n if (_this.__value !== value) {\n return false;\n }\n\n // As a convenience, because functional-programming-style\n // transforms of iterables and async iterables requires a library,\n // we accept a mapper function. This is especially convenient for\n // rendering a template for each item.\n if (mapper !== undefined) {\n v = mapper(v, i);\n }\n\n _this.commitValue(v, i);\n i++;\n }\n return true;\n });\n return noChange;\n }\n\n // Override point for AsyncAppend to append rather than replace\n protected commitValue(value: unknown, _index: number) {\n this.setValue(value);\n }\n\n override disconnected() {\n this.__weakThis.disconnect();\n this.__pauser.pause();\n }\n\n override reconnected() {\n this.__weakThis.reconnect(this);\n this.__pauser.resume();\n }\n}\n\n/**\n * A directive that renders the items of an async iterable[1], replacing\n * previous values with new values, so that only one value is ever rendered\n * at a time. This directive may be used in any expression type.\n *\n * Async iterables are objects with a `[Symbol.asyncIterator]` method, which\n * returns an iterator who's `next()` method returns a Promise. When a new\n * value is available, the Promise resolves and the value is rendered to the\n * Part controlled by the directive. If another value other than this\n * directive has been set on the Part, the iterable will no longer be listened\n * to and new values won't be written to the Part.\n *\n * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n *\n * @param value An async iterable\n * @param mapper An optional function that maps from (value, index) to another\n * value. Useful for generating templates for each item in the iterable.\n */\nexport const asyncReplace = directive(AsyncReplaceDirective);\n"]}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
|
7
6
|
import { ChildPart } from '../lit-html.js';
|
|
8
|
-
|
|
7
|
+
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
|
9
8
|
declare class CacheDirective extends Directive {
|
|
10
9
|
private _templateCache;
|
|
11
10
|
private _value?;
|
|
@@ -19,7 +18,7 @@ declare class CacheDirective extends Directive {
|
|
|
19
18
|
*
|
|
20
19
|
* Example:
|
|
21
20
|
*
|
|
22
|
-
* ```
|
|
21
|
+
* ```js
|
|
23
22
|
* let checked = false;
|
|
24
23
|
*
|
|
25
24
|
* html`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/directives/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/directives/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EAIV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACT,MAAM,iBAAiB,CAAC;AASzB,cAAM,cAAe,SAAQ,SAAS;IACpC,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,QAAQ,EAAE,QAAQ;IAI9B,MAAM,CAAC,CAAC,EAAE,OAAO;IAMR,MAAM,CAAC,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CA8CzE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,kFAA4B,CAAC;AAE/C;;;GAGG;AACH,YAAY,EAAC,cAAc,EAAC,CAAC"}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { render, nothing, } from '../lit-html.js';
|
|
7
7
|
import { directive, Directive, } from '../directive.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { clearPart, getCommittedValue, insertPart, isTemplateResult, setCommittedValue, } from '../directive-helpers.js';
|
|
10
9
|
class CacheDirective extends Directive {
|
|
11
10
|
constructor(partInfo) {
|
|
12
11
|
super(partInfo);
|
|
@@ -30,12 +29,12 @@ class CacheDirective extends Directive {
|
|
|
30
29
|
if (cachedContainerPart === undefined) {
|
|
31
30
|
const fragment = document.createDocumentFragment();
|
|
32
31
|
cachedContainerPart = render(nothing, fragment);
|
|
32
|
+
cachedContainerPart.setConnected(false);
|
|
33
33
|
this._templateCache.set(this._value.strings, cachedContainerPart);
|
|
34
34
|
}
|
|
35
35
|
// Move into cache
|
|
36
36
|
setCommittedValue(cachedContainerPart, [childPart]);
|
|
37
37
|
insertPart(cachedContainerPart, undefined, childPart);
|
|
38
|
-
childPart.setConnected(false);
|
|
39
38
|
}
|
|
40
39
|
// If the new value is a TemplateResult and the previous value is not,
|
|
41
40
|
// or is a different Template as the previous value, restore the child
|
|
@@ -51,7 +50,6 @@ class CacheDirective extends Directive {
|
|
|
51
50
|
clearPart(containerPart);
|
|
52
51
|
insertPart(containerPart, undefined, cachedPart);
|
|
53
52
|
setCommittedValue(containerPart, [cachedPart]);
|
|
54
|
-
cachedPart.setConnected(true);
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
this._value = v;
|
|
@@ -68,7 +66,7 @@ class CacheDirective extends Directive {
|
|
|
68
66
|
*
|
|
69
67
|
* Example:
|
|
70
68
|
*
|
|
71
|
-
* ```
|
|
69
|
+
* ```js
|
|
72
70
|
* let checked = false;
|
|
73
71
|
*
|
|
74
72
|
* html`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/directives/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/directives/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,MAAM,EACN,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EACT,SAAS,GAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,cAAe,SAAQ,SAAS;IAIpC,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAJV,mBAAc,GAAG,IAAI,OAAO,EAAkC,CAAC;IAKvE,CAAC;IAED,MAAM,CAAC,CAAU;QACf,wEAAwE;QACxE,iDAAiD;QACjD,OAAO,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IAEQ,MAAM,CAAC,aAAwB,EAAE,CAAC,CAAC,CAA4B;QACtE,sEAAsE;QACtE,wEAAwE;QACxE,kBAAkB;QAClB,IACE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC;YAC7B,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC,EAC3D;YACA,4DAA4D;YAC5D,MAAM,SAAS,GAAG,iBAAiB,CAAC,aAAa,CAAqB,CAAC;YACvE,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,EAAG,CAAC;YACnC,IAAI,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvE,IAAI,mBAAmB,KAAK,SAAS,EAAE;gBACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,sBAAsB,EAAE,CAAC;gBACnD,mBAAmB,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBAChD,mBAAmB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBACxC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;aACnE;YACD,kBAAkB;YAClB,iBAAiB,CAAC,mBAAmB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YACpD,UAAU,CAAC,mBAAmB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;SACvD;QACD,sEAAsE;QACtE,sEAAsE;QACtE,uBAAuB;QACvB,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE;YACvB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE;gBACvE,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC/D,IAAI,mBAAmB,KAAK,SAAS,EAAE;oBACrC,0DAA0D;oBAC1D,MAAM,SAAS,GAAG,iBAAiB,CACjC,mBAAmB,CACA,CAAC;oBACtB,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,EAAG,CAAC;oBACpC,iCAAiC;oBACjC,SAAS,CAAC,aAAa,CAAC,CAAC;oBACzB,UAAU,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;oBACjD,iBAAiB,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;iBAChD;aACF;YACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjB;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;SACzB;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {\n TemplateResult,\n ChildPart,\n RootPart,\n render,\n nothing,\n} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n} from '../directive.js';\nimport {\n clearPart,\n getCommittedValue,\n insertPart,\n isTemplateResult,\n setCommittedValue,\n} from '../directive-helpers.js';\n\nclass CacheDirective extends Directive {\n private _templateCache = new WeakMap<TemplateStringsArray, RootPart>();\n private _value?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n }\n\n render(v: unknown) {\n // Return an array of the value to induce lit-html to create a ChildPart\n // for the value that we can move into the cache.\n return [v];\n }\n\n override update(containerPart: ChildPart, [v]: DirectiveParameters<this>) {\n // If the previous value is a TemplateResult and the new value is not,\n // or is a different Template as the previous value, move the child part\n // into the cache.\n if (\n isTemplateResult(this._value) &&\n (!isTemplateResult(v) || this._value.strings !== v.strings)\n ) {\n // This is always an array because we return [v] in render()\n const partValue = getCommittedValue(containerPart) as Array<ChildPart>;\n const childPart = partValue.pop()!;\n let cachedContainerPart = this._templateCache.get(this._value.strings);\n if (cachedContainerPart === undefined) {\n const fragment = document.createDocumentFragment();\n cachedContainerPart = render(nothing, fragment);\n cachedContainerPart.setConnected(false);\n this._templateCache.set(this._value.strings, cachedContainerPart);\n }\n // Move into cache\n setCommittedValue(cachedContainerPart, [childPart]);\n insertPart(cachedContainerPart, undefined, childPart);\n }\n // If the new value is a TemplateResult and the previous value is not,\n // or is a different Template as the previous value, restore the child\n // part from the cache.\n if (isTemplateResult(v)) {\n if (!isTemplateResult(this._value) || this._value.strings !== v.strings) {\n const cachedContainerPart = this._templateCache.get(v.strings);\n if (cachedContainerPart !== undefined) {\n // Move the cached part back into the container part value\n const partValue = getCommittedValue(\n cachedContainerPart\n ) as Array<ChildPart>;\n const cachedPart = partValue.pop()!;\n // Move cached part back into DOM\n clearPart(containerPart);\n insertPart(containerPart, undefined, cachedPart);\n setCommittedValue(containerPart, [cachedPart]);\n }\n }\n this._value = v;\n } else {\n this._value = undefined;\n }\n return this.render(v);\n }\n}\n\n/**\n * Enables fast switching between multiple templates by caching the DOM nodes\n * and TemplateInstances produced by the templates.\n *\n * Example:\n *\n * ```js\n * let checked = false;\n *\n * html`\n * ${cache(checked ? html`input is checked` : html`input is not checked`)}\n * `\n * ```\n */\nexport const cache = directive(CacheDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {CacheDirective};\n"]}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
|
7
6
|
import { AttributePart, noChange } from '../lit-html.js';
|
|
8
|
-
|
|
7
|
+
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
|
9
8
|
/**
|
|
10
9
|
* A key-value set of class names to truthy values.
|
|
11
10
|
*/
|
|
@@ -18,6 +17,7 @@ declare class ClassMapDirective extends Directive {
|
|
|
18
17
|
* Used to unset existing values when a new ClassInfo object is applied.
|
|
19
18
|
*/
|
|
20
19
|
private _previousClasses?;
|
|
20
|
+
private _staticClasses?;
|
|
21
21
|
constructor(partInfo: PartInfo);
|
|
22
22
|
render(classInfo: ClassInfo): string;
|
|
23
23
|
update(part: AttributePart, [classInfo]: DirectiveParameters<this>): string | typeof noChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../src/directives/class-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,cAAM,iBAAkB,SAAQ,SAAS;IACvC;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAAc;
|
|
1
|
+
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../src/directives/class-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,cAAM,iBAAkB,SAAQ,SAAS;IACvC;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAAc;IACvC,OAAO,CAAC,cAAc,CAAC,CAAc;gBAEzB,QAAQ,EAAE,QAAQ;IAc9B,MAAM,CAAC,SAAS,EAAE,SAAS;IAWlB,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAoD5E;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,+FAA+B,CAAC;AAErD;;;GAGG;AACH,YAAY,EAAC,iBAAiB,EAAC,CAAC"}
|