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.
Files changed (327) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
  4. package/front_end/core/common/ParsedURL.ts +1 -1
  5. package/front_end/core/host/UserMetrics.ts +3 -1
  6. package/front_end/core/i18n/i18nImpl.ts +7 -4
  7. package/front_end/core/i18n/locales/en-US.json +3 -60
  8. package/front_end/core/i18n/locales/en-XL.json +15 -72
  9. package/front_end/core/protocol_client/NodeURL.ts +1 -0
  10. package/front_end/core/sdk/CSSMetadata.ts +0 -1
  11. package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -3
  12. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -3
  13. package/front_end/core/sdk/Cookie.ts +17 -0
  14. package/front_end/core/sdk/CookieModel.ts +1 -0
  15. package/front_end/core/sdk/DebuggerModel.ts +5 -4
  16. package/front_end/core/sdk/NetworkManager.ts +4 -1
  17. package/front_end/core/sdk/NetworkRequest.ts +2 -2
  18. package/front_end/core/sdk/Resource.ts +2 -2
  19. package/front_end/core/sdk/Script.ts +2 -3
  20. package/front_end/entrypoints/main/MainImpl.ts +6 -0
  21. package/front_end/generated/protocol.d.ts +0 -4
  22. package/front_end/models/bindings/BreakpointManager.ts +3 -4
  23. package/front_end/models/bindings/ResourceMapping.ts +1 -2
  24. package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
  25. package/front_end/models/emulation/EmulatedDevices.ts +2 -4
  26. package/front_end/models/persistence/IsolatedFileSystem.ts +7 -6
  27. package/front_end/models/persistence/PersistenceActions.ts +4 -1
  28. package/front_end/models/persistence/PlatformFileSystem.ts +3 -4
  29. package/front_end/models/text_utils/ContentProvider.ts +1 -2
  30. package/front_end/models/text_utils/StaticContentProvider.ts +2 -3
  31. package/front_end/models/timeline_model/TimelineJSProfile.ts +16 -3
  32. package/front_end/models/timeline_model/TimelineModel.ts +1 -0
  33. package/front_end/models/workspace/UISourceCode.ts +2 -2
  34. package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
  35. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  36. package/front_end/panels/animation/animationTimeline.css +2 -0
  37. package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
  38. package/front_end/panels/application/BackForwardCacheView.ts +8 -1
  39. package/front_end/panels/application/ReportingApiView.ts +15 -1
  40. package/front_end/panels/application/components/EndpointsGrid.ts +63 -4
  41. package/front_end/panels/application/components/FrameDetailsView.ts +21 -34
  42. package/front_end/panels/changes/ChangesView.ts +8 -7
  43. package/front_end/panels/elements/StyleEditorWidget.ts +7 -7
  44. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -15
  45. package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
  46. package/front_end/panels/emulation/DeviceModeView.ts +3 -0
  47. package/front_end/panels/help/ReleaseNoteText.ts +3 -1
  48. package/front_end/panels/network/NetworkItemView.ts +7 -1
  49. package/front_end/panels/profiler/heapProfiler.css +2 -5
  50. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
  51. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  52. package/front_end/panels/sources/NavigatorView.ts +1 -1
  53. package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
  54. package/front_end/panels/timeline/TimelineController.ts +3 -0
  55. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -34
  56. package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
  57. package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
  58. package/front_end/services/window_bounds/WindowBoundsService.ts +27 -0
  59. package/front_end/services/window_bounds/window_bounds.ts +9 -0
  60. package/front_end/third_party/acorn/README.chromium +2 -2
  61. package/front_end/third_party/acorn/acorn.ts +1 -1
  62. package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
  63. package/front_end/third_party/acorn/package/README.md +1 -1
  64. package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
  65. package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
  66. package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
  67. package/front_end/third_party/acorn/package/dist/bin.js +47 -21
  68. package/front_end/third_party/acorn/package/package.json +1 -1
  69. package/front_end/third_party/acorn-loose/README.chromium +2 -2
  70. package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
  71. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
  72. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
  73. package/front_end/third_party/acorn-loose/package/package.json +2 -2
  74. package/front_end/third_party/codemirror.next/bundle.ts +1 -1
  75. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  76. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -1
  77. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  78. package/front_end/third_party/codemirror.next/package.json +1 -1
  79. package/front_end/third_party/i18n/i18n-impl.ts +1 -1
  80. package/front_end/third_party/lit-html/README.chromium +2 -2
  81. package/front_end/third_party/lit-html/package/CHANGELOG.md +216 -28
  82. package/front_end/third_party/lit-html/package/LICENSE +9 -9
  83. package/front_end/third_party/lit-html/package/README.md +12 -162
  84. package/front_end/third_party/lit-html/package/async-directive.d.ts +23 -54
  85. package/front_end/third_party/lit-html/package/async-directive.d.ts.map +1 -1
  86. package/front_end/third_party/lit-html/package/async-directive.js +2 -7
  87. package/front_end/third_party/lit-html/package/async-directive.js.map +1 -1
  88. package/front_end/third_party/lit-html/package/development/async-directive.d.ts +23 -54
  89. package/front_end/third_party/lit-html/package/development/async-directive.d.ts.map +1 -1
  90. package/front_end/third_party/lit-html/package/development/async-directive.js +44 -194
  91. package/front_end/third_party/lit-html/package/development/async-directive.js.map +1 -1
  92. package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts +6 -5
  93. package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts.map +1 -1
  94. package/front_end/third_party/lit-html/package/development/directive-helpers.js +25 -9
  95. package/front_end/third_party/lit-html/package/development/directive-helpers.js.map +1 -1
  96. package/front_end/third_party/lit-html/package/development/directive.d.ts +3 -16
  97. package/front_end/third_party/lit-html/package/development/directive.d.ts.map +1 -1
  98. package/front_end/third_party/lit-html/package/development/directive.js +6 -1
  99. package/front_end/third_party/lit-html/package/development/directive.js.map +1 -1
  100. package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts +7 -14
  101. package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts.map +1 -1
  102. package/front_end/third_party/lit-html/package/development/directives/async-append.js +17 -58
  103. package/front_end/third_party/lit-html/package/development/directives/async-append.js.map +1 -1
  104. package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts +9 -14
  105. package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map +1 -1
  106. package/front_end/third_party/lit-html/package/development/directives/async-replace.js +57 -37
  107. package/front_end/third_party/lit-html/package/development/directives/async-replace.js.map +1 -1
  108. package/front_end/third_party/lit-html/package/development/directives/cache.d.ts +2 -3
  109. package/front_end/third_party/lit-html/package/development/directives/cache.d.ts.map +1 -1
  110. package/front_end/third_party/lit-html/package/development/directives/cache.js +4 -6
  111. package/front_end/third_party/lit-html/package/development/directives/cache.js.map +1 -1
  112. package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts +2 -2
  113. package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts.map +1 -1
  114. package/front_end/third_party/lit-html/package/development/directives/class-map.js +17 -7
  115. package/front_end/third_party/lit-html/package/development/directives/class-map.js.map +1 -1
  116. package/front_end/third_party/lit-html/package/development/directives/guard.d.ts +3 -2
  117. package/front_end/third_party/lit-html/package/development/directives/guard.d.ts.map +1 -1
  118. package/front_end/third_party/lit-html/package/development/directives/guard.js +3 -2
  119. package/front_end/third_party/lit-html/package/development/directives/guard.js.map +1 -1
  120. package/front_end/third_party/lit-html/package/development/directives/live.d.ts +4 -3
  121. package/front_end/third_party/lit-html/package/development/directives/live.d.ts.map +1 -1
  122. package/front_end/third_party/lit-html/package/development/directives/live.js +5 -7
  123. package/front_end/third_party/lit-html/package/development/directives/live.js.map +1 -1
  124. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts +58 -0
  125. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts.map +1 -0
  126. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js +85 -0
  127. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js.map +1 -0
  128. package/front_end/third_party/lit-html/package/development/directives/ref.d.ts +14 -11
  129. package/front_end/third_party/lit-html/package/development/directives/ref.d.ts.map +1 -1
  130. package/front_end/third_party/lit-html/package/development/directives/ref.js +13 -11
  131. package/front_end/third_party/lit-html/package/development/directives/ref.js.map +1 -1
  132. package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts +8 -4
  133. package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts.map +1 -1
  134. package/front_end/third_party/lit-html/package/development/directives/repeat.js +23 -9
  135. package/front_end/third_party/lit-html/package/development/directives/repeat.js.map +1 -1
  136. package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts +1 -2
  137. package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts.map +1 -1
  138. package/front_end/third_party/lit-html/package/development/directives/style-map.js +1 -2
  139. package/front_end/third_party/lit-html/package/development/directives/style-map.js.map +1 -1
  140. package/front_end/third_party/lit-html/package/development/directives/template-content.d.ts +1 -2
  141. package/front_end/third_party/lit-html/package/development/directives/template-content.js +1 -2
  142. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts +6 -4
  143. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts.map +1 -1
  144. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js +7 -5
  145. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js.map +1 -1
  146. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts +4 -1
  147. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts.map +1 -1
  148. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js +3 -0
  149. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js.map +1 -1
  150. package/front_end/third_party/lit-html/package/development/directives/until.d.ts +12 -8
  151. package/front_end/third_party/lit-html/package/development/directives/until.d.ts.map +1 -1
  152. package/front_end/third_party/lit-html/package/development/directives/until.js +63 -23
  153. package/front_end/third_party/lit-html/package/development/directives/until.js.map +1 -1
  154. package/front_end/third_party/lit-html/package/development/experimental-hydrate.d.ts.map +1 -1
  155. package/front_end/third_party/lit-html/package/development/experimental-hydrate.js +9 -8
  156. package/front_end/third_party/lit-html/package/development/experimental-hydrate.js.map +1 -1
  157. package/front_end/third_party/lit-html/package/development/lit-html.d.ts +81 -136
  158. package/front_end/third_party/lit-html/package/development/lit-html.d.ts.map +1 -1
  159. package/front_end/third_party/lit-html/package/development/lit-html.js +249 -76
  160. package/front_end/third_party/lit-html/package/development/lit-html.js.map +1 -1
  161. package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts +1 -41
  162. package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts.map +1 -1
  163. package/front_end/third_party/lit-html/package/development/polyfill-support.js +40 -21
  164. package/front_end/third_party/lit-html/package/development/polyfill-support.js.map +1 -1
  165. package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts +12 -10
  166. package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts.map +1 -1
  167. package/front_end/third_party/lit-html/package/development/private-ssr-support.js +11 -3
  168. package/front_end/third_party/lit-html/package/development/private-ssr-support.js.map +1 -1
  169. package/front_end/third_party/lit-html/package/development/static.d.ts.map +1 -1
  170. package/front_end/third_party/lit-html/package/development/static.js +6 -5
  171. package/front_end/third_party/lit-html/package/development/static.js.map +1 -1
  172. package/front_end/third_party/lit-html/package/directive-helpers.d.ts +6 -5
  173. package/front_end/third_party/lit-html/package/directive-helpers.d.ts.map +1 -1
  174. package/front_end/third_party/lit-html/package/directive-helpers.js +2 -2
  175. package/front_end/third_party/lit-html/package/directive-helpers.js.map +1 -1
  176. package/front_end/third_party/lit-html/package/directive.d.ts +3 -16
  177. package/front_end/third_party/lit-html/package/directive.d.ts.map +1 -1
  178. package/front_end/third_party/lit-html/package/directive.js +1 -1
  179. package/front_end/third_party/lit-html/package/directive.js.map +1 -1
  180. package/front_end/third_party/lit-html/package/directives/async-append.d.ts +7 -14
  181. package/front_end/third_party/lit-html/package/directives/async-append.d.ts.map +1 -1
  182. package/front_end/third_party/lit-html/package/directives/async-append.js +2 -6
  183. package/front_end/third_party/lit-html/package/directives/async-append.js.map +1 -1
  184. package/front_end/third_party/lit-html/package/directives/async-replace.d.ts +9 -14
  185. package/front_end/third_party/lit-html/package/directives/async-replace.d.ts.map +1 -1
  186. package/front_end/third_party/lit-html/package/directives/async-replace.js +2 -5
  187. package/front_end/third_party/lit-html/package/directives/async-replace.js.map +1 -1
  188. package/front_end/third_party/lit-html/package/directives/cache.d.ts +2 -3
  189. package/front_end/third_party/lit-html/package/directives/cache.d.ts.map +1 -1
  190. package/front_end/third_party/lit-html/package/directives/cache.js +2 -5
  191. package/front_end/third_party/lit-html/package/directives/cache.js.map +1 -1
  192. package/front_end/third_party/lit-html/package/directives/class-map.d.ts +2 -2
  193. package/front_end/third_party/lit-html/package/directives/class-map.d.ts.map +1 -1
  194. package/front_end/third_party/lit-html/package/directives/class-map.js +2 -4
  195. package/front_end/third_party/lit-html/package/directives/class-map.js.map +1 -1
  196. package/front_end/third_party/lit-html/package/directives/guard.d.ts +3 -2
  197. package/front_end/third_party/lit-html/package/directives/guard.d.ts.map +1 -1
  198. package/front_end/third_party/lit-html/package/directives/guard.js +2 -4
  199. package/front_end/third_party/lit-html/package/directives/guard.js.map +1 -1
  200. package/front_end/third_party/lit-html/package/directives/live.d.ts +4 -3
  201. package/front_end/third_party/lit-html/package/directives/live.d.ts.map +1 -1
  202. package/front_end/third_party/lit-html/package/directives/live.js +1 -4
  203. package/front_end/third_party/lit-html/package/directives/live.js.map +1 -1
  204. package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts +58 -0
  205. package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts.map +1 -0
  206. package/front_end/third_party/lit-html/package/directives/private-async-helpers.js +7 -0
  207. package/front_end/third_party/lit-html/package/directives/private-async-helpers.js.map +1 -0
  208. package/front_end/third_party/lit-html/package/directives/ref.d.ts +14 -11
  209. package/front_end/third_party/lit-html/package/directives/ref.d.ts.map +1 -1
  210. package/front_end/third_party/lit-html/package/directives/ref.js +2 -5
  211. package/front_end/third_party/lit-html/package/directives/ref.js.map +1 -1
  212. package/front_end/third_party/lit-html/package/directives/repeat.d.ts +8 -4
  213. package/front_end/third_party/lit-html/package/directives/repeat.d.ts.map +1 -1
  214. package/front_end/third_party/lit-html/package/directives/repeat.js +2 -5
  215. package/front_end/third_party/lit-html/package/directives/repeat.js.map +1 -1
  216. package/front_end/third_party/lit-html/package/directives/style-map.d.ts +1 -2
  217. package/front_end/third_party/lit-html/package/directives/style-map.d.ts.map +1 -1
  218. package/front_end/third_party/lit-html/package/directives/style-map.js +2 -4
  219. package/front_end/third_party/lit-html/package/directives/style-map.js.map +1 -1
  220. package/front_end/third_party/lit-html/package/directives/template-content.d.ts +1 -2
  221. package/front_end/third_party/lit-html/package/directives/template-content.js +2 -4
  222. package/front_end/third_party/lit-html/package/directives/template-content.js.map +1 -1
  223. package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts +6 -4
  224. package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts.map +1 -1
  225. package/front_end/third_party/lit-html/package/directives/unsafe-html.js +2 -4
  226. package/front_end/third_party/lit-html/package/directives/unsafe-html.js.map +1 -1
  227. package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts +4 -1
  228. package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts.map +1 -1
  229. package/front_end/third_party/lit-html/package/directives/unsafe-svg.js.map +1 -1
  230. package/front_end/third_party/lit-html/package/directives/until.d.ts +12 -8
  231. package/front_end/third_party/lit-html/package/directives/until.d.ts.map +1 -1
  232. package/front_end/third_party/lit-html/package/directives/until.js +2 -6
  233. package/front_end/third_party/lit-html/package/directives/until.js.map +1 -1
  234. package/front_end/third_party/lit-html/package/experimental-hydrate.d.ts.map +1 -1
  235. package/front_end/third_party/lit-html/package/experimental-hydrate.js +2 -5
  236. package/front_end/third_party/lit-html/package/experimental-hydrate.js.map +1 -1
  237. package/front_end/third_party/lit-html/package/lit-html.d.ts +81 -136
  238. package/front_end/third_party/lit-html/package/lit-html.d.ts.map +1 -1
  239. package/front_end/third_party/lit-html/package/lit-html.js +1 -1
  240. package/front_end/third_party/lit-html/package/lit-html.js.map +1 -1
  241. package/front_end/third_party/lit-html/package/package.json +75 -24
  242. package/front_end/third_party/lit-html/package/polyfill-support.d.ts +1 -41
  243. package/front_end/third_party/lit-html/package/polyfill-support.d.ts.map +1 -1
  244. package/front_end/third_party/lit-html/package/polyfill-support.js +1 -1
  245. package/front_end/third_party/lit-html/package/polyfill-support.js.map +1 -1
  246. package/front_end/third_party/lit-html/package/private-ssr-support.d.ts +12 -10
  247. package/front_end/third_party/lit-html/package/private-ssr-support.d.ts.map +1 -1
  248. package/front_end/third_party/lit-html/package/private-ssr-support.js +2 -2
  249. package/front_end/third_party/lit-html/package/private-ssr-support.js.map +1 -1
  250. package/front_end/third_party/lit-html/package/static.d.ts.map +1 -1
  251. package/front_end/third_party/lit-html/package/static.js +1 -1
  252. package/front_end/third_party/lit-html/package/static.js.map +1 -1
  253. package/front_end/third_party/marked/README.chromium +2 -2
  254. package/front_end/third_party/marked/marked.ts +2 -2
  255. package/front_end/third_party/marked/package/README.md +7 -1
  256. package/front_end/third_party/marked/package/bin/marked.js +214 -0
  257. package/front_end/third_party/marked/package/lib/marked.cjs +2907 -0
  258. package/front_end/third_party/marked/package/lib/marked.esm.d.ts +1 -3
  259. package/front_end/third_party/marked/package/lib/marked.esm.js +627 -586
  260. package/front_end/third_party/marked/package/lib/marked.umd.js +2913 -0
  261. package/front_end/third_party/marked/package/man/marked.1 +5 -24
  262. package/front_end/third_party/marked/package/man/marked.1.txt +21 -31
  263. package/front_end/third_party/marked/package/marked.min.js +1 -1
  264. package/front_end/third_party/marked/package/package.json +41 -32
  265. package/front_end/third_party/marked/package/src/Lexer.js +109 -108
  266. package/front_end/third_party/marked/package/src/Parser.js +38 -15
  267. package/front_end/third_party/marked/package/src/Renderer.js +5 -5
  268. package/front_end/third_party/marked/package/src/Slugger.js +2 -2
  269. package/front_end/third_party/marked/package/src/TextRenderer.js +2 -2
  270. package/front_end/third_party/marked/package/src/Tokenizer.js +215 -190
  271. package/front_end/third_party/marked/package/src/defaults.js +6 -9
  272. package/front_end/third_party/marked/package/src/helpers.js +16 -27
  273. package/front_end/third_party/marked/package/src/marked.js +146 -63
  274. package/front_end/third_party/marked/package/src/rules.js +20 -45
  275. package/front_end/third_party/wasmparser/README.chromium +2 -2
  276. package/front_end/third_party/wasmparser/package/.github/workflows/main.yml +47 -0
  277. package/front_end/third_party/wasmparser/package/CHANGELOG.md +12 -0
  278. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +53 -53
  279. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
  280. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +53 -53
  281. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
  282. package/front_end/third_party/wasmparser/package/package.json +1 -1
  283. package/front_end/third_party/wasmparser/package/src/WasmParser.ts +53 -53
  284. package/front_end/ui/components/adorners/Adorner.ts +14 -14
  285. package/front_end/ui/components/buttons/Button.ts +133 -42
  286. package/front_end/ui/components/buttons/button.css +31 -0
  287. package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
  288. package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
  289. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  290. package/front_end/ui/components/docs/button/basic.html +3 -0
  291. package/front_end/ui/components/docs/button/basic.ts +58 -0
  292. package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
  293. package/front_end/ui/components/icon_button/Icon.ts +24 -21
  294. package/front_end/ui/components/icon_button/IconButton.ts +31 -31
  295. package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
  296. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
  297. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
  298. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
  299. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
  300. package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
  301. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +25 -25
  302. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
  303. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
  304. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
  305. package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
  306. package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
  307. package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
  308. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
  309. package/front_end/ui/components/report_view/ReportView.ts +18 -18
  310. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
  311. package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
  312. package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
  313. package/front_end/ui/components/text_editor/TextEditor.ts +68 -36
  314. package/front_end/ui/components/text_editor/config.ts +4 -2
  315. package/front_end/ui/components/text_editor/javascript.ts +6 -6
  316. package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
  317. package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
  318. package/front_end/ui/legacy/Infobar.ts +9 -0
  319. package/front_end/ui/legacy/InspectorView.ts +1 -1
  320. package/front_end/ui/legacy/ListWidget.ts +2 -2
  321. package/front_end/ui/legacy/ViewManager.ts +6 -0
  322. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +20 -0
  323. package/front_end/ui/legacy/tabbedPane.css +1 -1
  324. package/inspector_overlay/main.ts +3 -0
  325. package/package.json +1 -1
  326. package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
  327. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
