chrome-devtools-frontend 1.0.943709 → 1.0.945329
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 +3 -0
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/i18nImpl.ts +7 -4
- package/front_end/core/i18n/locales/en-US.json +3 -72
- package/front_end/core/i18n/locales/en-XL.json +15 -84
- package/front_end/core/protocol_client/NodeURL.ts +1 -0
- package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -0
- 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/OverlayModel.ts +0 -9
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/Script.ts +2 -7
- package/front_end/core/sdk/sdk-meta.ts +0 -26
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +0 -13
- package/front_end/entrypoints/main/MainImpl.ts +4 -0
- package/front_end/models/bindings/BreakpointManager.ts +3 -4
- package/front_end/models/bindings/DefaultScriptMapping.ts +1 -9
- package/front_end/models/bindings/ResourceMapping.ts +1 -2
- package/front_end/models/bindings/ResourceScriptMapping.ts +3 -11
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
- package/front_end/models/formatter/SourceFormatter.ts +0 -15
- 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/workspace/UISourceCode.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
- package/front_end/panels/animation/animationTimeline.css +2 -0
- package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
- 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/console/ConsolePinPane.ts +1 -0
- package/front_end/panels/console/ConsolePrompt.ts +121 -171
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +2 -2
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +98 -67
- package/front_end/panels/elements/AccessibilityTreeView.ts +76 -126
- package/front_end/panels/elements/ElementsPanel.ts +6 -7
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
- package/front_end/panels/elements/StylePropertyHighlighter.ts +29 -19
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +27 -3
- package/front_end/panels/emulation/DeviceModeView.ts +3 -0
- package/front_end/panels/help/ReleaseNoteText.ts +3 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +5 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
- 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/TimelineFlameChartDataProvider.ts +3 -34
- package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
- 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 +4 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +39 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- 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/text_editor/TextEditor.ts +29 -0
- package/front_end/ui/components/text_editor/config.ts +36 -14
- package/front_end/ui/components/text_editor/javascript.ts +14 -9
- package/front_end/ui/components/text_editor/theme.ts +29 -4
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- 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/components/source_frame/SourceFrame.ts +1 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +49 -79
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/inspector_overlay/main.ts +3 -0
- package/package.json +1 -1
|
@@ -3,16 +3,34 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
var _a, _b, _c, _d
|
|
7
|
-
var _f;
|
|
6
|
+
var _a, _b, _c, _d;
|
|
8
7
|
const DEV_MODE = true;
|
|
9
8
|
const ENABLE_EXTRA_SECURITY_HOOKS = true;
|
|
10
9
|
const ENABLE_SHADYDOM_NOPATCH = true;
|
|
10
|
+
/**
|
|
11
|
+
* `true` if we're building for google3 with temporary back-compat helpers.
|
|
12
|
+
* This export is not present in prod builds.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const INTERNAL = true;
|
|
16
|
+
let issueWarning;
|
|
11
17
|
if (DEV_MODE) {
|
|
12
|
-
|
|
18
|
+
(_a = globalThis.litIssuedWarnings) !== null && _a !== void 0 ? _a : (globalThis.litIssuedWarnings = new Set());
|
|
19
|
+
// Issue a warning, if we haven't already.
|
|
20
|
+
issueWarning = (code, warning) => {
|
|
21
|
+
warning += code
|
|
22
|
+
? ` See https://lit.dev/msg/${code} for more information.`
|
|
23
|
+
: '';
|
|
24
|
+
if (!globalThis.litIssuedWarnings.has(warning)) {
|
|
25
|
+
console.warn(warning);
|
|
26
|
+
globalThis.litIssuedWarnings.add(warning);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);
|
|
13
30
|
}
|
|
14
|
-
const wrap = ENABLE_SHADYDOM_NOPATCH &&
|
|
15
|
-
((_b = window.ShadyDOM) === null || _b === void 0 ? void 0 : _b.
|
|
31
|
+
const wrap = ENABLE_SHADYDOM_NOPATCH &&
|
|
32
|
+
((_b = window.ShadyDOM) === null || _b === void 0 ? void 0 : _b.inUse) &&
|
|
33
|
+
((_c = window.ShadyDOM) === null || _c === void 0 ? void 0 : _c.noPatch) === true
|
|
16
34
|
? window.ShadyDOM.wrap
|
|
17
35
|
: (node) => node;
|
|
18
36
|
const trustedTypes = globalThis.trustedTypes;
|
|
@@ -152,14 +170,33 @@ const COMMENT_PART = 7;
|
|
|
152
170
|
* Generates a template literal tag function that returns a TemplateResult with
|
|
153
171
|
* the given result type.
|
|
154
172
|
*/
|
|
155
|
-
const tag = (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
const tag = (type) => (strings, ...values) => {
|
|
174
|
+
// Warn against templates octal escape sequences
|
|
175
|
+
// We do this here rather than in render so that the warning is closer to the
|
|
176
|
+
// template definition.
|
|
177
|
+
if (DEV_MODE && strings.some((s) => s === undefined)) {
|
|
178
|
+
console.warn('Some template strings are undefined.\n' +
|
|
179
|
+
'This is probably caused by illegal octal escape sequences.');
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
// This property needs to remain unminified.
|
|
183
|
+
['_$litType$']: type,
|
|
184
|
+
strings,
|
|
185
|
+
values,
|
|
186
|
+
};
|
|
187
|
+
};
|
|
160
188
|
/**
|
|
161
189
|
* Interprets a template literal as an HTML template that can efficiently
|
|
162
190
|
* render to and update a container.
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* const header = (title: string) => html`<h1>${title}</h1>`;
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* The `html` tag returns a description of the DOM to render as a value. It is
|
|
197
|
+
* lazy, meaning no work is done until the template is rendered. When rendering,
|
|
198
|
+
* if a template comes from the same expression as a previously rendered result,
|
|
199
|
+
* it's efficiently updated instead of replaced.
|
|
163
200
|
*/
|
|
164
201
|
export const html = tag(HTML_RESULT);
|
|
165
202
|
/**
|
|
@@ -174,6 +211,22 @@ export const svg = tag(SVG_RESULT);
|
|
|
174
211
|
export const noChange = Symbol.for('lit-noChange');
|
|
175
212
|
/**
|
|
176
213
|
* A sentinel value that signals a ChildPart to fully clear its content.
|
|
214
|
+
*
|
|
215
|
+
* ```ts
|
|
216
|
+
* const button = html`${
|
|
217
|
+
* user.isAdmin
|
|
218
|
+
* ? html`<button>DELETE</button>`
|
|
219
|
+
* : nothing
|
|
220
|
+
* }`;
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* Prefer using `nothing` over other falsy values as it provides a consistent
|
|
224
|
+
* behavior between various expression binding contexts.
|
|
225
|
+
*
|
|
226
|
+
* In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the
|
|
227
|
+
* same and render no nodes. In attribute expressions, `nothing` _removes_ the
|
|
228
|
+
* attribute, while `undefined` and `null` will render an empty string. In
|
|
229
|
+
* property expressions `nothing` becomes `undefined`.
|
|
177
230
|
*/
|
|
178
231
|
export const nothing = Symbol.for('lit-nothing');
|
|
179
232
|
/**
|
|
@@ -191,14 +244,28 @@ const templateCache = new WeakMap();
|
|
|
191
244
|
* @param options
|
|
192
245
|
*/
|
|
193
246
|
export const render = (value, container, options) => {
|
|
194
|
-
var _a, _b;
|
|
247
|
+
var _a, _b, _c;
|
|
195
248
|
const partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
|
|
249
|
+
// This property needs to remain unminified.
|
|
196
250
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
|
-
let part = partOwnerNode
|
|
251
|
+
let part = partOwnerNode['_$litPart$'];
|
|
198
252
|
if (part === undefined) {
|
|
199
253
|
const endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
|
|
254
|
+
// Internal modification: don't clear container to match lit-html 2.0
|
|
255
|
+
if (INTERNAL &&
|
|
256
|
+
((_c = options) === null || _c === void 0 ? void 0 : _c.clearContainerForLit2MigrationOnly) ===
|
|
257
|
+
true) {
|
|
258
|
+
let n = container.firstChild;
|
|
259
|
+
// Clear only up to the `endNode` aka `renderBefore` node.
|
|
260
|
+
while (n && n !== endNode) {
|
|
261
|
+
const next = n.nextSibling;
|
|
262
|
+
n.remove();
|
|
263
|
+
n = next;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// This property needs to remain unminified.
|
|
200
267
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
|
-
partOwnerNode
|
|
268
|
+
partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
|
|
202
269
|
}
|
|
203
270
|
part._$setValue(value);
|
|
204
271
|
return part;
|
|
@@ -207,7 +274,8 @@ if (ENABLE_EXTRA_SECURITY_HOOKS) {
|
|
|
207
274
|
render.setSanitizer = setSanitizer;
|
|
208
275
|
render.createSanitizer = createSanitizer;
|
|
209
276
|
if (DEV_MODE) {
|
|
210
|
-
render._testOnlyClearSanitizerFactoryDoNotCallOrElse =
|
|
277
|
+
render._testOnlyClearSanitizerFactoryDoNotCallOrElse =
|
|
278
|
+
_testOnlyClearSanitizerFactoryDoNotCallOrElse;
|
|
211
279
|
}
|
|
212
280
|
}
|
|
213
281
|
const walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */, null, false);
|
|
@@ -282,7 +350,10 @@ const getTemplateHtml = (strings, type) => {
|
|
|
282
350
|
regex = tagEndRegex;
|
|
283
351
|
}
|
|
284
352
|
else if (match[DYNAMIC_TAG_NAME] !== undefined) {
|
|
285
|
-
|
|
353
|
+
if (DEV_MODE) {
|
|
354
|
+
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' +
|
|
355
|
+
'See https://lit.dev/docs/templates/expressions/#static-expressions');
|
|
356
|
+
}
|
|
286
357
|
regex = tagEndRegex;
|
|
287
358
|
}
|
|
288
359
|
}
|
|
@@ -370,7 +441,9 @@ const getTemplateHtml = (strings, type) => {
|
|
|
370
441
|
];
|
|
371
442
|
};
|
|
372
443
|
class Template {
|
|
373
|
-
constructor(
|
|
444
|
+
constructor(
|
|
445
|
+
// This property needs to remain unminified.
|
|
446
|
+
{ strings, ['_$litType$']: type }, options) {
|
|
374
447
|
/** @internal */
|
|
375
448
|
this.parts = [];
|
|
376
449
|
let node;
|
|
@@ -392,6 +465,24 @@ class Template {
|
|
|
392
465
|
// Walk the template to find binding markers and create TemplateParts
|
|
393
466
|
while ((node = walker.nextNode()) !== null && parts.length < partCount) {
|
|
394
467
|
if (node.nodeType === 1) {
|
|
468
|
+
if (DEV_MODE) {
|
|
469
|
+
const tag = node.localName;
|
|
470
|
+
// Warn if `textarea` includes an expression and throw if `template`
|
|
471
|
+
// does since these are not supported. We do this by checking
|
|
472
|
+
// innerHTML for anything that looks like a marker. This catches
|
|
473
|
+
// cases like bindings in textarea there markers turn into text nodes.
|
|
474
|
+
if (/^(?:textarea|template)$/i.test(tag) &&
|
|
475
|
+
node.innerHTML.includes(marker)) {
|
|
476
|
+
const m = `Expressions are not supported inside \`${tag}\` ` +
|
|
477
|
+
`elements. See https://lit.dev/msg/expression-in-${tag} for more ` +
|
|
478
|
+
`information.`;
|
|
479
|
+
if (tag === 'template') {
|
|
480
|
+
throw new Error(m);
|
|
481
|
+
}
|
|
482
|
+
else
|
|
483
|
+
issueWarning('', m);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
395
486
|
// TODO (justinfagnani): for attempted dynamic tag names, we don't
|
|
396
487
|
// increment the bindingIndex, and it'll be off by 1 in the element
|
|
397
488
|
// and off by two after it.
|
|
@@ -458,7 +549,8 @@ class Template {
|
|
|
458
549
|
// Generate a new text node for each literal section
|
|
459
550
|
// These nodes are also used as the markers for node parts
|
|
460
551
|
// We can't use empty text nodes as markers because they're
|
|
461
|
-
// normalized in
|
|
552
|
+
// normalized when cloning in IE (could simplify when
|
|
553
|
+
// IE is no longer supported)
|
|
462
554
|
for (let i = 0; i < lastIndex; i++) {
|
|
463
555
|
node.append(strings[i], createMarker());
|
|
464
556
|
// Walk past the marker node we just added
|
|
@@ -482,8 +574,6 @@ class Template {
|
|
|
482
574
|
while ((i = node.data.indexOf(marker, i + 1)) !== -1) {
|
|
483
575
|
// Comment node has a binding marker inside, make an inactive part
|
|
484
576
|
// The binding won't work, but subsequent bindings will
|
|
485
|
-
// TODO (justinfagnani): consider whether it's even worth it to
|
|
486
|
-
// make bindings in comments work
|
|
487
577
|
parts.push({ type: COMMENT_PART, index: nodeIndex });
|
|
488
578
|
// Move to the end of the match
|
|
489
579
|
i += marker.length - 1;
|
|
@@ -493,7 +583,8 @@ class Template {
|
|
|
493
583
|
nodeIndex++;
|
|
494
584
|
}
|
|
495
585
|
}
|
|
496
|
-
// Overridden via `
|
|
586
|
+
// Overridden via `litHtmlPolyfillSupport` to provide platform support.
|
|
587
|
+
/** @nocollapse */
|
|
497
588
|
static createElement(html, _options) {
|
|
498
589
|
const el = d.createElement('template');
|
|
499
590
|
el.innerHTML = html;
|
|
@@ -509,12 +600,15 @@ function resolveDirective(part, value, parent = part, attributeIndex) {
|
|
|
509
600
|
return value;
|
|
510
601
|
}
|
|
511
602
|
let currentDirective = attributeIndex !== undefined
|
|
512
|
-
? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex]
|
|
603
|
+
? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex]
|
|
604
|
+
: parent.__directive;
|
|
513
605
|
const nextDirectiveConstructor = isPrimitive(value)
|
|
514
606
|
? undefined
|
|
515
|
-
:
|
|
607
|
+
: // This property needs to remain unminified.
|
|
608
|
+
value['_$litDirective$'];
|
|
516
609
|
if ((currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective.constructor) !== nextDirectiveConstructor) {
|
|
517
|
-
|
|
610
|
+
// This property needs to remain unminified.
|
|
611
|
+
(_b = currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective['_$notifyDirectiveConnectionChanged']) === null || _b === void 0 ? void 0 : _b.call(currentDirective, false);
|
|
518
612
|
if (nextDirectiveConstructor === undefined) {
|
|
519
613
|
currentDirective = undefined;
|
|
520
614
|
}
|
|
@@ -523,7 +617,8 @@ function resolveDirective(part, value, parent = part, attributeIndex) {
|
|
|
523
617
|
currentDirective._$initialize(part, parent, attributeIndex);
|
|
524
618
|
}
|
|
525
619
|
if (attributeIndex !== undefined) {
|
|
526
|
-
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : (_d.__directives = []))[attributeIndex] =
|
|
620
|
+
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : (_d.__directives = []))[attributeIndex] =
|
|
621
|
+
currentDirective;
|
|
527
622
|
}
|
|
528
623
|
else {
|
|
529
624
|
parent.__directive = currentDirective;
|
|
@@ -543,10 +638,18 @@ class TemplateInstance {
|
|
|
543
638
|
/** @internal */
|
|
544
639
|
this._parts = [];
|
|
545
640
|
/** @internal */
|
|
546
|
-
this._$
|
|
641
|
+
this._$disconnectableChildren = undefined;
|
|
547
642
|
this._$template = template;
|
|
548
643
|
this._$parent = parent;
|
|
549
644
|
}
|
|
645
|
+
// Called by ChildPart parentNode getter
|
|
646
|
+
get parentNode() {
|
|
647
|
+
return this._$parent.parentNode;
|
|
648
|
+
}
|
|
649
|
+
// See comment in Disconnectable interface for why this is a getter
|
|
650
|
+
get _$isConnected() {
|
|
651
|
+
return this._$parent._$isConnected;
|
|
652
|
+
}
|
|
550
653
|
// This method is separate from the constructor because we need to return a
|
|
551
654
|
// DocumentFragment and we don't want to hold onto it with an instance field.
|
|
552
655
|
_clone(options) {
|
|
@@ -601,28 +704,33 @@ class TemplateInstance {
|
|
|
601
704
|
}
|
|
602
705
|
class ChildPart {
|
|
603
706
|
constructor(startNode, endNode, parent, options) {
|
|
707
|
+
var _a;
|
|
604
708
|
this.type = CHILD_PART;
|
|
709
|
+
this._$committedValue = nothing;
|
|
605
710
|
// The following fields will be patched onto ChildParts when required by
|
|
606
711
|
// AsyncDirective
|
|
607
712
|
/** @internal */
|
|
608
|
-
this._$
|
|
713
|
+
this._$disconnectableChildren = undefined;
|
|
609
714
|
this._$startNode = startNode;
|
|
610
715
|
this._$endNode = endNode;
|
|
611
716
|
this._$parent = parent;
|
|
612
717
|
this.options = options;
|
|
718
|
+
// Note __isConnected is only ever accessed on RootParts (i.e. when there is
|
|
719
|
+
// no _$parent); the value on a non-root-part is "don't care", but checking
|
|
720
|
+
// for parent would be more code
|
|
721
|
+
this.__isConnected = (_a = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _a !== void 0 ? _a : true;
|
|
613
722
|
if (ENABLE_EXTRA_SECURITY_HOOKS) {
|
|
614
723
|
// Explicitly initialize for consistent class shape.
|
|
615
724
|
this._textSanitizer = undefined;
|
|
616
725
|
}
|
|
617
726
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
(_a = this._$setChildPartConnected) === null || _a === void 0 ? void 0 : _a.call(this, isConnected);
|
|
727
|
+
// See comment in Disconnectable interface for why this is a getter
|
|
728
|
+
get _$isConnected() {
|
|
729
|
+
var _a, _b;
|
|
730
|
+
// ChildParts that are not at the root should always be created with a
|
|
731
|
+
// parent; only RootChildNode's won't, so they return the local isConnected
|
|
732
|
+
// state
|
|
733
|
+
return (_b = (_a = this._$parent) === null || _a === void 0 ? void 0 : _a._$isConnected) !== null && _b !== void 0 ? _b : this.__isConnected;
|
|
626
734
|
}
|
|
627
735
|
/**
|
|
628
736
|
* The parent node into which the part renders its content.
|
|
@@ -643,7 +751,16 @@ class ChildPart {
|
|
|
643
751
|
* consists of all child nodes of `.parentNode`.
|
|
644
752
|
*/
|
|
645
753
|
get parentNode() {
|
|
646
|
-
|
|
754
|
+
let parentNode = wrap(this._$startNode).parentNode;
|
|
755
|
+
const parent = this._$parent;
|
|
756
|
+
if (parent !== undefined &&
|
|
757
|
+
parentNode.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */) {
|
|
758
|
+
// If the parentNode is a DocumentFragment, it may be because the DOM is
|
|
759
|
+
// still in the cloned fragment during initial render; if so, get the real
|
|
760
|
+
// parentNode the part will be committed into by asking the parent.
|
|
761
|
+
parentNode = parent.parentNode;
|
|
762
|
+
}
|
|
763
|
+
return parentNode;
|
|
647
764
|
}
|
|
648
765
|
/**
|
|
649
766
|
* The part's leading marker node, if any. See `.parentNode` for more
|
|
@@ -660,6 +777,9 @@ class ChildPart {
|
|
|
660
777
|
return this._$endNode;
|
|
661
778
|
}
|
|
662
779
|
_$setValue(value, directiveParent = this) {
|
|
780
|
+
if (DEV_MODE && this.parentNode === null) {
|
|
781
|
+
throw new Error(`This \`ChildPart\` has no \`parentNode\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \`innerHTML\` or \`textContent\` can do this.`);
|
|
782
|
+
}
|
|
663
783
|
value = resolveDirective(this, value, directiveParent);
|
|
664
784
|
if (isPrimitive(value)) {
|
|
665
785
|
// Non-rendering child values. It's important that these do not render
|
|
@@ -674,8 +794,9 @@ class ChildPart {
|
|
|
674
794
|
else if (value !== this._$committedValue && value !== noChange) {
|
|
675
795
|
this._commitText(value);
|
|
676
796
|
}
|
|
797
|
+
// This property needs to remain unminified.
|
|
677
798
|
}
|
|
678
|
-
else if (value
|
|
799
|
+
else if (value['_$litType$'] !== undefined) {
|
|
679
800
|
this._commitTemplateResult(value);
|
|
680
801
|
}
|
|
681
802
|
else if (value.nodeType !== undefined) {
|
|
@@ -700,30 +821,44 @@ class ChildPart {
|
|
|
700
821
|
sanitizerFactoryInternal !== noopSanitizer) {
|
|
701
822
|
const parentNodeName = (_a = this._$startNode.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName;
|
|
702
823
|
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
824
|
+
let message = 'Forbidden';
|
|
825
|
+
if (DEV_MODE) {
|
|
826
|
+
if (parentNodeName === 'STYLE') {
|
|
827
|
+
message =
|
|
828
|
+
`Lit does not support binding inside style nodes. ` +
|
|
829
|
+
`This is a security risk, as style injection attacks can ` +
|
|
830
|
+
`exfiltrate data and spoof UIs. ` +
|
|
831
|
+
`Consider instead using css\`...\` literals ` +
|
|
832
|
+
`to compose styles, and make do dynamic styling with ` +
|
|
833
|
+
`css custom properties, ::parts, <slot>s, ` +
|
|
834
|
+
`and by mutating the DOM rather than stylesheets.`;
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
message =
|
|
838
|
+
`Lit does not support binding inside script nodes. ` +
|
|
839
|
+
`This is a security risk, as it could allow arbitrary ` +
|
|
840
|
+
`code execution.`;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
throw new Error(message);
|
|
706
844
|
}
|
|
707
845
|
}
|
|
708
846
|
this._$committedValue = this._insert(value);
|
|
709
847
|
}
|
|
710
848
|
}
|
|
711
849
|
_commitText(value) {
|
|
712
|
-
|
|
713
|
-
//
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
(this._$
|
|
717
|
-
|
|
718
|
-
: node === wrap(this._$endNode).previousSibling)) {
|
|
850
|
+
// If the committed value is a primitive it means we called _commitText on
|
|
851
|
+
// the previous render, and we know that this._$startNode.nextSibling is a
|
|
852
|
+
// Text node. We can now just replace the text content (.data) of the node.
|
|
853
|
+
if (this._$committedValue !== nothing &&
|
|
854
|
+
isPrimitive(this._$committedValue)) {
|
|
855
|
+
const node = wrap(this._$startNode).nextSibling;
|
|
719
856
|
if (ENABLE_EXTRA_SECURITY_HOOKS) {
|
|
720
857
|
if (this._textSanitizer === undefined) {
|
|
721
858
|
this._textSanitizer = createSanitizer(node, 'data', 'property');
|
|
722
859
|
}
|
|
723
860
|
value = this._textSanitizer(value);
|
|
724
861
|
}
|
|
725
|
-
// If we only have a single text node between the markers, we can just
|
|
726
|
-
// set its value, rather than replacing it.
|
|
727
862
|
node.data = value;
|
|
728
863
|
}
|
|
729
864
|
else {
|
|
@@ -748,16 +883,17 @@ class ChildPart {
|
|
|
748
883
|
}
|
|
749
884
|
_commitTemplateResult(result) {
|
|
750
885
|
var _a;
|
|
751
|
-
|
|
886
|
+
// This property needs to remain unminified.
|
|
887
|
+
const { values, ['_$litType$']: type } = result;
|
|
752
888
|
// If $litType$ is a number, result is a plain TemplateResult and we get
|
|
753
889
|
// the template from the template cache. If not, result is a
|
|
754
890
|
// CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need
|
|
755
891
|
// to create the <template> element the first time we see it.
|
|
756
|
-
const template = typeof
|
|
892
|
+
const template = typeof type === 'number'
|
|
757
893
|
? this._$getTemplate(result)
|
|
758
|
-
: (
|
|
759
|
-
(
|
|
760
|
-
|
|
894
|
+
: (type.el === undefined &&
|
|
895
|
+
(type.el = Template.createElement(type.h, this.options)),
|
|
896
|
+
type);
|
|
761
897
|
if (((_a = this._$committedValue) === null || _a === void 0 ? void 0 : _a._$template) === template) {
|
|
762
898
|
this._$committedValue._update(values);
|
|
763
899
|
}
|
|
@@ -769,7 +905,7 @@ class ChildPart {
|
|
|
769
905
|
this._$committedValue = instance;
|
|
770
906
|
}
|
|
771
907
|
}
|
|
772
|
-
// Overridden via `
|
|
908
|
+
// Overridden via `litHtmlPolyfillSupport` to provide platform support.
|
|
773
909
|
/** @internal */
|
|
774
910
|
_$getTemplate(result) {
|
|
775
911
|
let template = templateCache.get(result.strings);
|
|
@@ -802,7 +938,7 @@ class ChildPart {
|
|
|
802
938
|
// If no existing part, create a new one
|
|
803
939
|
// TODO (justinfagnani): test perf impact of always creating two parts
|
|
804
940
|
// instead of sharing parts between nodes
|
|
805
|
-
// https://github.com/
|
|
941
|
+
// https://github.com/lit/lit/issues/1266
|
|
806
942
|
itemParts.push((itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options)));
|
|
807
943
|
}
|
|
808
944
|
else {
|
|
@@ -832,13 +968,31 @@ class ChildPart {
|
|
|
832
968
|
*/
|
|
833
969
|
_$clear(start = wrap(this._$startNode).nextSibling, from) {
|
|
834
970
|
var _a;
|
|
835
|
-
(_a = this._$
|
|
971
|
+
(_a = this._$notifyConnectionChanged) === null || _a === void 0 ? void 0 : _a.call(this, false, true, from);
|
|
836
972
|
while (start && start !== this._$endNode) {
|
|
837
973
|
const n = wrap(start).nextSibling;
|
|
838
974
|
wrap(start).remove();
|
|
839
975
|
start = n;
|
|
840
976
|
}
|
|
841
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Implementation of RootPart's `isConnected`. Note that this metod
|
|
980
|
+
* should only be called on `RootPart`s (the `ChildPart` returned from a
|
|
981
|
+
* top-level `render()` call). It has no effect on non-root ChildParts.
|
|
982
|
+
* @param isConnected Whether to set
|
|
983
|
+
* @internal
|
|
984
|
+
*/
|
|
985
|
+
setConnected(isConnected) {
|
|
986
|
+
var _a;
|
|
987
|
+
if (this._$parent === undefined) {
|
|
988
|
+
this.__isConnected = isConnected;
|
|
989
|
+
(_a = this._$notifyConnectionChanged) === null || _a === void 0 ? void 0 : _a.call(this, isConnected);
|
|
990
|
+
}
|
|
991
|
+
else if (DEV_MODE) {
|
|
992
|
+
throw new Error('part.setConnected() may only be called on a ' +
|
|
993
|
+
'RootPart returned from render().');
|
|
994
|
+
}
|
|
995
|
+
}
|
|
842
996
|
}
|
|
843
997
|
class AttributePart {
|
|
844
998
|
constructor(element, name, strings, parent, options) {
|
|
@@ -846,15 +1000,13 @@ class AttributePart {
|
|
|
846
1000
|
/** @internal */
|
|
847
1001
|
this._$committedValue = nothing;
|
|
848
1002
|
/** @internal */
|
|
849
|
-
this._$
|
|
850
|
-
/** @internal */
|
|
851
|
-
this._setDirectiveConnected = undefined;
|
|
1003
|
+
this._$disconnectableChildren = undefined;
|
|
852
1004
|
this.element = element;
|
|
853
1005
|
this.name = name;
|
|
854
1006
|
this._$parent = parent;
|
|
855
1007
|
this.options = options;
|
|
856
1008
|
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
|
|
857
|
-
this._$committedValue = new Array(strings.length - 1).fill(
|
|
1009
|
+
this._$committedValue = new Array(strings.length - 1).fill(new String());
|
|
858
1010
|
this.strings = strings;
|
|
859
1011
|
}
|
|
860
1012
|
else {
|
|
@@ -867,6 +1019,10 @@ class AttributePart {
|
|
|
867
1019
|
get tagName() {
|
|
868
1020
|
return this.element.tagName;
|
|
869
1021
|
}
|
|
1022
|
+
// See comment in Disconnectable interface for why this is a getter
|
|
1023
|
+
get _$isConnected() {
|
|
1024
|
+
return this._$parent._$isConnected;
|
|
1025
|
+
}
|
|
870
1026
|
/**
|
|
871
1027
|
* Sets the value of this part by resolving the value from possibly multiple
|
|
872
1028
|
* values and static strings and committing it to the DOM.
|
|
@@ -963,6 +1119,13 @@ class PropertyPart extends AttributePart {
|
|
|
963
1119
|
this.element[this.name] = value === nothing ? undefined : value;
|
|
964
1120
|
}
|
|
965
1121
|
}
|
|
1122
|
+
// Temporary workaround for https://crbug.com/993268
|
|
1123
|
+
// Currently, any attribute starting with "on" is considered to be a
|
|
1124
|
+
// TrustedScript source. Such boolean attributes must be set to the equivalent
|
|
1125
|
+
// trusted emptyScript value.
|
|
1126
|
+
const emptyStringForBooleanAttribute = trustedTypes
|
|
1127
|
+
? trustedTypes.emptyScript
|
|
1128
|
+
: '';
|
|
966
1129
|
class BooleanAttributePart extends AttributePart {
|
|
967
1130
|
constructor() {
|
|
968
1131
|
super(...arguments);
|
|
@@ -971,7 +1134,7 @@ class BooleanAttributePart extends AttributePart {
|
|
|
971
1134
|
/** @internal */
|
|
972
1135
|
_commitValue(value) {
|
|
973
1136
|
if (value && value !== nothing) {
|
|
974
|
-
wrap(this.element).setAttribute(this.name,
|
|
1137
|
+
wrap(this.element).setAttribute(this.name, emptyStringForBooleanAttribute);
|
|
975
1138
|
}
|
|
976
1139
|
else {
|
|
977
1140
|
wrap(this.element).removeAttribute(this.name);
|
|
@@ -979,16 +1142,22 @@ class BooleanAttributePart extends AttributePart {
|
|
|
979
1142
|
}
|
|
980
1143
|
}
|
|
981
1144
|
class EventPart extends AttributePart {
|
|
982
|
-
constructor() {
|
|
983
|
-
super(
|
|
1145
|
+
constructor(element, name, strings, parent, options) {
|
|
1146
|
+
super(element, name, strings, parent, options);
|
|
984
1147
|
this.type = EVENT_PART;
|
|
1148
|
+
if (DEV_MODE && this.strings !== undefined) {
|
|
1149
|
+
throw new Error(`A \`<${element.localName}>\` has a \`@${name}=...\` listener with ` +
|
|
1150
|
+
'invalid content. Event listeners in templates must have exactly ' +
|
|
1151
|
+
'one expression and no surrounding text.');
|
|
1152
|
+
}
|
|
985
1153
|
}
|
|
986
1154
|
// EventPart does not use the base _$setValue/_resolveValue implementation
|
|
987
1155
|
// since the dirty checking is more complex
|
|
988
1156
|
/** @internal */
|
|
989
1157
|
_$setValue(newListener, directiveParent = this) {
|
|
990
1158
|
var _a;
|
|
991
|
-
newListener =
|
|
1159
|
+
newListener =
|
|
1160
|
+
(_a = resolveDirective(this, newListener, directiveParent, 0)) !== null && _a !== void 0 ? _a : nothing;
|
|
992
1161
|
if (newListener === noChange) {
|
|
993
1162
|
return;
|
|
994
1163
|
}
|
|
@@ -1020,8 +1189,6 @@ class EventPart extends AttributePart {
|
|
|
1020
1189
|
handleEvent(event) {
|
|
1021
1190
|
var _a, _b;
|
|
1022
1191
|
if (typeof this._$committedValue === 'function') {
|
|
1023
|
-
// TODO (justinfagnani): do we need to default to this.element?
|
|
1024
|
-
// It'll always be the same as `e.currentTarget`.
|
|
1025
1192
|
this._$committedValue.call((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : this.element, event);
|
|
1026
1193
|
}
|
|
1027
1194
|
else {
|
|
@@ -1034,12 +1201,14 @@ class ElementPart {
|
|
|
1034
1201
|
this.element = element;
|
|
1035
1202
|
this.type = ELEMENT_PART;
|
|
1036
1203
|
/** @internal */
|
|
1037
|
-
this._$
|
|
1038
|
-
/** @internal */
|
|
1039
|
-
this._setDirectiveConnected = undefined;
|
|
1204
|
+
this._$disconnectableChildren = undefined;
|
|
1040
1205
|
this._$parent = parent;
|
|
1041
1206
|
this.options = options;
|
|
1042
1207
|
}
|
|
1208
|
+
// See comment in Disconnectable interface for why this is a getter
|
|
1209
|
+
get _$isConnected() {
|
|
1210
|
+
return this._$parent._$isConnected;
|
|
1211
|
+
}
|
|
1043
1212
|
_$setValue(value) {
|
|
1044
1213
|
resolveDirective(this, value);
|
|
1045
1214
|
}
|
|
@@ -1052,7 +1221,7 @@ class ElementPart {
|
|
|
1052
1221
|
*
|
|
1053
1222
|
* We currently do not make a mangled rollup build of the lit-ssr code. In order
|
|
1054
1223
|
* to keep a number of (otherwise private) top-level exports mangled in the
|
|
1055
|
-
* client side code, we export a _
|
|
1224
|
+
* client side code, we export a _$LH object containing those members (or
|
|
1056
1225
|
* helper methods for accessing private fields of those members), and then
|
|
1057
1226
|
* re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
|
|
1058
1227
|
* client-side code is being used in `dev` mode or `prod` mode.
|
|
@@ -1062,7 +1231,7 @@ class ElementPart {
|
|
|
1062
1231
|
*
|
|
1063
1232
|
* @private
|
|
1064
1233
|
*/
|
|
1065
|
-
export const _
|
|
1234
|
+
export const _$LH = {
|
|
1066
1235
|
// Used in lit-ssr
|
|
1067
1236
|
_boundAttributeSuffix: boundAttributeSuffix,
|
|
1068
1237
|
_marker: marker,
|
|
@@ -1082,11 +1251,15 @@ export const _Σ = {
|
|
|
1082
1251
|
_ElementPart: ElementPart,
|
|
1083
1252
|
};
|
|
1084
1253
|
// Apply polyfills if available
|
|
1085
|
-
|
|
1086
|
-
|
|
1254
|
+
const polyfillSupport = DEV_MODE
|
|
1255
|
+
? window.litHtmlPolyfillSupportDevMode
|
|
1256
|
+
: window.litHtmlPolyfillSupport;
|
|
1257
|
+
polyfillSupport === null || polyfillSupport === void 0 ? void 0 : polyfillSupport(Template, ChildPart);
|
|
1087
1258
|
// IMPORTANT: do not change the property name or the assignment expression.
|
|
1088
1259
|
// This line will be used in regexes to search for lit-html usage.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
(
|
|
1260
|
+
((_d = globalThis.litHtmlVersions) !== null && _d !== void 0 ? _d : (globalThis.litHtmlVersions = [])).push('2.0.2');
|
|
1261
|
+
if (DEV_MODE && globalThis.litHtmlVersions.length > 1) {
|
|
1262
|
+
issueWarning('multiple-versions', `Multiple versions of Lit loaded. ` +
|
|
1263
|
+
`Loading multiple versions is not recommended.`);
|
|
1264
|
+
}
|
|
1092
1265
|
//# sourceMappingURL=lit-html.js.map
|