@@ -1 +1 @@
1
- {"version":3,"file":"experimental-hydrate.js","sources":["src/experimental-hydrate.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport type {TemplateResult} from './lit-html.js';\n\nimport {noChange, RenderOptions, _Σ} from './lit-html.js';\nimport {AttributePartInfo, PartType} from './directive.js';\nimport {\n isPrimitive,\n isSingleExpression,\n isTemplateResult,\n} from './directive-helpers.js';\n\nconst {\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _ElementPart: ElementPart,\n} = _Σ;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\ntype TemplateInstance = InstanceType<typeof TemplateInstance>;\n\n/**\n * Information needed to rehydrate a single TemplateResult.\n */\ntype ChildPartState =\n | {\n type: 'leaf';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n }\n | {\n type: 'iterable';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n value: Iterable<unknown>;\n iterator: Iterator<unknown>;\n done: boolean;\n }\n | {\n type: 'template-instance';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n\n result: TemplateResult;\n\n /** The TemplateInstance created from the TemplateResult */\n instance: TemplateInstance;\n\n /**\n * The index of the next Template part to be hydrated. This is mutable and\n * updated as the tree walk discovers new part markers at the right level in\n * the template instance tree. Note there is only one Template part per\n * attribute with (one or more) bindings.\n */\n templatePartIndex: number;\n\n /**\n * The index of the next TemplateInstance part to be hydrated. This is used\n * to retrieve the value from the TemplateResult and initialize the\n * TemplateInstance parts' values for dirty-checking on first render.\n */\n instancePartIndex: number;\n };\n\n/**\n * hydrate() operates on a container with server-side rendered content and\n * restores the client side data structures needed for lit-html updates such as\n * TemplateInstances and Parts. After calling `hydrate`, lit-html will behave as\n * if it initially rendered the DOM, and any subsequent updates will update\n * efficiently, the same as if lit-html had rendered the DOM on the client.\n *\n * hydrate() must be called on DOM that adheres the to lit-ssr structure for\n * parts. ChildParts must be represented with both a start and end comment\n * marker, and ChildParts that contain a TemplateInstance must have the template\n * digest written into the comment data.\n *\n * Since render() encloses its output in a ChildPart, there must always be a root\n * ChildPart.\n *\n * Example (using for # ... for annotations in HTML)\n *\n * Given this input:\n *\n * html`<div class=${x}>${y}</div>`\n *\n * The SSR DOM is:\n *\n * <!--lit-part AEmR7W+R0Ak=--> # Start marker for the root ChildPart created\n * # by render(). Includes the digest of the\n * # template\n * <div class=\"TEST_X\">\n * <!--lit-node 0--> # Indicates there are attribute bindings here\n * # The number is the depth-first index of the parent\n * # node in the template.\n * <!--lit-part--> # Start marker for the ${x} expression\n * TEST_Y\n * <!--/lit-part--> # End marker for the ${x} expression\n * </div>\n *\n * <!--/lit-part--> # End marker for the root ChildPart\n *\n * @param rootValue\n * @param container\n * @param userOptions\n */\nexport const hydrate = (\n rootValue: unknown,\n container: Element | DocumentFragment,\n options: Partial<RenderOptions> = {}\n) => {\n // TODO(kschaaf): Do we need a helper for _$litPart$ (\"part for node\")?\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((container as any)._$litPart$ !== undefined) {\n throw new Error('container already contains a live render');\n }\n\n // Since render() creates a ChildPart to render into, we'll always have\n // exactly one root part. We need to hold a reference to it so we can set\n // it in the parts cache.\n let rootPart: ChildPart | undefined = undefined;\n\n // When we are in-between ChildPart markers, this is the current ChildPart.\n // It's needed to be able to set the ChildPart's endNode when we see a\n // close marker\n let currentChildPart: ChildPart | undefined = undefined;\n\n // Used to remember parent template state as we recurse into nested\n // templates\n const stack: Array<ChildPartState> = [];\n\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_COMMENT,\n null,\n false\n );\n let marker: Comment | null;\n\n // Walk the DOM looking for part marker comments\n while ((marker = walker.nextNode() as Comment | null) !== null) {\n const markerText = marker.data;\n if (markerText.startsWith('lit-part')) {\n if (stack.length === 0 && rootPart !== undefined) {\n throw new Error('there must be only one root part per container');\n }\n // Create a new ChildPart and push it onto the stack\n currentChildPart = openChildPart(rootValue, marker, stack, options);\n rootPart ??= currentChildPart;\n } else if (markerText.startsWith('lit-node')) {\n // Create and hydrate attribute parts into the current ChildPart on the\n // stack\n createAttributeParts(marker, stack, options);\n // Remove `defer-hydration` attribute, if any\n const parent = marker.parentElement!;\n if (parent.hasAttribute('defer-hydration')) {\n parent.removeAttribute('defer-hydration');\n }\n } else if (markerText.startsWith('/lit-part')) {\n // Close the current ChildPart, and pop the previous one off the stack\n if (stack.length === 1 && currentChildPart !== rootPart) {\n throw new Error('internal error');\n }\n currentChildPart = closeChildPart(marker, currentChildPart, stack);\n }\n }\n console.assert(\n rootPart !== undefined,\n 'there should be exactly one root part in a render container'\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (container as any)._$litPart$ = rootPart;\n};\n\nconst openChildPart = (\n rootValue: unknown,\n marker: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n let value: unknown;\n // We know the startNode now. We'll know the endNode when we get to\n // the matching marker and set it in closeChildPart()\n // TODO(kschaaf): Current constructor takes both nodes\n let part;\n if (stack.length === 0) {\n part = new ChildPart(marker, null, undefined, options);\n value = rootValue;\n } else {\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n part = new ChildPart(marker, null, state.instance, options);\n state.instance._parts.push(part);\n value = state.result.values[state.instancePartIndex++];\n state.templatePartIndex++;\n } else if (state.type === 'iterable') {\n part = new ChildPart(marker, null, state.part, options);\n const result = state.iterator.next();\n if (result.done) {\n value = undefined;\n state.done = true;\n throw new Error('Unhandled shorter than expected iterable');\n } else {\n value = result.value;\n }\n (state.part._$committedValue as Array<ChildPart>).push(part);\n } else {\n // state.type === 'leaf'\n // TODO(kschaaf): This is unexpected, and likely a result of a primitive\n // been rendered on the client when a TemplateResult was rendered on the\n // server; this part will be hydrated but not used. We can detect it, but\n // we need to decide what to do in this case. Note that this part won't be\n // retained by any parent TemplateInstance, since a primitive had been\n // rendered in its place.\n // https://github.com/Polymer/lit-html/issues/1434\n // throw new Error('Hydration value mismatch: Found a TemplateInstance' +\n // 'where a leaf value was expected');\n part = new ChildPart(marker, null, state.part, options);\n }\n }\n\n // Initialize the ChildPart state depending on the type of value and push\n // it onto the stack. This logic closely follows the ChildPart commit()\n // cascade order:\n // 1. directive\n // 2. noChange\n // 3. primitive (note strings must be handled before iterables, since they\n // are iterable)\n // 4. TemplateResult\n // 5. Node (not yet implemented, but fallback handling is fine)\n // 6. Iterable\n // 7. nothing (handled in fallback)\n // 8. Fallback for everything else\n value = resolveDirective(part, value);\n if (value === noChange) {\n stack.push({part, type: 'leaf'});\n } else if (isPrimitive(value)) {\n stack.push({part, type: 'leaf'});\n part._$committedValue = value;\n // TODO(kschaaf): We can detect when a primitive is being hydrated on the\n // client where a TemplateResult was rendered on the server, but we need to\n // decide on a strategy for what to do next.\n // https://github.com/Polymer/lit-html/issues/1434\n // if (marker.data !== 'lit-part') {\n // throw new Error('Hydration value mismatch: Primitive found where TemplateResult expected');\n // }\n } else if (isTemplateResult(value)) {\n // Check for a template result digest\n const markerWithDigest = `lit-part ${digestForTemplateResult(value)}`;\n if (marker.data === markerWithDigest) {\n const template = ChildPart.prototype._$getTemplate(value);\n const instance = new TemplateInstance(template, part);\n stack.push({\n type: 'template-instance',\n instance,\n part,\n templatePartIndex: 0,\n instancePartIndex: 0,\n result: value,\n });\n // For TemplateResult values, we set the part value to the\n // generated TemplateInstance\n part._$committedValue = instance;\n } else {\n // TODO: if this isn't the server-rendered template, do we\n // need to stop hydrating this subtree? Clear it? Add tests.\n throw new Error(\n 'Hydration value mismatch: Unexpected TemplateResult rendered to part'\n );\n }\n } else if (isIterable(value)) {\n // currentChildPart.value will contain an array of ChildParts\n stack.push({\n part: part,\n type: 'iterable',\n value,\n iterator: value[Symbol.iterator](),\n done: false,\n });\n part._$committedValue = [];\n } else {\n // Fallback for everything else (nothing, Objects, Functions,\n // etc.): we just initialize the part's value\n // Note that `Node` value types are not currently supported during\n // SSR, so that part of the cascade is missing.\n stack.push({part: part, type: 'leaf'});\n part._$committedValue = value == null ? '' : value;\n }\n return part;\n};\n\nconst closeChildPart = (\n marker: Comment,\n part: ChildPart | undefined,\n stack: Array<ChildPartState>\n): ChildPart | undefined => {\n if (part === undefined) {\n throw new Error('unbalanced part marker');\n }\n\n part._$endNode = marker;\n\n const currentState = stack.pop()!;\n\n if (currentState.type === 'iterable') {\n if (!currentState.iterator.next().done) {\n throw new Error('unexpected longer than expected iterable');\n }\n }\n\n if (stack.length > 0) {\n const state = stack[stack.length - 1];\n return state.part;\n } else {\n return undefined;\n }\n};\n\nconst createAttributeParts = (\n comment: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n // Get the nodeIndex from DOM. We're only using this for an integrity\n // check right now, we might not need it.\n const match = /lit-node (\\d+)/.exec(comment.data)!;\n const nodeIndex = parseInt(match[1]);\n\n // For void elements, the node the comment was referring to will be\n // the previousSibling; for non-void elements, the comment is guaranteed\n // to be the first child of the element (i.e. it won't have a previousSibling\n // meaning it should use the parentElement)\n const node = comment.previousSibling ?? comment.parentElement;\n\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n const instance = state.instance;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // If the next template part is in attribute-position on the current node,\n // create the instance part for it and prime its state\n const templatePart = instance._$template.parts[state.templatePartIndex];\n if (\n templatePart === undefined ||\n (templatePart.type !== PartType.ATTRIBUTE &&\n templatePart.type !== PartType.ELEMENT) ||\n templatePart.index !== nodeIndex\n ) {\n break;\n }\n\n if (templatePart.type === PartType.ATTRIBUTE) {\n // The instance part is created based on the constructor saved in the\n // template part\n const instancePart = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n state.instance,\n options\n );\n\n const value = isSingleExpression(\n (instancePart as unknown) as AttributePartInfo\n )\n ? state.result.values[state.instancePartIndex]\n : state.result.values;\n\n // Setting the attribute value primes committed value with the resolved\n // directive value; we only then commit that value for event/property\n // parts since those were not serialized, and pass `noCommit` for the\n // others to avoid perf impact of touching the DOM unnecessarily\n const noCommit = !(\n instancePart.type === PartType.EVENT ||\n instancePart.type === PartType.PROPERTY\n );\n instancePart._$setValue(\n value,\n instancePart,\n state.instancePartIndex,\n noCommit\n );\n state.instancePartIndex += templatePart.strings.length - 1;\n instance._parts.push(instancePart);\n } else {\n // templatePart.type === PartType.ELEMENT\n const instancePart = new ElementPart(\n node as HTMLElement,\n state.instance,\n options\n );\n resolveDirective(\n instancePart,\n state.result.values[state.instancePartIndex++]\n );\n instance._parts.push(instancePart);\n }\n state.templatePartIndex++;\n }\n } else {\n throw new Error('internal error');\n }\n};\n\n// Number of 32 bit elements to use to create template digests\nconst digestSize = 2;\n// We need to specify a digest to use across rendering environments. This is a\n// simple digest build from a DJB2-ish hash modified from:\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\n// It has been changed to an array of hashes to add additional bits.\n// Goals:\n// - Extremely low collision rate. We may not be able to detect collisions.\n// - Extremely fast.\n// - Extremely small code size.\n// - Safe to include in HTML comment text or attribute value.\n// - Easily specifiable and implementable in multiple languages.\n// We don't care about cryptographic suitability.\nexport const digestForTemplateResult = (templateResult: TemplateResult) => {\n const hashes = new Uint32Array(digestSize).fill(5381);\n\n for (const s of templateResult.strings) {\n for (let i = 0; i < s.length; i++) {\n hashes[i % digestSize] = (hashes[i % digestSize] * 33) ^ s.charCodeAt(i);\n }\n }\n return btoa(String.fromCharCode(...new Uint8Array(hashes.buffer)));\n};\n"],"names":["tt","TemplateInstance","it","isIterable","st","resolveDirective","et","ChildPart","ht","ElementPart","_Σ","hydrate","rootValue","container","options","undefined","_$litPart$","Error","rootPart","currentChildPart","stack","walker","document","createTreeWalker","NodeFilter","SHOW_COMMENT","marker","nextNode","markerText","data","startsWith","length","openChildPart","createAttributeParts","parent","parentElement","hasAttribute","removeAttribute","closeChildPart","console","assert","value","part","state","type","instance","_parts","push","result","values","instancePartIndex","templatePartIndex","iterator","next","done","_$committedValue","noChange","isPrimitive","isTemplateResult","markerWithDigest","digestForTemplateResult","template","prototype","_$getTemplate","Symbol","_$endNode","currentState","pop","comment","match","exec","nodeIndex","parseInt","node","previousSibling","templatePart","_$template","parts","PartType","ATTRIBUTE","ELEMENT","index","instancePart","ctor","name","strings","isSingleExpression","noCommit","EVENT","PROPERTY","_$setValue","templateResult","hashes","Uint32Array","fill","s","i","charCodeAt","btoa","String","fromCharCode","Uint8Array","buffer"],"mappings":";;;;;GAgBA,MACEA,GAAmBC,EACnBC,GAAaC,EACbC,GAAmBC,EACnBC,GAAYC,EACZC,GAAcC,GACZC,EAyFSC,EAAU,CACrBC,EACAC,EACAC,EAAkC,MAIlC,QAAsCC,IAAjCF,EAAkBG,WACrB,MAAUC,MAAM,4CAMlB,IAAIC,EAKAC,EAIJ,MAAMC,EAA+B,GAE/BC,EAASC,SAASC,iBACtBV,EACAW,WAAWC,aACX,MACA,GAEF,IAAIC,EAGJ,KAA0D,QAAlDA,EAASL,EAAOM,aAAwC,CAC9D,MAAMC,EAAaF,EAAOG,KAC1B,GAAID,EAAWE,WAAW,YAAa,CACrC,GAAqB,IAAjBV,EAAMW,aAA6BhB,IAAbG,EACxB,MAAUD,MAAM,kDAGlBE,EAAmBa,EAAcpB,EAAWc,EAAQN,EAAON,GAC3DI,MAAAA,IAAAA,EAAaC,QACR,GAAIS,EAAWE,WAAW,YAAa,CAG5CG,EAAqBP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AAjB4D,GACCA,EAAa/B,OAASkC,EAASC,WAC9BJ,EAAa/B,OAASkC,EAASE,SACjCL,EAAaM,QAAUV,EAEvB,MAGF,GAAII,EAAa/B,OAASkC,EAASC,UAAW,CAG5C,MAAMG,EAAe,IAAIP,EAAaQ,KACpCV,EACAE,EAAaS,KACbT,EAAaU,QACb1C,EAAME,SACN/B,GAGI2B,EAAQ6C,EACXJ,GAECvC,EAAMK,OAAOC,OAAON,EAAMO,mBAC1BP,EAAMK,OAAOC,OAMXsC,IACJL,EAAatC,OAASkC,EAASU,OAC/BN,EAAatC,OAASkC,EAASW,UAEjCP,EAAaQ,EACXjD,EACAyC,EACAvC,EAAMO,kBACNqC,GAEF5C,EAAMO,mBAAqByB,EAAaU,QAAQtD,OAAS,EACzDc,EAASC,EAAOC,KAAKmC,OAChB,CAEL,MAAMA,EAAe,IAAIzE,EACvBgE,EACA9B,EAAME,SACN/B,GAEFT,EACE6E,EACAvC,EAAMK,OAAOC,OAAON,EAAMO,sBAE5BL,EAASC,EAAOC,KAAKmC,GAEvBvC,EAAMQ,uBAoBCS,EAA2B+B,IACtC,MAAMC,EAAS,IAAIC,YAbF,GAa0BC,KAAK,MAEhD,IAAK,MAAMC,KAAKJ,EAAeN,QAC7B,IAAK,IAAIW,EAAI,EAAGA,EAAID,EAAEhE,OAAQiE,IAC5BJ,EAAOI,EAjBM,GAiBsC,GAAzBJ,EAAOI,EAjBpB,GAiB4CD,EAAEE,WAAWD,GAG1E,OAAOE,KAAKC,OAAOC,gBAAgB,IAAIC,WAAWT,EAAOU"}
1
+ {"version":3,"file":"experimental-hydrate.js","sources":["src/experimental-hydrate.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport type {TemplateResult} from './lit-html.js';\n\nimport {noChange, RenderOptions, _$LH} from './lit-html.js';\nimport {AttributePartInfo, PartType} from './directive.js';\nimport {\n isPrimitive,\n isSingleExpression,\n isTemplateResult,\n} from './directive-helpers.js';\n\nconst {\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _ElementPart: ElementPart,\n} = _$LH;\n\ntype ChildPart = InstanceType<typeof ChildPart>;\ntype TemplateInstance = InstanceType<typeof TemplateInstance>;\n\n/**\n * Information needed to rehydrate a single TemplateResult.\n */\ntype ChildPartState =\n | {\n type: 'leaf';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n }\n | {\n type: 'iterable';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n value: Iterable<unknown>;\n iterator: Iterator<unknown>;\n done: boolean;\n }\n | {\n type: 'template-instance';\n /** The ChildPart that the result is rendered to */\n part: ChildPart;\n\n result: TemplateResult;\n\n /** The TemplateInstance created from the TemplateResult */\n instance: TemplateInstance;\n\n /**\n * The index of the next Template part to be hydrated. This is mutable and\n * updated as the tree walk discovers new part markers at the right level in\n * the template instance tree. Note there is only one Template part per\n * attribute with (one or more) bindings.\n */\n templatePartIndex: number;\n\n /**\n * The index of the next TemplateInstance part to be hydrated. This is used\n * to retrieve the value from the TemplateResult and initialize the\n * TemplateInstance parts' values for dirty-checking on first render.\n */\n instancePartIndex: number;\n };\n\n/**\n * hydrate() operates on a container with server-side rendered content and\n * restores the client side data structures needed for lit-html updates such as\n * TemplateInstances and Parts. After calling `hydrate`, lit-html will behave as\n * if it initially rendered the DOM, and any subsequent updates will update\n * efficiently, the same as if lit-html had rendered the DOM on the client.\n *\n * hydrate() must be called on DOM that adheres the to lit-ssr structure for\n * parts. ChildParts must be represented with both a start and end comment\n * marker, and ChildParts that contain a TemplateInstance must have the template\n * digest written into the comment data.\n *\n * Since render() encloses its output in a ChildPart, there must always be a root\n * ChildPart.\n *\n * Example (using for # ... for annotations in HTML)\n *\n * Given this input:\n *\n * html`<div class=${x}>${y}</div>`\n *\n * The SSR DOM is:\n *\n * <!--lit-part AEmR7W+R0Ak=--> # Start marker for the root ChildPart created\n * # by render(). Includes the digest of the\n * # template\n * <div class=\"TEST_X\">\n * <!--lit-node 0--> # Indicates there are attribute bindings here\n * # The number is the depth-first index of the parent\n * # node in the template.\n * <!--lit-part--> # Start marker for the ${x} expression\n * TEST_Y\n * <!--/lit-part--> # End marker for the ${x} expression\n * </div>\n *\n * <!--/lit-part--> # End marker for the root ChildPart\n *\n * @param rootValue\n * @param container\n * @param userOptions\n */\nexport const hydrate = (\n rootValue: unknown,\n container: Element | DocumentFragment,\n options: Partial<RenderOptions> = {}\n) => {\n // TODO(kschaaf): Do we need a helper for _$litPart$ (\"part for node\")?\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((container as any)['_$litPart$'] !== undefined) {\n throw new Error('container already contains a live render');\n }\n\n // Since render() creates a ChildPart to render into, we'll always have\n // exactly one root part. We need to hold a reference to it so we can set\n // it in the parts cache.\n let rootPart: ChildPart | undefined = undefined;\n\n // When we are in-between ChildPart markers, this is the current ChildPart.\n // It's needed to be able to set the ChildPart's endNode when we see a\n // close marker\n let currentChildPart: ChildPart | undefined = undefined;\n\n // Used to remember parent template state as we recurse into nested\n // templates\n const stack: Array<ChildPartState> = [];\n\n const walker = document.createTreeWalker(\n container,\n NodeFilter.SHOW_COMMENT,\n null,\n false\n );\n let marker: Comment | null;\n\n // Walk the DOM looking for part marker comments\n while ((marker = walker.nextNode() as Comment | null) !== null) {\n const markerText = marker.data;\n if (markerText.startsWith('lit-part')) {\n if (stack.length === 0 && rootPart !== undefined) {\n throw new Error('there must be only one root part per container');\n }\n // Create a new ChildPart and push it onto the stack\n currentChildPart = openChildPart(rootValue, marker, stack, options);\n rootPart ??= currentChildPart;\n } else if (markerText.startsWith('lit-node')) {\n // Create and hydrate attribute parts into the current ChildPart on the\n // stack\n createAttributeParts(marker, stack, options);\n // Remove `defer-hydration` attribute, if any\n const parent = marker.parentElement!;\n if (parent.hasAttribute('defer-hydration')) {\n parent.removeAttribute('defer-hydration');\n }\n } else if (markerText.startsWith('/lit-part')) {\n // Close the current ChildPart, and pop the previous one off the stack\n if (stack.length === 1 && currentChildPart !== rootPart) {\n throw new Error('internal error');\n }\n currentChildPart = closeChildPart(marker, currentChildPart, stack);\n }\n }\n console.assert(\n rootPart !== undefined,\n 'there should be exactly one root part in a render container'\n );\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (container as any)['_$litPart$'] = rootPart;\n};\n\nconst openChildPart = (\n rootValue: unknown,\n marker: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n let value: unknown;\n // We know the startNode now. We'll know the endNode when we get to\n // the matching marker and set it in closeChildPart()\n // TODO(kschaaf): Current constructor takes both nodes\n let part;\n if (stack.length === 0) {\n part = new ChildPart(marker, null, undefined, options);\n value = rootValue;\n } else {\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n part = new ChildPart(marker, null, state.instance, options);\n state.instance._parts.push(part);\n value = state.result.values[state.instancePartIndex++];\n state.templatePartIndex++;\n } else if (state.type === 'iterable') {\n part = new ChildPart(marker, null, state.part, options);\n const result = state.iterator.next();\n if (result.done) {\n value = undefined;\n state.done = true;\n throw new Error('Unhandled shorter than expected iterable');\n } else {\n value = result.value;\n }\n (state.part._$committedValue as Array<ChildPart>).push(part);\n } else {\n // state.type === 'leaf'\n // TODO(kschaaf): This is unexpected, and likely a result of a primitive\n // been rendered on the client when a TemplateResult was rendered on the\n // server; this part will be hydrated but not used. We can detect it, but\n // we need to decide what to do in this case. Note that this part won't be\n // retained by any parent TemplateInstance, since a primitive had been\n // rendered in its place.\n // https://github.com/lit/lit/issues/1434\n // throw new Error('Hydration value mismatch: Found a TemplateInstance' +\n // 'where a leaf value was expected');\n part = new ChildPart(marker, null, state.part, options);\n }\n }\n\n // Initialize the ChildPart state depending on the type of value and push\n // it onto the stack. This logic closely follows the ChildPart commit()\n // cascade order:\n // 1. directive\n // 2. noChange\n // 3. primitive (note strings must be handled before iterables, since they\n // are iterable)\n // 4. TemplateResult\n // 5. Node (not yet implemented, but fallback handling is fine)\n // 6. Iterable\n // 7. nothing (handled in fallback)\n // 8. Fallback for everything else\n value = resolveDirective(part, value);\n if (value === noChange) {\n stack.push({part, type: 'leaf'});\n } else if (isPrimitive(value)) {\n stack.push({part, type: 'leaf'});\n part._$committedValue = value;\n // TODO(kschaaf): We can detect when a primitive is being hydrated on the\n // client where a TemplateResult was rendered on the server, but we need to\n // decide on a strategy for what to do next.\n // https://github.com/lit/lit/issues/1434\n // if (marker.data !== 'lit-part') {\n // throw new Error('Hydration value mismatch: Primitive found where TemplateResult expected');\n // }\n } else if (isTemplateResult(value)) {\n // Check for a template result digest\n const markerWithDigest = `lit-part ${digestForTemplateResult(value)}`;\n if (marker.data === markerWithDigest) {\n const template = ChildPart.prototype._$getTemplate(value);\n const instance = new TemplateInstance(template, part);\n stack.push({\n type: 'template-instance',\n instance,\n part,\n templatePartIndex: 0,\n instancePartIndex: 0,\n result: value,\n });\n // For TemplateResult values, we set the part value to the\n // generated TemplateInstance\n part._$committedValue = instance;\n } else {\n // TODO: if this isn't the server-rendered template, do we\n // need to stop hydrating this subtree? Clear it? Add tests.\n throw new Error(\n 'Hydration value mismatch: Unexpected TemplateResult rendered to part'\n );\n }\n } else if (isIterable(value)) {\n // currentChildPart.value will contain an array of ChildParts\n stack.push({\n part: part,\n type: 'iterable',\n value,\n iterator: value[Symbol.iterator](),\n done: false,\n });\n part._$committedValue = [];\n } else {\n // Fallback for everything else (nothing, Objects, Functions,\n // etc.): we just initialize the part's value\n // Note that `Node` value types are not currently supported during\n // SSR, so that part of the cascade is missing.\n stack.push({part: part, type: 'leaf'});\n part._$committedValue = value == null ? '' : value;\n }\n return part;\n};\n\nconst closeChildPart = (\n marker: Comment,\n part: ChildPart | undefined,\n stack: Array<ChildPartState>\n): ChildPart | undefined => {\n if (part === undefined) {\n throw new Error('unbalanced part marker');\n }\n\n part._$endNode = marker;\n\n const currentState = stack.pop()!;\n\n if (currentState.type === 'iterable') {\n if (!currentState.iterator.next().done) {\n throw new Error('unexpected longer than expected iterable');\n }\n }\n\n if (stack.length > 0) {\n const state = stack[stack.length - 1];\n return state.part;\n } else {\n return undefined;\n }\n};\n\nconst createAttributeParts = (\n comment: Comment,\n stack: Array<ChildPartState>,\n options: RenderOptions\n) => {\n // Get the nodeIndex from DOM. We're only using this for an integrity\n // check right now, we might not need it.\n const match = /lit-node (\\d+)/.exec(comment.data)!;\n const nodeIndex = parseInt(match[1]);\n\n // For void elements, the node the comment was referring to will be\n // the previousSibling; for non-void elements, the comment is guaranteed\n // to be the first child of the element (i.e. it won't have a previousSibling\n // meaning it should use the parentElement)\n const node = comment.previousSibling ?? comment.parentElement;\n\n const state = stack[stack.length - 1];\n if (state.type === 'template-instance') {\n const instance = state.instance;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // If the next template part is in attribute-position on the current node,\n // create the instance part for it and prime its state\n const templatePart = instance._$template.parts[state.templatePartIndex];\n if (\n templatePart === undefined ||\n (templatePart.type !== PartType.ATTRIBUTE &&\n templatePart.type !== PartType.ELEMENT) ||\n templatePart.index !== nodeIndex\n ) {\n break;\n }\n\n if (templatePart.type === PartType.ATTRIBUTE) {\n // The instance part is created based on the constructor saved in the\n // template part\n const instancePart = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n state.instance,\n options\n );\n\n const value = isSingleExpression(\n instancePart as unknown as AttributePartInfo\n )\n ? state.result.values[state.instancePartIndex]\n : state.result.values;\n\n // Setting the attribute value primes committed value with the resolved\n // directive value; we only then commit that value for event/property\n // parts since those were not serialized, and pass `noCommit` for the\n // others to avoid perf impact of touching the DOM unnecessarily\n const noCommit = !(\n instancePart.type === PartType.EVENT ||\n instancePart.type === PartType.PROPERTY\n );\n instancePart._$setValue(\n value,\n instancePart,\n state.instancePartIndex,\n noCommit\n );\n state.instancePartIndex += templatePart.strings.length - 1;\n instance._parts.push(instancePart);\n } else {\n // templatePart.type === PartType.ELEMENT\n const instancePart = new ElementPart(\n node as HTMLElement,\n state.instance,\n options\n );\n resolveDirective(\n instancePart,\n state.result.values[state.instancePartIndex++]\n );\n instance._parts.push(instancePart);\n }\n state.templatePartIndex++;\n }\n } else {\n throw new Error('internal error');\n }\n};\n\n// Number of 32 bit elements to use to create template digests\nconst digestSize = 2;\n// We need to specify a digest to use across rendering environments. This is a\n// simple digest build from a DJB2-ish hash modified from:\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\n// It has been changed to an array of hashes to add additional bits.\n// Goals:\n// - Extremely low collision rate. We may not be able to detect collisions.\n// - Extremely fast.\n// - Extremely small code size.\n// - Safe to include in HTML comment text or attribute value.\n// - Easily specifiable and implementable in multiple languages.\n// We don't care about cryptographic suitability.\nexport const digestForTemplateResult = (templateResult: TemplateResult) => {\n const hashes = new Uint32Array(digestSize).fill(5381);\n\n for (const s of templateResult.strings) {\n for (let i = 0; i < s.length; i++) {\n hashes[i % digestSize] = (hashes[i % digestSize] * 33) ^ s.charCodeAt(i);\n }\n }\n return btoa(String.fromCharCode(...new Uint8Array(hashes.buffer)));\n};\n"],"names":["_TemplateInstance","TemplateInstance","_isIterable","isIterable","_resolveDirective","resolveDirective","_ChildPart","ChildPart","_ElementPart","ElementPart","_$LH","hydrate","rootValue","container","options","undefined","Error","rootPart","currentChildPart","stack","walker","document","createTreeWalker","NodeFilter","SHOW_COMMENT","marker","nextNode","markerText","data","startsWith","length","openChildPart","createAttributeParts","parent","parentElement","hasAttribute","removeAttribute","closeChildPart","console","assert","value","part","state","type","instance","_parts","push","result","values","instancePartIndex","templatePartIndex","iterator","next","done","_$committedValue","noChange","isPrimitive","isTemplateResult","markerWithDigest","digestForTemplateResult","template","prototype","_$getTemplate","Symbol","_$endNode","currentState","pop","comment","match","exec","nodeIndex","parseInt","node","previousSibling","templatePart","_$template","parts","PartType","ATTRIBUTE","ELEMENT","index","instancePart","ctor","name","strings","isSingleExpression","noCommit","EVENT","PROPERTY","_$setValue","templateResult","hashes","Uint32Array","fill","s","i","charCodeAt","btoa","String","f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O,sBAE5BL,EAASC,EAAOC,KAAKmC,GAEvBvC,EAAMQ,uBAoBCS,EAA2B+B,IACtC,MAAMC,EAAS,IAAIC,YAbF,GAa0BC,KAAK,MAEhD,IAAK,MAAMC,KAAKJ,EAAeN,QAC7B,IAAK,IAAIW,EAAI,EAAGA,EAAID,EAAEhE,OAAQiE,IAC5BJ,EAAOI,EAjBM,GAiBsC,GAAzBJ,EAAOI,EAjBpB,GAiB4CD,EAAEE,WAAWD,GAG1E,OAAOE,KAAKC,OAAOC,gBAAgB,IAAIC,WAAWT,EAAOU"}
@@ -43,22 +43,18 @@ export declare type ValueSanitizer = (value: unknown) => unknown;
43
43
  declare const HTML_RESULT = 1;
44
44
  declare const SVG_RESULT = 2;
45
45
  declare type ResultType = typeof HTML_RESULT | typeof SVG_RESULT;
46
- declare const ATTRIBUTE_PART = 1;
47
- declare const CHILD_PART = 2;
48
- declare const ELEMENT_PART = 6;
49
- declare const COMMENT_PART = 7;
50
46
  /**
51
47
  * The return type of the template tag functions.
52
48
  */
53
49
  export declare type TemplateResult<T extends ResultType = ResultType> = {
54
- _$litType$: T;
50
+ ['_$litType$']: T;
55
51
  strings: TemplateStringsArray;
56
52
  values: unknown[];
57
53
  };
58
54
  export declare type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;
59
55
  export declare type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;
60
56
  export interface CompiledTemplateResult {
61
- _$litType$: CompiledTemplate;
57
+ ['_$litType$']: CompiledTemplate;
62
58
  values: unknown[];
63
59
  }
64
60
  export interface CompiledTemplate extends Omit<Template, 'el'> {
@@ -68,6 +64,15 @@ export interface CompiledTemplate extends Omit<Template, 'el'> {
68
64
  /**
69
65
  * Interprets a template literal as an HTML template that can efficiently
70
66
  * render to and update a container.
67
+ *
68
+ * ```ts
69
+ * const header = (title: string) => html`<h1>${title}</h1>`;
70
+ * ```
71
+ *
72
+ * The `html` tag returns a description of the DOM to render as a value. It is
73
+ * lazy, meaning no work is done until the template is rendered. When rendering,
74
+ * if a template comes from the same expression as a previously rendered result,
75
+ * it's efficiently updated instead of replaced.
71
76
  */
72
77
  export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult<1>;
73
78
  /**
@@ -82,8 +87,32 @@ export declare const svg: (strings: TemplateStringsArray, ...values: unknown[])
82
87
  export declare const noChange: unique symbol;
83
88
  /**
84
89
  * A sentinel value that signals a ChildPart to fully clear its content.
90
+ *
91
+ * ```ts
92
+ * const button = html`${
93
+ * user.isAdmin
94
+ * ? html`<button>DELETE</button>`
95
+ * : nothing
96
+ * }`;
97
+ * ```
98
+ *
99
+ * Prefer using `nothing` over other falsy values as it provides a consistent
100
+ * behavior between various expression binding contexts.
101
+ *
102
+ * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the
103
+ * same and render no nodes. In attribute expressions, `nothing` _removes_ the
104
+ * attribute, while `undefined` and `null` will render an empty string. In
105
+ * property expressions `nothing` becomes `undefined`.
85
106
  */
86
107
  export declare const nothing: unique symbol;
108
+ /**
109
+ * Object specifying options for controlling lit-html rendering. Note that
110
+ * while `render` may be called multiple times on the same `container` (and
111
+ * `renderBefore` reference node) to efficiently update the rendered content,
112
+ * only the options passed in during the first render are respected during
113
+ * the lifetime of renders to that unique `container` + `renderBefore`
114
+ * combination.
115
+ */
87
116
  export interface RenderOptions {
88
117
  /**
89
118
  * An object to use as the `this` value for event listeners. It's often
@@ -102,6 +131,15 @@ export interface RenderOptions {
102
131
  creationScope?: {
103
132
  importNode(node: Node, deep?: boolean): Node;
104
133
  };
134
+ /**
135
+ * The initial connected state for the top-level part being rendered. If no
136
+ * `isConnected` option is set, `AsyncDirective`s will be connected by
137
+ * default. Set to `false` if the initial render occurs in a disconnected tree
138
+ * and `AsyncDirective`s should see `isConnected === false` for their initial
139
+ * render. The `part.setConnected()` method must be used subsequent to initial
140
+ * render to change the connected state of the part.
141
+ */
142
+ isConnected?: boolean;
105
143
  }
106
144
  /**
107
145
  * Renders a value, usually a lit-html TemplateResult, to the container.
@@ -110,103 +148,48 @@ export interface RenderOptions {
110
148
  * @param options
111
149
  */
112
150
  export declare const render: {
113
- (value: unknown, container: HTMLElement | DocumentFragment, options?: RenderOptions | undefined): ChildPart;
151
+ (value: unknown, container: HTMLElement | DocumentFragment, options?: RenderOptions | undefined): RootPart;
114
152
  setSanitizer: (newSanitizer: SanitizerFactory) => void;
115
153
  createSanitizer: SanitizerFactory;
116
154
  _testOnlyClearSanitizerFactoryDoNotCallOrElse: () => void;
117
155
  };
118
156
  export interface DirectiveParent {
119
157
  _$parent?: DirectiveParent;
158
+ _$isConnected: boolean;
120
159
  __directive?: Directive;
121
160
  __directives?: Array<Directive | undefined>;
122
161
  }
123
- /** @internal */
124
- export type { Template };
125
162
  declare class Template {
126
- /** @internal */
127
- el: HTMLTemplateElement;
128
- /** @internal */
129
- parts: Array<TemplatePart>;
130
- constructor({ strings, _$litType$: type }: TemplateResult, options?: RenderOptions);
163
+ constructor({ strings, ['_$litType$']: type }: TemplateResult, options?: RenderOptions);
164
+ /** @nocollapse */
131
165
  static createElement(html: TrustedHTML, _options?: RenderOptions): HTMLTemplateElement;
132
166
  }
133
167
  export interface Disconnectable {
134
168
  _$parent?: Disconnectable;
135
- _$disconnetableChildren?: Set<Disconnectable>;
169
+ _$disconnectableChildren?: Set<Disconnectable>;
170
+ _$isConnected: boolean;
136
171
  }
137
172
  declare function resolveDirective(part: ChildPart | AttributePart | ElementPart, value: unknown, parent?: DirectiveParent, attributeIndex?: number): unknown;
138
173
  /**
139
174
  * An updateable instance of a Template. Holds references to the Parts used to
140
175
  * update the template instance.
141
176
  */
142
- declare class TemplateInstance {
143
- /** @internal */
144
- _$template: Template;
145
- /** @internal */
146
- _parts: Array<Part | undefined>;
147
- /** @internal */
148
- _$parent: Disconnectable;
149
- /** @internal */
150
- _$disconnetableChildren?: Set<Disconnectable>;
177
+ declare class TemplateInstance implements Disconnectable {
151
178
  constructor(template: Template, parent: ChildPart);
179
+ get parentNode(): Node;
180
+ get _$isConnected(): boolean;
152
181
  _clone(options: RenderOptions | undefined): Node;
153
182
  _update(values: Array<unknown>): void;
154
183
  }
155
- declare type AttributeTemplatePart = {
156
- readonly type: typeof ATTRIBUTE_PART;
157
- readonly index: number;
158
- readonly name: string;
159
- /** @internal */
160
- readonly ctor: typeof AttributePart;
161
- /** @internal */
162
- readonly strings: ReadonlyArray<string>;
163
- };
164
- declare type NodeTemplatePart = {
165
- readonly type: typeof CHILD_PART;
166
- readonly index: number;
167
- };
168
- declare type ElementTemplatePart = {
169
- readonly type: typeof ELEMENT_PART;
170
- readonly index: number;
171
- };
172
- declare type CommentTemplatePart = {
173
- readonly type: typeof COMMENT_PART;
174
- readonly index: number;
175
- };
176
- /**
177
- * A TemplatePart represents a dynamic part in a template, before the template
178
- * is instantiated. When a template is instantiated Parts are created from
179
- * TemplateParts.
180
- */
181
- declare type TemplatePart = NodeTemplatePart | AttributeTemplatePart | ElementTemplatePart | CommentTemplatePart;
182
184
  export declare type Part = ChildPart | AttributePart | PropertyPart | BooleanAttributePart | ElementPart | EventPart;
183
185
  export type { ChildPart };
184
- declare class ChildPart {
186
+ declare class ChildPart implements Disconnectable {
185
187
  readonly type = 2;
186
188
  readonly options: RenderOptions | undefined;
187
189
  _$committedValue: unknown;
188
- /** @internal */
189
- __directive?: Directive;
190
- /** @internal */
191
- _$startNode: ChildNode;
192
- /** @internal */
193
- _$endNode: ChildNode | null;
194
190
  private _textSanitizer;
195
- /** @internal */
196
- _$parent: Disconnectable | undefined;
197
- /** @internal */
198
- _$disconnetableChildren?: Set<Disconnectable>;
199
- /** @internal */
200
- _$setChildPartConnected?(isConnected: boolean, removeFromParent?: boolean, from?: number): void;
201
- /** @internal */
202
- _$reparentDisconnectables?(parent: Disconnectable): void;
191
+ get _$isConnected(): boolean;
203
192
  constructor(startNode: ChildNode, endNode: ChildNode | null, parent: TemplateInstance | ChildPart | undefined, options: RenderOptions | undefined);
204
- /**
205
- * Sets the connection state for any `AsyncDirectives` contained
206
- * within this part and runs their `disconnected` or `reconnected`, according
207
- * to the `isConnected` argument.
208
- */
209
- setConnected(isConnected: boolean): void;
210
193
  /**
211
194
  * The parent node into which the part renders its content.
212
195
  *
@@ -241,24 +224,32 @@ declare class ChildPart {
241
224
  private _commitNode;
242
225
  private _commitText;
243
226
  private _commitTemplateResult;
244
- /** @internal */
245
- _$getTemplate(result: TemplateResult): Template;
246
227
  private _commitIterable;
228
+ }
229
+ /**
230
+ * A top-level `ChildPart` returned from `render` that manages the connected
231
+ * state of `AsyncDirective`s created throughout the tree below it.
232
+ */
233
+ export interface RootPart extends ChildPart {
247
234
  /**
248
- * Removes the nodes contained within this Part from the DOM.
235
+ * Sets the connection state for `AsyncDirective`s contained within this root
236
+ * ChildPart.
249
237
  *
250
- * @param start Start node to clear from, for clearing a subset of the part's
251
- * DOM (used when truncating iterables)
252
- * @param from When `start` is specified, the index within the iterable from
253
- * which ChildParts are being removed, used for disconnecting directives in
254
- * those Parts.
238
+ * lit-html does not automatically monitor the connectedness of DOM rendered;
239
+ * as such, it is the responsibility of the caller to `render` to ensure that
240
+ * `part.setConnected(false)` is called before the part object is potentially
241
+ * discarded, to ensure that `AsyncDirective`s have a chance to dispose of
242
+ * any resources being held. If a `RootPart` that was prevously
243
+ * disconnected is subsequently re-connected (and its `AsyncDirective`s should
244
+ * re-connect), `setConnected(true)` should be called.
255
245
  *
256
- * @internal
246
+ * @param isConnected Whether directives within this tree should be connected
247
+ * or not
257
248
  */
258
- _$clear(start?: ChildNode | null, from?: number): void;
249
+ setConnected(isConnected: boolean): void;
259
250
  }
260
251
  export type { AttributePart };
261
- declare class AttributePart {
252
+ declare class AttributePart implements Disconnectable {
262
253
  readonly type: 1 | 3 | 4 | 5;
263
254
  readonly element: HTMLElement;
264
255
  readonly name: string;
@@ -269,56 +260,18 @@ declare class AttributePart {
269
260
  * this is undefined.
270
261
  */
271
262
  readonly strings?: ReadonlyArray<string>;
272
- /** @internal */
273
- _$committedValue: unknown | Array<unknown>;
274
- /** @internal */
275
- __directives?: Array<Directive | undefined>;
276
- /** @internal */
277
- _$parent: Disconnectable | undefined;
278
- /** @internal */
279
- _$disconnetableChildren?: Set<Disconnectable>;
280
263
  protected _sanitizer: ValueSanitizer | undefined;
281
- /** @internal */
282
- _setDirectiveConnected?: (directive: Directive | undefined, isConnected: boolean, removeFromParent?: boolean) => void;
283
264
  get tagName(): string;
284
- constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable | undefined, options: RenderOptions | undefined);
285
- /**
286
- * Sets the value of this part by resolving the value from possibly multiple
287
- * values and static strings and committing it to the DOM.
288
- * If this part is single-valued, `this._strings` will be undefined, and the
289
- * method will be called with a single value argument. If this part is
290
- * multi-value, `this._strings` will be defined, and the method is called
291
- * with the value array of the part's owning TemplateInstance, and an offset
292
- * into the value array from which the values should be read.
293
- * This method is overloaded this way to eliminate short-lived array slices
294
- * of the template instance values, and allow a fast-path for single-valued
295
- * parts.
296
- *
297
- * @param value The part value, or an array of values for multi-valued parts
298
- * @param valueIndex the index to start reading values from. `undefined` for
299
- * single-valued parts
300
- * @param noCommit causes the part to not commit its value to the DOM. Used
301
- * in hydration to prime attribute parts with their first-rendered value,
302
- * but not set the attribute, and in SSR to no-op the DOM operation and
303
- * capture the value for serialization.
304
- *
305
- * @internal
306
- */
307
- _$setValue(value: unknown | Array<unknown>, directiveParent?: DirectiveParent, valueIndex?: number, noCommit?: boolean): void;
308
- /** @internal */
309
- _commitValue(value: unknown): void;
265
+ get _$isConnected(): boolean;
266
+ constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined);
310
267
  }
311
268
  export type { PropertyPart };
312
269
  declare class PropertyPart extends AttributePart {
313
270
  readonly type = 3;
314
- /** @internal */
315
- _commitValue(value: unknown): void;
316
271
  }
317
272
  export type { BooleanAttributePart };
318
273
  declare class BooleanAttributePart extends AttributePart {
319
274
  readonly type = 4;
320
- /** @internal */
321
- _commitValue(value: unknown): void;
322
275
  }
323
276
  /**
324
277
  * An AttributePart that manages an event listener via add/removeEventListener.
@@ -334,25 +287,17 @@ declare class BooleanAttributePart extends AttributePart {
334
287
  export type { EventPart };
335
288
  declare class EventPart extends AttributePart {
336
289
  readonly type = 5;
337
- /** @internal */
338
- _$setValue(newListener: unknown, directiveParent?: DirectiveParent): void;
290
+ constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined);
339
291
  handleEvent(event: Event): void;
340
292
  }
341
293
  export type { ElementPart };
342
- declare class ElementPart {
294
+ declare class ElementPart implements Disconnectable {
343
295
  element: Element;
344
296
  readonly type = 6;
345
- /** @internal */
346
- __directive?: Directive;
347
297
  _$committedValue: undefined;
348
- /** @internal */
349
- _$parent: Disconnectable | undefined;
350
- /** @internal */
351
- _$disconnetableChildren?: Set<Disconnectable>;
352
- /** @internal */
353
- _setDirectiveConnected?: (directive: Directive | undefined, isConnected: boolean, removeFromParent?: boolean) => void;
354
298
  options: RenderOptions | undefined;
355
299
  constructor(element: Element, parent: Disconnectable, options: RenderOptions | undefined);
300
+ get _$isConnected(): boolean;
356
301
  _$setValue(value: unknown): void;
357
302
  }
358
303
  /**
@@ -363,7 +308,7 @@ declare class ElementPart {
363
308
  *
364
309
  * We currently do not make a mangled rollup build of the lit-ssr code. In order
365
310
  * to keep a number of (otherwise private) top-level exports mangled in the
366
- * client side code, we export a _Σ object containing those members (or
311
+ * client side code, we export a _$LH object containing those members (or
367
312
  * helper methods for accessing private fields of those members), and then
368
313
  * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
369
314
  * client-side code is being used in `dev` mode or `prod` mode.
@@ -373,7 +318,7 @@ declare class ElementPart {
373
318
  *
374
319
  * @private
375
320
  */
376
- export declare const _Σ: {
321
+ export declare const _$LH: {
377
322
  _boundAttributeSuffix: string;
378
323
  _marker: string;
379
324
  _markerMatch: string;
@@ -1 +1 @@
1
- {"version":3,"file":"lit-html.d.ts","sourceRoot":"","sources":["../src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O,EAAE,aAAa,GAAG,SAAS;IAOpC,IAAI,aAAa,YAEhB;IAED,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAGjC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,IAAI;;;;;gCAruCN,oBAAoB,QACvB,UAAU,KACf,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;;yBAtVhB,OAAO;;;;;;;;CA2kDjC,CAAC"}
@@ -3,5 +3,5 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- var t,i,s,e;const o=globalThis.trustedTypes,l=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,n=`lit$${(Math.random()+"").slice(9)}$`,h="?"+n,r=`<${h}>`,u=document,c=(t="")=>u.createComment(t),d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,v=Array.isArray,a=t=>{var i;return v(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,$=/'/g,g=/"/g,y=/^(?:script|style|textarea)$/i,b=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),T=b(1),x=b(2),w=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),P=new WeakMap,V=(t,i,s)=>{var e,o;const l=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let n=l._$litPart$;if(void 0===n){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;l._$litPart$=n=new C(i.insertBefore(c(),t),t,void 0,s)}return n.I(t),n},E=u.createTreeWalker(u,129,null,!1),M=(t,i)=>{const s=t.length-1,e=[];let o,h=2===i?"<svg>":"",u=f;for(let i=0;i<s;i++){const s=t[i];let l,c,d=-1,v=0;for(;v<s.length&&(u.lastIndex=v,c=u.exec(s),null!==c);)v=u.lastIndex,u===f?"!--"===c[1]?u=_:void 0!==c[1]?u=m:void 0!==c[2]?(y.test(c[2])&&(o=RegExp("</"+c[2],"g")),u=p):void 0!==c[3]&&(u=p):u===p?">"===c[0]?(u=null!=o?o:f,d=-1):void 0===c[1]?d=-2:(d=u.lastIndex-c[2].length,l=c[1],u=void 0===c[3]?p:'"'===c[3]?g:$):u===g||u===$?u=p:u===_||u===m?u=f:(u=p,o=void 0);const a=u===p&&t[i+1].startsWith("/>")?" ":"";h+=u===f?s+r:d>=0?(e.push(l),s.slice(0,d)+"$lit$"+s.slice(d)+n+a):s+n+(-2===d?(e.push(void 0),i):a)}const c=h+(t[s]||"<?>")+(2===i?"</svg>":"");return[void 0!==l?l.createHTML(c):c,e]};class N{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let l=0,r=0;const u=t.length-1,d=this.parts,[v,a]=M(t,i);if(this.el=N.createElement(v,s),E.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=E.nextNode())&&d.length<u;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(n)){const s=a[r++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+"$lit$").split(n),i=/([.?@])?(.*)/.exec(s);d.push({type:1,index:l,name:i[2],strings:t,ctor:"."===i[1]?I:"?"===i[1]?L:"@"===i[1]?R:H})}else d.push({type:6,index:l})}for(const i of t)e.removeAttribute(i)}if(y.test(e.tagName)){const t=e.textContent.split(n),i=t.length-1;if(i>0){e.textContent=o?o.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],c()),E.nextNode(),d.push({type:2,index:++l});e.append(t[i],c())}}}else if(8===e.nodeType)if(e.data===h)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=e.data.indexOf(n,t+1));)d.push({type:7,index:l}),t+=n.length-1}l++}}static createElement(t,i){const s=u.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){var o,l,n,h;if(i===w)return i;let r=void 0!==e?null===(o=s.Σi)||void 0===o?void 0:o[e]:s.Σo;const u=d(i)?void 0:i._$litDirective$;return(null==r?void 0:r.constructor)!==u&&(null===(l=null==r?void 0:r.O)||void 0===l||l.call(r,!1),void 0===u?r=void 0:(r=new u(t),r.T(t,s,e)),void 0!==e?(null!==(n=(h=s).Σi)&&void 0!==n?n:h.Σi=[])[e]=r:s.Σo=r),void 0!==r&&(i=S(t,r.S(t,i.values),r,e)),i}class k{constructor(t,i){this.l=[],this.N=void 0,this.D=t,this.M=i}u(t){var i;const{el:{content:s},parts:e}=this.D,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:u).importNode(s,!0);E.currentNode=o;let l=E.nextNode(),n=0,h=0,r=e[0];for(;void 0!==r;){if(n===r.index){let i;2===r.type?i=new C(l,l.nextSibling,this,t):1===r.type?i=new r.ctor(l,r.name,r.strings,this,t):6===r.type&&(i=new z(l,this,t)),this.l.push(i),r=e[++h]}n!==(null==r?void 0:r.index)&&(l=E.nextNode(),n++)}return o}v(t){let i=0;for(const s of this.l)void 0!==s&&(void 0!==s.strings?(s.I(t,s,i),i+=s.strings.length-2):s.I(t[i])),i++}}class C{constructor(t,i,s,e){this.type=2,this.N=void 0,this.A=t,this.B=i,this.M=s,this.options=e}setConnected(t){var i;null===(i=this.P)||void 0===i||i.call(this,t)}get parentNode(){return this.A.parentNode}get startNode(){return this.A}get endNode(){return this.B}I(t,i=this){t=S(this,t,i),d(t)?t===A||null==t||""===t?(this.H!==A&&this.R(),this.H=A):t!==this.H&&t!==w&&this.m(t):void 0!==t._$litType$?this._(t):void 0!==t.nodeType?this.$(t):a(t)?this.g(t):this.m(t)}k(t,i=this.B){return this.A.parentNode.insertBefore(t,i)}$(t){this.H!==t&&(this.R(),this.H=this.k(t))}m(t){const i=this.A.nextSibling;null!==i&&3===i.nodeType&&(null===this.B?null===i.nextSibling:i===this.B.previousSibling)?i.data=t:this.$(u.createTextNode(t)),this.H=t}_(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this.C(t):(void 0===e.el&&(e.el=N.createElement(e.h,this.options)),e);if((null===(i=this.H)||void 0===i?void 0:i.D)===o)this.H.v(s);else{const t=new k(o,this),i=t.u(this.options);t.v(s),this.$(i),this.H=t}}C(t){let i=P.get(t.strings);return void 0===i&&P.set(t.strings,i=new N(t)),i}g(t){v(this.H)||(this.H=[],this.R());const i=this.H;let s,e=0;for(const o of t)e===i.length?i.push(s=new C(this.k(c()),this.k(c()),this,this.options)):s=i[e],s.I(o),e++;e<i.length&&(this.R(s&&s.B.nextSibling,e),i.length=e)}R(t=this.A.nextSibling,i){var s;for(null===(s=this.P)||void 0===s||s.call(this,!1,!0,i);t&&t!==this.B;){const i=t.nextSibling;t.remove(),t=i}}}class H{constructor(t,i,s,e,o){this.type=1,this.H=A,this.N=void 0,this.V=void 0,this.element=t,this.name=i,this.M=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this.H=Array(s.length-1).fill(A),this.strings=s):this.H=A}get tagName(){return this.element.tagName}I(t,i=this,s,e){const o=this.strings;let l=!1;if(void 0===o)t=S(this,t,i,0),l=!d(t)||t!==this.H&&t!==w,l&&(this.H=t);else{const e=t;let n,h;for(t=o[0],n=0;n<o.length-1;n++)h=S(this,e[s+n],i,n),h===w&&(h=this.H[n]),l||(l=!d(h)||h!==this.H[n]),h===A?t=A:t!==A&&(t+=(null!=h?h:"")+o[n+1]),this.H[n]=h}l&&!e&&this.W(t)}W(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class I extends H{constructor(){super(...arguments),this.type=3}W(t){this.element[this.name]=t===A?void 0:t}}class L extends H{constructor(){super(...arguments),this.type=4}W(t){t&&t!==A?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class R extends H{constructor(){super(...arguments),this.type=5}I(t,i=this){var s;if((t=null!==(s=S(this,t,i,0))&&void 0!==s?s:A)===w)return;const e=this.H,o=t===A&&e!==A||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,l=t!==A&&(e===A||o);o&&this.element.removeEventListener(this.name,this,e),l&&this.element.addEventListener(this.name,this,t),this.H=t}handleEvent(t){var i,s;"function"==typeof this.H?this.H.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this.H.handleEvent(t)}}class z{constructor(t,i,s){this.element=t,this.type=6,this.N=void 0,this.V=void 0,this.M=i,this.options=s}I(t){S(this,t)}}const Z={Z:"$lit$",U:n,Y:h,q:1,X:M,tt:k,it:a,st:S,et:C,ot:H,nt:L,rt:R,lt:I,ht:z};null===(i=(t=globalThis).litHtmlPlatformSupport)||void 0===i||i.call(t,N,C),(null!==(s=(e=globalThis).litHtmlVersions)&&void 0!==s?s:e.litHtmlVersions=[]).push("2.0.0-rc.2");export{Z as _Σ,T as html,w as noChange,A as nothing,V as render,x as svg};
6
+ var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,$=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),p=$(1),y=$(2),b=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),x=new WeakMap,w=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,$=-1,p=0;for(;p<s.length&&(d.lastIndex=p,u=d.exec(s),null!==u);)p=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,$=-1):void 0===u[1]?$=-2:($=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:$>=0?(l.push(o),s.slice(0,$)+"$lit$"+s.slice($)+e+y):s+e+(-2===$?(l.push(void 0),i):y)}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");return[void 0!==s?s.createHTML(u):u,l]};class P{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=P.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?H:"@"===i[1]?I:S})}else c.push({type:6,index:r})}for(const i of t)l.removeAttribute(i)}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h())}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else{let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1}r++}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function V(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return(null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=V(t,d._$AS(t,i.values),d,e)),i}class E{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new L(n,this,t)),this.v.push(i),d=e[++r]}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=V(this,t,i),r(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u(t)?this.M(t):this.$(t)}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==T&&r(this._$AH)?this._$AA.nextSibling.data=t:this.S(l.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=P.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new E(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=x.get(t.strings);return void 0===i&&x.set(t.strings,i=new P(t)),i}M(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.A(h()),this.A(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=V(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=V(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===T?t=T:t!==T&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}n&&!e&&this.k(t)}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class M extends S{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===T?void 0:t}}const k=i?i.emptyScript:"";class H extends S{constructor(){super(...arguments),this.type=4}k(t){t&&t!==T?this.element.setAttribute(this.name,k):this.element.removeAttribute(this.name)}}class I extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=V(this,t,i,0))&&void 0!==s?s:T)===b)return;const e=this._$AH,o=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==T&&(e===T||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t)}}const R={P:"$lit$",V:e,L:o,I:1,N:C,R:E,D:u,j:V,H:N,O:S,F:H,B:I,W:M,Z:L},z=window.litHtmlPolyfillSupport;null==z||z(P,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.2");export{R as _$LH,p as html,b as noChange,T as nothing,w as render,y as svg};
7
7
  //# sourceMappingURL=lit-html.js.map