drugflow-molstar 0.3.77 → 0.4.1

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 (250) hide show
  1. package/build/drugflow-molstar-0.4.1.css +1 -0
  2. package/build/drugflow-molstar-component-0.4.1.js +25 -0
  3. package/build/drugflow-molstar-plugin-0.4.1.js +2 -0
  4. package/build/drugflow-molstar-plugin-0.4.1.js.LICENSE.txt +64 -0
  5. package/lib/alphafold-transparency.js +58 -125
  6. package/lib/contact.d.ts +15 -6
  7. package/lib/contact.js +71 -66
  8. package/lib/custom-events.js +16 -16
  9. package/lib/domain-annotations/behavior.js +20 -24
  10. package/lib/domain-annotations/color.d.ts +1 -1
  11. package/lib/domain-annotations/color.js +23 -22
  12. package/lib/domain-annotations/prop.d.ts +3 -3
  13. package/lib/domain-annotations/prop.js +54 -76
  14. package/lib/drugflow-molstar-component-build-0.3.78.js +2 -0
  15. package/lib/drugflow-molstar-component-build-0.4.1.js +2 -0
  16. package/lib/helpers.d.ts +4 -4
  17. package/lib/helpers.js +94 -99
  18. package/lib/index.js +1785 -2608
  19. package/lib/labels.d.ts +1 -1
  20. package/lib/labels.js +20 -23
  21. package/lib/loci-details.d.ts +2 -2
  22. package/lib/loci-details.js +26 -29
  23. package/lib/sifts-mapping.js +30 -34
  24. package/lib/sifts-mappings-behaviour.js +26 -30
  25. package/lib/spec.d.ts +1 -1
  26. package/lib/spec.js +50 -38
  27. package/lib/structure_contact3d.d.ts +13 -4
  28. package/lib/structure_contact3d.js +25 -46
  29. package/lib/subscribe-events.js +17 -17
  30. package/lib/superposition-export.js +100 -144
  31. package/lib/superposition-focus-representation.d.ts +1 -1
  32. package/lib/superposition-focus-representation.js +74 -112
  33. package/lib/superposition-sifts-mapping.d.ts +1 -1
  34. package/lib/superposition-sifts-mapping.js +56 -62
  35. package/lib/superposition.d.ts +2 -2
  36. package/lib/superposition.js +490 -726
  37. package/lib/ui/alphafold-superposition.d.ts +8 -9
  38. package/lib/ui/alphafold-superposition.js +96 -120
  39. package/lib/ui/alphafold-tranparency.d.ts +1 -2
  40. package/lib/ui/alphafold-tranparency.js +27 -43
  41. package/lib/ui/annotation-controls.d.ts +2 -3
  42. package/lib/ui/annotation-controls.js +81 -87
  43. package/lib/ui/export-superposition.js +33 -51
  44. package/lib/ui/pdbe-left-panel.d.ts +3 -3
  45. package/lib/ui/pdbe-left-panel.js +82 -106
  46. package/lib/ui/pdbe-screenshot-controls.d.ts +1 -1
  47. package/lib/ui/pdbe-screenshot-controls.js +54 -83
  48. package/lib/ui/pdbe-structure-controls.d.ts +4 -5
  49. package/lib/ui/pdbe-structure-controls.js +34 -57
  50. package/lib/ui/pdbe-viewport-controls.d.ts +1 -2
  51. package/lib/ui/pdbe-viewport-controls.js +23 -29
  52. package/lib/ui/segment-tree.d.ts +1 -2
  53. package/lib/ui/segment-tree.js +438 -590
  54. package/lib/ui/superposition-components.d.ts +1 -2
  55. package/lib/ui/superposition-components.js +196 -266
  56. package/lib/ui/superposition-viewport.d.ts +1 -2
  57. package/lib/ui/superposition-viewport.js +11 -18
  58. package/package.json +7 -4
  59. package/build/drugflow-molstar-0.3.62.css +0 -1
  60. package/build/drugflow-molstar-0.3.77.css +0 -1
  61. package/build/drugflow-molstar-component-0.3.62.js +0 -25
  62. package/build/drugflow-molstar-component-0.3.77.js +0 -25
  63. package/build/drugflow-molstar-light.css +0 -1
  64. package/build/drugflow-molstar-plugin-0.3.62.js +0 -2
  65. package/build/drugflow-molstar-plugin-0.3.62.js.LICENSE.txt +0 -39
  66. package/build/drugflow-molstar-plugin-0.3.77.js +0 -2
  67. package/build/drugflow-molstar-plugin-0.3.77.js.LICENSE.txt +0 -39
  68. package/lib/drugflow-molstar-component-build-0.1.2.js +0 -4268
  69. package/lib/drugflow-molstar-component-build-0.1.2.js.map +0 -1
  70. package/lib/drugflow-molstar-component-build-0.1.3.js +0 -2
  71. package/lib/drugflow-molstar-component-build-0.1.4.js +0 -2
  72. package/lib/drugflow-molstar-component-build-0.1.4.js.LICENSE.txt +0 -24
  73. package/lib/drugflow-molstar-component-build-0.1.5.js +0 -2
  74. package/lib/drugflow-molstar-component-build-0.1.5.js.LICENSE.txt +0 -24
  75. package/lib/drugflow-molstar-component-build-0.1.6.js +0 -2
  76. package/lib/drugflow-molstar-component-build-0.1.6.js.LICENSE.txt +0 -24
  77. package/lib/drugflow-molstar-component-build-0.2.10.js +0 -2
  78. package/lib/drugflow-molstar-component-build-0.2.10.js.LICENSE.txt +0 -24
  79. package/lib/drugflow-molstar-component-build-0.2.2.js +0 -2
  80. package/lib/drugflow-molstar-component-build-0.2.2.js.LICENSE.txt +0 -24
  81. package/lib/drugflow-molstar-component-build-0.2.3.js +0 -2
  82. package/lib/drugflow-molstar-component-build-0.2.3.js.LICENSE.txt +0 -24
  83. package/lib/drugflow-molstar-component-build-0.2.4.js +0 -2
  84. package/lib/drugflow-molstar-component-build-0.2.4.js.LICENSE.txt +0 -24
  85. package/lib/drugflow-molstar-component-build-0.2.5.js +0 -2
  86. package/lib/drugflow-molstar-component-build-0.2.5.js.LICENSE.txt +0 -24
  87. package/lib/drugflow-molstar-component-build-0.2.6.js +0 -2
  88. package/lib/drugflow-molstar-component-build-0.2.6.js.LICENSE.txt +0 -24
  89. package/lib/drugflow-molstar-component-build-0.2.7.js +0 -2
  90. package/lib/drugflow-molstar-component-build-0.2.7.js.LICENSE.txt +0 -24
  91. package/lib/drugflow-molstar-component-build-0.2.9.js +0 -2
  92. package/lib/drugflow-molstar-component-build-0.2.9.js.LICENSE.txt +0 -24
  93. package/lib/drugflow-molstar-component-build-0.3.1.js +0 -2
  94. package/lib/drugflow-molstar-component-build-0.3.1.js.LICENSE.txt +0 -24
  95. package/lib/drugflow-molstar-component-build-0.3.10.js +0 -2
  96. package/lib/drugflow-molstar-component-build-0.3.10.js.LICENSE.txt +0 -24
  97. package/lib/drugflow-molstar-component-build-0.3.11.js +0 -2
  98. package/lib/drugflow-molstar-component-build-0.3.11.js.LICENSE.txt +0 -24
  99. package/lib/drugflow-molstar-component-build-0.3.12.js +0 -2
  100. package/lib/drugflow-molstar-component-build-0.3.12.js.LICENSE.txt +0 -24
  101. package/lib/drugflow-molstar-component-build-0.3.13.js +0 -2
  102. package/lib/drugflow-molstar-component-build-0.3.13.js.LICENSE.txt +0 -24
  103. package/lib/drugflow-molstar-component-build-0.3.14.js +0 -2
  104. package/lib/drugflow-molstar-component-build-0.3.14.js.LICENSE.txt +0 -24
  105. package/lib/drugflow-molstar-component-build-0.3.15.js +0 -2
  106. package/lib/drugflow-molstar-component-build-0.3.15.js.LICENSE.txt +0 -24
  107. package/lib/drugflow-molstar-component-build-0.3.16.js +0 -2
  108. package/lib/drugflow-molstar-component-build-0.3.16.js.LICENSE.txt +0 -24
  109. package/lib/drugflow-molstar-component-build-0.3.17.js +0 -2
  110. package/lib/drugflow-molstar-component-build-0.3.17.js.LICENSE.txt +0 -24
  111. package/lib/drugflow-molstar-component-build-0.3.18.js +0 -2
  112. package/lib/drugflow-molstar-component-build-0.3.18.js.LICENSE.txt +0 -24
  113. package/lib/drugflow-molstar-component-build-0.3.19.js +0 -2
  114. package/lib/drugflow-molstar-component-build-0.3.19.js.LICENSE.txt +0 -24
  115. package/lib/drugflow-molstar-component-build-0.3.2.js +0 -2
  116. package/lib/drugflow-molstar-component-build-0.3.2.js.LICENSE.txt +0 -24
  117. package/lib/drugflow-molstar-component-build-0.3.20.js +0 -2
  118. package/lib/drugflow-molstar-component-build-0.3.20.js.LICENSE.txt +0 -24
  119. package/lib/drugflow-molstar-component-build-0.3.21.js +0 -2
  120. package/lib/drugflow-molstar-component-build-0.3.21.js.LICENSE.txt +0 -24
  121. package/lib/drugflow-molstar-component-build-0.3.22.js +0 -2
  122. package/lib/drugflow-molstar-component-build-0.3.22.js.LICENSE.txt +0 -24
  123. package/lib/drugflow-molstar-component-build-0.3.23.js +0 -2
  124. package/lib/drugflow-molstar-component-build-0.3.23.js.LICENSE.txt +0 -24
  125. package/lib/drugflow-molstar-component-build-0.3.24.js +0 -2
  126. package/lib/drugflow-molstar-component-build-0.3.24.js.LICENSE.txt +0 -24
  127. package/lib/drugflow-molstar-component-build-0.3.25.js +0 -2
  128. package/lib/drugflow-molstar-component-build-0.3.25.js.LICENSE.txt +0 -24
  129. package/lib/drugflow-molstar-component-build-0.3.26.js +0 -2
  130. package/lib/drugflow-molstar-component-build-0.3.26.js.LICENSE.txt +0 -24
  131. package/lib/drugflow-molstar-component-build-0.3.27.js +0 -2
  132. package/lib/drugflow-molstar-component-build-0.3.27.js.LICENSE.txt +0 -24
  133. package/lib/drugflow-molstar-component-build-0.3.28.js +0 -2
  134. package/lib/drugflow-molstar-component-build-0.3.28.js.LICENSE.txt +0 -24
  135. package/lib/drugflow-molstar-component-build-0.3.29.js +0 -2
  136. package/lib/drugflow-molstar-component-build-0.3.29.js.LICENSE.txt +0 -24
  137. package/lib/drugflow-molstar-component-build-0.3.3.js +0 -2
  138. package/lib/drugflow-molstar-component-build-0.3.3.js.LICENSE.txt +0 -24
  139. package/lib/drugflow-molstar-component-build-0.3.30.js +0 -2
  140. package/lib/drugflow-molstar-component-build-0.3.30.js.LICENSE.txt +0 -24
  141. package/lib/drugflow-molstar-component-build-0.3.31.js +0 -2
  142. package/lib/drugflow-molstar-component-build-0.3.31.js.LICENSE.txt +0 -24
  143. package/lib/drugflow-molstar-component-build-0.3.32.js +0 -2
  144. package/lib/drugflow-molstar-component-build-0.3.32.js.LICENSE.txt +0 -24
  145. package/lib/drugflow-molstar-component-build-0.3.33.js +0 -2
  146. package/lib/drugflow-molstar-component-build-0.3.33.js.LICENSE.txt +0 -24
  147. package/lib/drugflow-molstar-component-build-0.3.34.js +0 -2
  148. package/lib/drugflow-molstar-component-build-0.3.34.js.LICENSE.txt +0 -24
  149. package/lib/drugflow-molstar-component-build-0.3.35.js +0 -2
  150. package/lib/drugflow-molstar-component-build-0.3.35.js.LICENSE.txt +0 -24
  151. package/lib/drugflow-molstar-component-build-0.3.36.js +0 -2
  152. package/lib/drugflow-molstar-component-build-0.3.36.js.LICENSE.txt +0 -24
  153. package/lib/drugflow-molstar-component-build-0.3.37.js +0 -2
  154. package/lib/drugflow-molstar-component-build-0.3.37.js.LICENSE.txt +0 -24
  155. package/lib/drugflow-molstar-component-build-0.3.38.js +0 -2
  156. package/lib/drugflow-molstar-component-build-0.3.38.js.LICENSE.txt +0 -24
  157. package/lib/drugflow-molstar-component-build-0.3.39.js +0 -2
  158. package/lib/drugflow-molstar-component-build-0.3.39.js.LICENSE.txt +0 -24
  159. package/lib/drugflow-molstar-component-build-0.3.4.js +0 -2
  160. package/lib/drugflow-molstar-component-build-0.3.4.js.LICENSE.txt +0 -24
  161. package/lib/drugflow-molstar-component-build-0.3.40.js +0 -2
  162. package/lib/drugflow-molstar-component-build-0.3.40.js.LICENSE.txt +0 -24
  163. package/lib/drugflow-molstar-component-build-0.3.41.js +0 -2
  164. package/lib/drugflow-molstar-component-build-0.3.41.js.LICENSE.txt +0 -24
  165. package/lib/drugflow-molstar-component-build-0.3.42.js +0 -2
  166. package/lib/drugflow-molstar-component-build-0.3.42.js.LICENSE.txt +0 -24
  167. package/lib/drugflow-molstar-component-build-0.3.43.js +0 -2
  168. package/lib/drugflow-molstar-component-build-0.3.43.js.LICENSE.txt +0 -24
  169. package/lib/drugflow-molstar-component-build-0.3.44.js +0 -2
  170. package/lib/drugflow-molstar-component-build-0.3.44.js.LICENSE.txt +0 -24
  171. package/lib/drugflow-molstar-component-build-0.3.46.js +0 -2
  172. package/lib/drugflow-molstar-component-build-0.3.46.js.LICENSE.txt +0 -24
  173. package/lib/drugflow-molstar-component-build-0.3.47.js +0 -2
  174. package/lib/drugflow-molstar-component-build-0.3.47.js.LICENSE.txt +0 -24
  175. package/lib/drugflow-molstar-component-build-0.3.48.js +0 -2
  176. package/lib/drugflow-molstar-component-build-0.3.48.js.LICENSE.txt +0 -24
  177. package/lib/drugflow-molstar-component-build-0.3.49.js +0 -2
  178. package/lib/drugflow-molstar-component-build-0.3.49.js.LICENSE.txt +0 -24
  179. package/lib/drugflow-molstar-component-build-0.3.5.js +0 -2
  180. package/lib/drugflow-molstar-component-build-0.3.5.js.LICENSE.txt +0 -24
  181. package/lib/drugflow-molstar-component-build-0.3.50.js +0 -2
  182. package/lib/drugflow-molstar-component-build-0.3.50.js.LICENSE.txt +0 -24
  183. package/lib/drugflow-molstar-component-build-0.3.51.js +0 -2
  184. package/lib/drugflow-molstar-component-build-0.3.51.js.LICENSE.txt +0 -24
  185. package/lib/drugflow-molstar-component-build-0.3.52.js +0 -2
  186. package/lib/drugflow-molstar-component-build-0.3.52.js.LICENSE.txt +0 -24
  187. package/lib/drugflow-molstar-component-build-0.3.53.js +0 -2
  188. package/lib/drugflow-molstar-component-build-0.3.53.js.LICENSE.txt +0 -24
  189. package/lib/drugflow-molstar-component-build-0.3.54.js +0 -2
  190. package/lib/drugflow-molstar-component-build-0.3.54.js.LICENSE.txt +0 -24
  191. package/lib/drugflow-molstar-component-build-0.3.55.js +0 -2
  192. package/lib/drugflow-molstar-component-build-0.3.55.js.LICENSE.txt +0 -24
  193. package/lib/drugflow-molstar-component-build-0.3.56.js +0 -2
  194. package/lib/drugflow-molstar-component-build-0.3.56.js.LICENSE.txt +0 -24
  195. package/lib/drugflow-molstar-component-build-0.3.57.js +0 -2
  196. package/lib/drugflow-molstar-component-build-0.3.57.js.LICENSE.txt +0 -24
  197. package/lib/drugflow-molstar-component-build-0.3.58.js +0 -2
  198. package/lib/drugflow-molstar-component-build-0.3.58.js.LICENSE.txt +0 -24
  199. package/lib/drugflow-molstar-component-build-0.3.59.js +0 -2
  200. package/lib/drugflow-molstar-component-build-0.3.59.js.LICENSE.txt +0 -24
  201. package/lib/drugflow-molstar-component-build-0.3.6.js +0 -2
  202. package/lib/drugflow-molstar-component-build-0.3.6.js.LICENSE.txt +0 -24
  203. package/lib/drugflow-molstar-component-build-0.3.60.js +0 -2
  204. package/lib/drugflow-molstar-component-build-0.3.60.js.LICENSE.txt +0 -24
  205. package/lib/drugflow-molstar-component-build-0.3.61.js +0 -2
  206. package/lib/drugflow-molstar-component-build-0.3.61.js.LICENSE.txt +0 -24
  207. package/lib/drugflow-molstar-component-build-0.3.62.js +0 -2
  208. package/lib/drugflow-molstar-component-build-0.3.62.js.LICENSE.txt +0 -24
  209. package/lib/drugflow-molstar-component-build-0.3.63.js +0 -2
  210. package/lib/drugflow-molstar-component-build-0.3.63.js.LICENSE.txt +0 -24
  211. package/lib/drugflow-molstar-component-build-0.3.64.js +0 -2
  212. package/lib/drugflow-molstar-component-build-0.3.64.js.LICENSE.txt +0 -24
  213. package/lib/drugflow-molstar-component-build-0.3.65.js +0 -2
  214. package/lib/drugflow-molstar-component-build-0.3.65.js.LICENSE.txt +0 -24
  215. package/lib/drugflow-molstar-component-build-0.3.66.js +0 -2
  216. package/lib/drugflow-molstar-component-build-0.3.66.js.LICENSE.txt +0 -24
  217. package/lib/drugflow-molstar-component-build-0.3.67.js +0 -2
  218. package/lib/drugflow-molstar-component-build-0.3.67.js.LICENSE.txt +0 -24
  219. package/lib/drugflow-molstar-component-build-0.3.68.js +0 -2
  220. package/lib/drugflow-molstar-component-build-0.3.68.js.LICENSE.txt +0 -24
  221. package/lib/drugflow-molstar-component-build-0.3.69.js +0 -2
  222. package/lib/drugflow-molstar-component-build-0.3.69.js.LICENSE.txt +0 -24
  223. package/lib/drugflow-molstar-component-build-0.3.7.js +0 -2
  224. package/lib/drugflow-molstar-component-build-0.3.7.js.LICENSE.txt +0 -24
  225. package/lib/drugflow-molstar-component-build-0.3.70.js +0 -2
  226. package/lib/drugflow-molstar-component-build-0.3.70.js.LICENSE.txt +0 -24
  227. package/lib/drugflow-molstar-component-build-0.3.71.js +0 -2
  228. package/lib/drugflow-molstar-component-build-0.3.71.js.LICENSE.txt +0 -24
  229. package/lib/drugflow-molstar-component-build-0.3.72.js +0 -2
  230. package/lib/drugflow-molstar-component-build-0.3.72.js.LICENSE.txt +0 -24
  231. package/lib/drugflow-molstar-component-build-0.3.73.js +0 -2
  232. package/lib/drugflow-molstar-component-build-0.3.73.js.LICENSE.txt +0 -24
  233. package/lib/drugflow-molstar-component-build-0.3.74.js +0 -2
  234. package/lib/drugflow-molstar-component-build-0.3.74.js.LICENSE.txt +0 -24
  235. package/lib/drugflow-molstar-component-build-0.3.75.js +0 -2
  236. package/lib/drugflow-molstar-component-build-0.3.75.js.LICENSE.txt +0 -24
  237. package/lib/drugflow-molstar-component-build-0.3.76.js +0 -2
  238. package/lib/drugflow-molstar-component-build-0.3.76.js.LICENSE.txt +0 -24
  239. package/lib/drugflow-molstar-component-build-0.3.77.js +0 -2
  240. package/lib/drugflow-molstar-component-build-0.3.77.js.LICENSE.txt +0 -24
  241. package/lib/drugflow-molstar-component-build-0.3.8.js +0 -2
  242. package/lib/drugflow-molstar-component-build-0.3.8.js.LICENSE.txt +0 -24
  243. package/lib/drugflow-molstar-component-build-0.3.9.js +0 -2
  244. package/lib/drugflow-molstar-component-build-0.3.9.js.LICENSE.txt +0 -24
  245. package/lib/index2.d.ts +0 -1
  246. package/lib/index2.js +0 -1369
  247. package/lib/pdbe-molstar-component-build-3.1.2.js +0 -2
  248. package/lib/pdbe-molstar-component-build-3.1.2.js.LICENSE.txt +0 -24
  249. /package/lib/{drugflow-molstar-component-build-0.1.2.js.LICENSE.txt → drugflow-molstar-component-build-0.3.78.js.LICENSE.txt} +0 -0
  250. /package/lib/{drugflow-molstar-component-build-0.1.3.js.LICENSE.txt → drugflow-molstar-component-build-0.4.1.js.LICENSE.txt} +0 -0
@@ -1,4268 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ var __webpack_modules__ = ({
4
-
5
- /***/ "./node_modules/lit-element/lib/css-tag.js":
6
- /*!*************************************************!*\
7
- !*** ./node_modules/lit-element/lib/css-tag.js ***!
8
- \*************************************************/
9
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
10
-
11
- __webpack_require__.r(__webpack_exports__);
12
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
- /* harmony export */ "CSSResult": () => (/* binding */ CSSResult),
14
- /* harmony export */ "css": () => (/* binding */ css),
15
- /* harmony export */ "supportsAdoptingStyleSheets": () => (/* binding */ supportsAdoptingStyleSheets),
16
- /* harmony export */ "unsafeCSS": () => (/* binding */ unsafeCSS)
17
- /* harmony export */ });
18
- /**
19
- @license
20
- Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
21
- This code may only be used under the BSD style license found at
22
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
23
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
24
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
25
- part of the polymer project is also subject to an additional IP rights grant
26
- found at http://polymer.github.io/PATENTS.txt
27
- */
28
-
29
- /**
30
- * Whether the current browser supports `adoptedStyleSheets`.
31
- */
32
- const supportsAdoptingStyleSheets = window.ShadowRoot && (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
33
- const constructionToken = Symbol();
34
- class CSSResult {
35
- constructor(cssText, safeToken) {
36
- if (safeToken !== constructionToken) {
37
- throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
38
- }
39
-
40
- this.cssText = cssText;
41
- } // Note, this is a getter so that it's lazy. In practice, this means
42
- // stylesheets are not created until the first element instance is made.
43
-
44
-
45
- get styleSheet() {
46
- if (this._styleSheet === undefined) {
47
- // Note, if `supportsAdoptingStyleSheets` is true then we assume
48
- // CSSStyleSheet is constructable.
49
- if (supportsAdoptingStyleSheets) {
50
- this._styleSheet = new CSSStyleSheet();
51
-
52
- this._styleSheet.replaceSync(this.cssText);
53
- } else {
54
- this._styleSheet = null;
55
- }
56
- }
57
-
58
- return this._styleSheet;
59
- }
60
-
61
- toString() {
62
- return this.cssText;
63
- }
64
-
65
- }
66
- /**
67
- * Wrap a value for interpolation in a [[`css`]] tagged template literal.
68
- *
69
- * This is unsafe because untrusted CSS text can be used to phone home
70
- * or exfiltrate data to an attacker controlled site. Take care to only use
71
- * this with trusted input.
72
- */
73
-
74
- const unsafeCSS = value => {
75
- return new CSSResult(String(value), constructionToken);
76
- };
77
-
78
- const textFromCSSResult = value => {
79
- if (value instanceof CSSResult) {
80
- return value.cssText;
81
- } else if (typeof value === 'number') {
82
- return value;
83
- } else {
84
- throw new Error(`Value passed to 'css' function must be a 'css' function result: ${value}. Use 'unsafeCSS' to pass non-literal values, but
85
- take care to ensure page security.`);
86
- }
87
- };
88
- /**
89
- * Template tag which which can be used with LitElement's [[LitElement.styles |
90
- * `styles`]] property to set element styles. For security reasons, only literal
91
- * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]
92
- * may be used inside a template string part.
93
- */
94
-
95
-
96
- const css = (strings, ...values) => {
97
- const cssText = values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
98
- return new CSSResult(cssText, constructionToken);
99
- };
100
-
101
- /***/ }),
102
-
103
- /***/ "./node_modules/lit-element/lib/decorators.js":
104
- /*!****************************************************!*\
105
- !*** ./node_modules/lit-element/lib/decorators.js ***!
106
- \****************************************************/
107
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
108
-
109
- __webpack_require__.r(__webpack_exports__);
110
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
111
- /* harmony export */ "customElement": () => (/* binding */ customElement),
112
- /* harmony export */ "eventOptions": () => (/* binding */ eventOptions),
113
- /* harmony export */ "internalProperty": () => (/* binding */ internalProperty),
114
- /* harmony export */ "property": () => (/* binding */ property),
115
- /* harmony export */ "query": () => (/* binding */ query),
116
- /* harmony export */ "queryAll": () => (/* binding */ queryAll),
117
- /* harmony export */ "queryAssignedNodes": () => (/* binding */ queryAssignedNodes),
118
- /* harmony export */ "queryAsync": () => (/* binding */ queryAsync),
119
- /* harmony export */ "state": () => (/* binding */ state)
120
- /* harmony export */ });
121
- /**
122
- * @license
123
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
124
- * This code may only be used under the BSD style license found at
125
- * http://polymer.github.io/LICENSE.txt
126
- * The complete set of authors may be found at
127
- * http://polymer.github.io/AUTHORS.txt
128
- * The complete set of contributors may be found at
129
- * http://polymer.github.io/CONTRIBUTORS.txt
130
- * Code distributed by Google as part of the polymer project is also
131
- * subject to an additional IP rights grant found at
132
- * http://polymer.github.io/PATENTS.txt
133
- */
134
- const legacyCustomElement = (tagName, clazz) => {
135
- window.customElements.define(tagName, clazz); // Cast as any because TS doesn't recognize the return type as being a
136
- // subtype of the decorated class when clazz is typed as
137
- // `Constructor<HTMLElement>` for some reason.
138
- // `Constructor<HTMLElement>` is helpful to make sure the decorator is
139
- // applied to elements however.
140
- // tslint:disable-next-line:no-any
141
-
142
- return clazz;
143
- };
144
-
145
- const standardCustomElement = (tagName, descriptor) => {
146
- const {
147
- kind,
148
- elements
149
- } = descriptor;
150
- return {
151
- kind,
152
- elements,
153
-
154
- // This callback is called once the class is otherwise fully defined
155
- finisher(clazz) {
156
- window.customElements.define(tagName, clazz);
157
- }
158
-
159
- };
160
- };
161
- /**
162
- * Class decorator factory that defines the decorated class as a custom element.
163
- *
164
- * ```
165
- * @customElement('my-element')
166
- * class MyElement {
167
- * render() {
168
- * return html``;
169
- * }
170
- * }
171
- * ```
172
- * @category Decorator
173
- * @param tagName The name of the custom element to define.
174
- */
175
-
176
-
177
- const customElement = tagName => classOrDescriptor => typeof classOrDescriptor === 'function' ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
178
-
179
- const standardProperty = (options, element) => {
180
- // When decorating an accessor, pass it through and add property metadata.
181
- // Note, the `hasOwnProperty` check in `createProperty` ensures we don't
182
- // stomp over the user's accessor.
183
- if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) {
184
- return Object.assign(Object.assign({}, element), {
185
- finisher(clazz) {
186
- clazz.createProperty(element.key, options);
187
- }
188
-
189
- });
190
- } else {
191
- // createProperty() takes care of defining the property, but we still
192
- // must return some kind of descriptor, so return a descriptor for an
193
- // unused prototype field. The finisher calls createProperty().
194
- return {
195
- kind: 'field',
196
- key: Symbol(),
197
- placement: 'own',
198
- descriptor: {},
199
-
200
- // When @babel/plugin-proposal-decorators implements initializers,
201
- // do this instead of the initializer below. See:
202
- // https://github.com/babel/babel/issues/9260 extras: [
203
- // {
204
- // kind: 'initializer',
205
- // placement: 'own',
206
- // initializer: descriptor.initializer,
207
- // }
208
- // ],
209
- initializer() {
210
- if (typeof element.initializer === 'function') {
211
- this[element.key] = element.initializer.call(this);
212
- }
213
- },
214
-
215
- finisher(clazz) {
216
- clazz.createProperty(element.key, options);
217
- }
218
-
219
- };
220
- }
221
- };
222
-
223
- const legacyProperty = (options, proto, name) => {
224
- proto.constructor.createProperty(name, options);
225
- };
226
- /**
227
- * A property decorator which creates a LitElement property which reflects a
228
- * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be
229
- * supplied to configure property features.
230
- *
231
- * This decorator should only be used for public fields. Private or protected
232
- * fields should use the [[`internalProperty`]] decorator.
233
- *
234
- * @example
235
- * ```ts
236
- * class MyElement {
237
- * @property({ type: Boolean })
238
- * clicked = false;
239
- * }
240
- * ```
241
- * @category Decorator
242
- * @ExportDecoratedItems
243
- */
244
-
245
-
246
- function property(options) {
247
- // tslint:disable-next-line:no-any decorator
248
- return (protoOrDescriptor, name) => name !== undefined ? legacyProperty(options, protoOrDescriptor, name) : standardProperty(options, protoOrDescriptor);
249
- }
250
- /**
251
- * Declares a private or protected property that still triggers updates to the
252
- * element when it changes.
253
- *
254
- * Properties declared this way must not be used from HTML or HTML templating
255
- * systems, they're solely for properties internal to the element. These
256
- * properties may be renamed by optimization tools like the Closure Compiler.
257
- * @category Decorator
258
- * @deprecated `internalProperty` has been renamed to `state` in lit-element
259
- * 3.0. Please update to `state` now to be compatible with 3.0.
260
- */
261
-
262
- function internalProperty(options) {
263
- return property({
264
- attribute: false,
265
- hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged
266
- });
267
- }
268
- /**
269
- * Declares a private or protected property that still triggers updates to the
270
- * element when it changes.
271
- *
272
- * Properties declared this way must not be used from HTML or HTML templating
273
- * systems, they're solely for properties internal to the element. These
274
- * properties may be renamed by optimization tools like the Closure Compiler.
275
- * @category Decorator
276
- */
277
-
278
- const state = options => internalProperty(options);
279
- /**
280
- * A property decorator that converts a class property into a getter that
281
- * executes a querySelector on the element's renderRoot.
282
- *
283
- * @param selector A DOMString containing one or more selectors to match.
284
- * @param cache An optional boolean which when true performs the DOM query only
285
- * once and caches the result.
286
- *
287
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
288
- *
289
- * @example
290
- *
291
- * ```ts
292
- * class MyElement {
293
- * @query('#first')
294
- * first;
295
- *
296
- * render() {
297
- * return html`
298
- * <div id="first"></div>
299
- * <div id="second"></div>
300
- * `;
301
- * }
302
- * }
303
- * ```
304
- * @category Decorator
305
- */
306
-
307
- function query(selector, cache) {
308
- return (protoOrDescriptor, // tslint:disable-next-line:no-any decorator
309
- name) => {
310
- const descriptor = {
311
- get() {
312
- return this.renderRoot.querySelector(selector);
313
- },
314
-
315
- enumerable: true,
316
- configurable: true
317
- };
318
-
319
- if (cache) {
320
- const prop = name !== undefined ? name : protoOrDescriptor.key;
321
- const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;
322
-
323
- descriptor.get = function () {
324
- if (this[key] === undefined) {
325
- this[key] = this.renderRoot.querySelector(selector);
326
- }
327
-
328
- return this[key];
329
- };
330
- }
331
-
332
- return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
333
- };
334
- } // Note, in the future, we may extend this decorator to support the use case
335
- // where the queried element may need to do work to become ready to interact
336
- // with (e.g. load some implementation code). If so, we might elect to
337
- // add a second argument defining a function that can be run to make the
338
- // queried element loaded/updated/ready.
339
-
340
- /**
341
- * A property decorator that converts a class property into a getter that
342
- * returns a promise that resolves to the result of a querySelector on the
343
- * element's renderRoot done after the element's `updateComplete` promise
344
- * resolves. When the queried property may change with element state, this
345
- * decorator can be used instead of requiring users to await the
346
- * `updateComplete` before accessing the property.
347
- *
348
- * @param selector A DOMString containing one or more selectors to match.
349
- *
350
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
351
- *
352
- * @example
353
- * ```ts
354
- * class MyElement {
355
- * @queryAsync('#first')
356
- * first;
357
- *
358
- * render() {
359
- * return html`
360
- * <div id="first"></div>
361
- * <div id="second"></div>
362
- * `;
363
- * }
364
- * }
365
- *
366
- * // external usage
367
- * async doSomethingWithFirst() {
368
- * (await aMyElement.first).doSomething();
369
- * }
370
- * ```
371
- * @category Decorator
372
- */
373
-
374
- function queryAsync(selector) {
375
- return (protoOrDescriptor, // tslint:disable-next-line:no-any decorator
376
- name) => {
377
- const descriptor = {
378
- async get() {
379
- await this.updateComplete;
380
- return this.renderRoot.querySelector(selector);
381
- },
382
-
383
- enumerable: true,
384
- configurable: true
385
- };
386
- return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
387
- };
388
- }
389
- /**
390
- * A property decorator that converts a class property into a getter
391
- * that executes a querySelectorAll on the element's renderRoot.
392
- *
393
- * @param selector A DOMString containing one or more selectors to match.
394
- *
395
- * See:
396
- * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
397
- *
398
- * @example
399
- * ```ts
400
- * class MyElement {
401
- * @queryAll('div')
402
- * divs;
403
- *
404
- * render() {
405
- * return html`
406
- * <div id="first"></div>
407
- * <div id="second"></div>
408
- * `;
409
- * }
410
- * }
411
- * ```
412
- * @category Decorator
413
- */
414
-
415
- function queryAll(selector) {
416
- return (protoOrDescriptor, // tslint:disable-next-line:no-any decorator
417
- name) => {
418
- const descriptor = {
419
- get() {
420
- return this.renderRoot.querySelectorAll(selector);
421
- },
422
-
423
- enumerable: true,
424
- configurable: true
425
- };
426
- return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
427
- };
428
- }
429
-
430
- const legacyQuery = (descriptor, proto, name) => {
431
- Object.defineProperty(proto, name, descriptor);
432
- };
433
-
434
- const standardQuery = (descriptor, element) => ({
435
- kind: 'method',
436
- placement: 'prototype',
437
- key: element.key,
438
- descriptor
439
- });
440
-
441
- const standardEventOptions = (options, element) => {
442
- return Object.assign(Object.assign({}, element), {
443
- finisher(clazz) {
444
- Object.assign(clazz.prototype[element.key], options);
445
- }
446
-
447
- });
448
- };
449
-
450
- const legacyEventOptions = // tslint:disable-next-line:no-any legacy decorator
451
- (options, proto, name) => {
452
- Object.assign(proto[name], options);
453
- };
454
- /**
455
- * Adds event listener options to a method used as an event listener in a
456
- * lit-html template.
457
- *
458
- * @param options An object that specifies event listener options as accepted by
459
- * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
460
- *
461
- * Current browsers support the `capture`, `passive`, and `once` options. See:
462
- * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
463
- *
464
- * @example
465
- * ```ts
466
- * class MyElement {
467
- * clicked = false;
468
- *
469
- * render() {
470
- * return html`
471
- * <div @click=${this._onClick}`>
472
- * <button></button>
473
- * </div>
474
- * `;
475
- * }
476
- *
477
- * @eventOptions({capture: true})
478
- * _onClick(e) {
479
- * this.clicked = true;
480
- * }
481
- * }
482
- * ```
483
- * @category Decorator
484
- */
485
-
486
-
487
- function eventOptions(options) {
488
- // Return value typed as any to prevent TypeScript from complaining that
489
- // standard decorator function signature does not match TypeScript decorator
490
- // signature
491
- // TODO(kschaaf): unclear why it was only failing on this decorator and not
492
- // the others
493
- return (protoOrDescriptor, name) => name !== undefined ? legacyEventOptions(options, protoOrDescriptor, name) : standardEventOptions(options, protoOrDescriptor);
494
- } // x-browser support for matches
495
- // tslint:disable-next-line:no-any
496
-
497
- const ElementProto = Element.prototype;
498
- const legacyMatches = ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;
499
- /**
500
- * A property decorator that converts a class property into a getter that
501
- * returns the `assignedNodes` of the given named `slot`. Note, the type of
502
- * this property should be annotated as `NodeListOf<HTMLElement>`.
503
- *
504
- * @param slotName A string name of the slot.
505
- * @param flatten A boolean which when true flattens the assigned nodes,
506
- * meaning any assigned nodes that are slot elements are replaced with their
507
- * assigned nodes.
508
- * @param selector A string which filters the results to elements that match
509
- * the given css selector.
510
- *
511
- * * @example
512
- * ```ts
513
- * class MyElement {
514
- * @queryAssignedNodes('list', true, '.item')
515
- * listItems;
516
- *
517
- * render() {
518
- * return html`
519
- * <slot name="list"></slot>
520
- * `;
521
- * }
522
- * }
523
- * ```
524
- * @category Decorator
525
- */
526
-
527
- function queryAssignedNodes(slotName = '', flatten = false, selector = '') {
528
- return (protoOrDescriptor, // tslint:disable-next-line:no-any decorator
529
- name) => {
530
- const descriptor = {
531
- get() {
532
- const slotSelector = `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;
533
- const slot = this.renderRoot.querySelector(slotSelector);
534
- let nodes = slot && slot.assignedNodes({
535
- flatten
536
- });
537
-
538
- if (nodes && selector) {
539
- nodes = nodes.filter(node => node.nodeType === Node.ELEMENT_NODE && ( // tslint:disable-next-line:no-any testing existence on older browsers
540
- node.matches ? node.matches(selector) : legacyMatches.call(node, selector)));
541
- }
542
-
543
- return nodes;
544
- },
545
-
546
- enumerable: true,
547
- configurable: true
548
- };
549
- return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
550
- };
551
- }
552
-
553
- /***/ }),
554
-
555
- /***/ "./node_modules/lit-element/lib/updating-element.js":
556
- /*!**********************************************************!*\
557
- !*** ./node_modules/lit-element/lib/updating-element.js ***!
558
- \**********************************************************/
559
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
560
-
561
- __webpack_require__.r(__webpack_exports__);
562
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
563
- /* harmony export */ "UpdatingElement": () => (/* binding */ UpdatingElement),
564
- /* harmony export */ "defaultConverter": () => (/* binding */ defaultConverter),
565
- /* harmony export */ "notEqual": () => (/* binding */ notEqual)
566
- /* harmony export */ });
567
- /**
568
- * @license
569
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
570
- * This code may only be used under the BSD style license found at
571
- * http://polymer.github.io/LICENSE.txt
572
- * The complete set of authors may be found at
573
- * http://polymer.github.io/AUTHORS.txt
574
- * The complete set of contributors may be found at
575
- * http://polymer.github.io/CONTRIBUTORS.txt
576
- * Code distributed by Google as part of the polymer project is also
577
- * subject to an additional IP rights grant found at
578
- * http://polymer.github.io/PATENTS.txt
579
- */
580
- var _a;
581
- /**
582
- * Use this module if you want to create your own base class extending
583
- * [[UpdatingElement]].
584
- * @packageDocumentation
585
- */
586
-
587
- /*
588
- * When using Closure Compiler, JSCompiler_renameProperty(property, object) is
589
- * replaced at compile time by the munged name for object[property]. We cannot
590
- * alias this function, so we have to use a small shim that has the same
591
- * behavior when not compiling.
592
- */
593
-
594
-
595
- window.JSCompiler_renameProperty = (prop, _obj) => prop;
596
-
597
- const defaultConverter = {
598
- toAttribute(value, type) {
599
- switch (type) {
600
- case Boolean:
601
- return value ? '' : null;
602
-
603
- case Object:
604
- case Array:
605
- // if the value is `null` or `undefined` pass this through
606
- // to allow removing/no change behavior.
607
- return value == null ? value : JSON.stringify(value);
608
- }
609
-
610
- return value;
611
- },
612
-
613
- fromAttribute(value, type) {
614
- switch (type) {
615
- case Boolean:
616
- return value !== null;
617
-
618
- case Number:
619
- return value === null ? null : Number(value);
620
-
621
- case Object:
622
- case Array:
623
- // Type assert to adhere to Bazel's "must type assert JSON parse" rule.
624
- return JSON.parse(value);
625
- }
626
-
627
- return value;
628
- }
629
-
630
- };
631
- /**
632
- * Change function that returns true if `value` is different from `oldValue`.
633
- * This method is used as the default for a property's `hasChanged` function.
634
- */
635
-
636
- const notEqual = (value, old) => {
637
- // This ensures (old==NaN, value==NaN) always returns false
638
- return old !== value && (old === old || value === value);
639
- };
640
- const defaultPropertyDeclaration = {
641
- attribute: true,
642
- type: String,
643
- converter: defaultConverter,
644
- reflect: false,
645
- hasChanged: notEqual
646
- };
647
- const STATE_HAS_UPDATED = 1;
648
- const STATE_UPDATE_REQUESTED = 1 << 2;
649
- const STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;
650
- const STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;
651
- /**
652
- * The Closure JS Compiler doesn't currently have good support for static
653
- * property semantics where "this" is dynamic (e.g.
654
- * https://github.com/google/closure-compiler/issues/3177 and others) so we use
655
- * this hack to bypass any rewriting by the compiler.
656
- */
657
-
658
- const finalized = 'finalized';
659
- /**
660
- * Base element class which manages element properties and attributes. When
661
- * properties change, the `update` method is asynchronously called. This method
662
- * should be supplied by subclassers to render updates as desired.
663
- * @noInheritDoc
664
- */
665
-
666
- class UpdatingElement extends HTMLElement {
667
- constructor() {
668
- super();
669
- this.initialize();
670
- }
671
- /**
672
- * Returns a list of attributes corresponding to the registered properties.
673
- * @nocollapse
674
- */
675
-
676
-
677
- static get observedAttributes() {
678
- // note: piggy backing on this to ensure we're finalized.
679
- this.finalize();
680
- const attributes = []; // Use forEach so this works even if for/of loops are compiled to for loops
681
- // expecting arrays
682
-
683
- this._classProperties.forEach((v, p) => {
684
- const attr = this._attributeNameForProperty(p, v);
685
-
686
- if (attr !== undefined) {
687
- this._attributeToPropertyMap.set(attr, p);
688
-
689
- attributes.push(attr);
690
- }
691
- });
692
-
693
- return attributes;
694
- }
695
- /**
696
- * Ensures the private `_classProperties` property metadata is created.
697
- * In addition to `finalize` this is also called in `createProperty` to
698
- * ensure the `@property` decorator can add property metadata.
699
- */
700
-
701
- /** @nocollapse */
702
-
703
-
704
- static _ensureClassProperties() {
705
- // ensure private storage for property declarations.
706
- if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) {
707
- this._classProperties = new Map(); // NOTE: Workaround IE11 not supporting Map constructor argument.
708
-
709
- const superProperties = Object.getPrototypeOf(this)._classProperties;
710
-
711
- if (superProperties !== undefined) {
712
- superProperties.forEach((v, k) => this._classProperties.set(k, v));
713
- }
714
- }
715
- }
716
- /**
717
- * Creates a property accessor on the element prototype if one does not exist
718
- * and stores a PropertyDeclaration for the property with the given options.
719
- * The property setter calls the property's `hasChanged` property option
720
- * or uses a strict identity check to determine whether or not to request
721
- * an update.
722
- *
723
- * This method may be overridden to customize properties; however,
724
- * when doing so, it's important to call `super.createProperty` to ensure
725
- * the property is setup correctly. This method calls
726
- * `getPropertyDescriptor` internally to get a descriptor to install.
727
- * To customize what properties do when they are get or set, override
728
- * `getPropertyDescriptor`. To customize the options for a property,
729
- * implement `createProperty` like this:
730
- *
731
- * static createProperty(name, options) {
732
- * options = Object.assign(options, {myOption: true});
733
- * super.createProperty(name, options);
734
- * }
735
- *
736
- * @nocollapse
737
- */
738
-
739
-
740
- static createProperty(name, options = defaultPropertyDeclaration) {
741
- // Note, since this can be called by the `@property` decorator which
742
- // is called before `finalize`, we ensure storage exists for property
743
- // metadata.
744
- this._ensureClassProperties();
745
-
746
- this._classProperties.set(name, options); // Do not generate an accessor if the prototype already has one, since
747
- // it would be lost otherwise and that would never be the user's intention;
748
- // Instead, we expect users to call `requestUpdate` themselves from
749
- // user-defined accessors. Note that if the super has an accessor we will
750
- // still overwrite it
751
-
752
-
753
- if (options.noAccessor || this.prototype.hasOwnProperty(name)) {
754
- return;
755
- }
756
-
757
- const key = typeof name === 'symbol' ? Symbol() : `__${name}`;
758
- const descriptor = this.getPropertyDescriptor(name, key, options);
759
-
760
- if (descriptor !== undefined) {
761
- Object.defineProperty(this.prototype, name, descriptor);
762
- }
763
- }
764
- /**
765
- * Returns a property descriptor to be defined on the given named property.
766
- * If no descriptor is returned, the property will not become an accessor.
767
- * For example,
768
- *
769
- * class MyElement extends LitElement {
770
- * static getPropertyDescriptor(name, key, options) {
771
- * const defaultDescriptor =
772
- * super.getPropertyDescriptor(name, key, options);
773
- * const setter = defaultDescriptor.set;
774
- * return {
775
- * get: defaultDescriptor.get,
776
- * set(value) {
777
- * setter.call(this, value);
778
- * // custom action.
779
- * },
780
- * configurable: true,
781
- * enumerable: true
782
- * }
783
- * }
784
- * }
785
- *
786
- * @nocollapse
787
- */
788
-
789
-
790
- static getPropertyDescriptor(name, key, options) {
791
- return {
792
- // tslint:disable-next-line:no-any no symbol in index
793
- get() {
794
- return this[key];
795
- },
796
-
797
- set(value) {
798
- const oldValue = this[name];
799
- this[key] = value;
800
- this.requestUpdateInternal(name, oldValue, options);
801
- },
802
-
803
- configurable: true,
804
- enumerable: true
805
- };
806
- }
807
- /**
808
- * Returns the property options associated with the given property.
809
- * These options are defined with a PropertyDeclaration via the `properties`
810
- * object or the `@property` decorator and are registered in
811
- * `createProperty(...)`.
812
- *
813
- * Note, this method should be considered "final" and not overridden. To
814
- * customize the options for a given property, override `createProperty`.
815
- *
816
- * @nocollapse
817
- * @final
818
- */
819
-
820
-
821
- static getPropertyOptions(name) {
822
- return this._classProperties && this._classProperties.get(name) || defaultPropertyDeclaration;
823
- }
824
- /**
825
- * Creates property accessors for registered properties and ensures
826
- * any superclasses are also finalized.
827
- * @nocollapse
828
- */
829
-
830
-
831
- static finalize() {
832
- // finalize any superclasses
833
- const superCtor = Object.getPrototypeOf(this);
834
-
835
- if (!superCtor.hasOwnProperty(finalized)) {
836
- superCtor.finalize();
837
- }
838
-
839
- this[finalized] = true;
840
-
841
- this._ensureClassProperties(); // initialize Map populated in observedAttributes
842
-
843
-
844
- this._attributeToPropertyMap = new Map(); // make any properties
845
- // Note, only process "own" properties since this element will inherit
846
- // any properties defined on the superClass, and finalization ensures
847
- // the entire prototype chain is finalized.
848
-
849
- if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {
850
- const props = this.properties; // support symbols in properties (IE11 does not support this)
851
-
852
- const propKeys = [...Object.getOwnPropertyNames(props), ...(typeof Object.getOwnPropertySymbols === 'function' ? Object.getOwnPropertySymbols(props) : [])]; // This for/of is ok because propKeys is an array
853
-
854
- for (const p of propKeys) {
855
- // note, use of `any` is due to TypeSript lack of support for symbol in
856
- // index types
857
- // tslint:disable-next-line:no-any no symbol in index
858
- this.createProperty(p, props[p]);
859
- }
860
- }
861
- }
862
- /**
863
- * Returns the property name for the given attribute `name`.
864
- * @nocollapse
865
- */
866
-
867
-
868
- static _attributeNameForProperty(name, options) {
869
- const attribute = options.attribute;
870
- return attribute === false ? undefined : typeof attribute === 'string' ? attribute : typeof name === 'string' ? name.toLowerCase() : undefined;
871
- }
872
- /**
873
- * Returns true if a property should request an update.
874
- * Called when a property value is set and uses the `hasChanged`
875
- * option for the property if present or a strict identity check.
876
- * @nocollapse
877
- */
878
-
879
-
880
- static _valueHasChanged(value, old, hasChanged = notEqual) {
881
- return hasChanged(value, old);
882
- }
883
- /**
884
- * Returns the property value for the given attribute value.
885
- * Called via the `attributeChangedCallback` and uses the property's
886
- * `converter` or `converter.fromAttribute` property option.
887
- * @nocollapse
888
- */
889
-
890
-
891
- static _propertyValueFromAttribute(value, options) {
892
- const type = options.type;
893
- const converter = options.converter || defaultConverter;
894
- const fromAttribute = typeof converter === 'function' ? converter : converter.fromAttribute;
895
- return fromAttribute ? fromAttribute(value, type) : value;
896
- }
897
- /**
898
- * Returns the attribute value for the given property value. If this
899
- * returns undefined, the property will *not* be reflected to an attribute.
900
- * If this returns null, the attribute will be removed, otherwise the
901
- * attribute will be set to the value.
902
- * This uses the property's `reflect` and `type.toAttribute` property options.
903
- * @nocollapse
904
- */
905
-
906
-
907
- static _propertyValueToAttribute(value, options) {
908
- if (options.reflect === undefined) {
909
- return;
910
- }
911
-
912
- const type = options.type;
913
- const converter = options.converter;
914
- const toAttribute = converter && converter.toAttribute || defaultConverter.toAttribute;
915
- return toAttribute(value, type);
916
- }
917
- /**
918
- * Performs element initialization. By default captures any pre-set values for
919
- * registered properties.
920
- */
921
-
922
-
923
- initialize() {
924
- this._updateState = 0;
925
- this._updatePromise = new Promise(res => this._enableUpdatingResolver = res);
926
- this._changedProperties = new Map();
927
-
928
- this._saveInstanceProperties(); // ensures first update will be caught by an early access of
929
- // `updateComplete`
930
-
931
-
932
- this.requestUpdateInternal();
933
- }
934
- /**
935
- * Fixes any properties set on the instance before upgrade time.
936
- * Otherwise these would shadow the accessor and break these properties.
937
- * The properties are stored in a Map which is played back after the
938
- * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
939
- * (<=41), properties created for native platform properties like (`id` or
940
- * `name`) may not have default values set in the element constructor. On
941
- * these browsers native properties appear on instances and therefore their
942
- * default value will overwrite any element default (e.g. if the element sets
943
- * this.id = 'id' in the constructor, the 'id' will become '' since this is
944
- * the native platform default).
945
- */
946
-
947
-
948
- _saveInstanceProperties() {
949
- // Use forEach so this works even if for/of loops are compiled to for loops
950
- // expecting arrays
951
- this.constructor._classProperties.forEach((_v, p) => {
952
- if (this.hasOwnProperty(p)) {
953
- const value = this[p];
954
- delete this[p];
955
-
956
- if (!this._instanceProperties) {
957
- this._instanceProperties = new Map();
958
- }
959
-
960
- this._instanceProperties.set(p, value);
961
- }
962
- });
963
- }
964
- /**
965
- * Applies previously saved instance properties.
966
- */
967
-
968
-
969
- _applyInstanceProperties() {
970
- // Use forEach so this works even if for/of loops are compiled to for loops
971
- // expecting arrays
972
- // tslint:disable-next-line:no-any
973
- this._instanceProperties.forEach((v, p) => this[p] = v);
974
-
975
- this._instanceProperties = undefined;
976
- }
977
-
978
- connectedCallback() {
979
- // Ensure first connection completes an update. Updates cannot complete
980
- // before connection.
981
- this.enableUpdating();
982
- }
983
-
984
- enableUpdating() {
985
- if (this._enableUpdatingResolver !== undefined) {
986
- this._enableUpdatingResolver();
987
-
988
- this._enableUpdatingResolver = undefined;
989
- }
990
- }
991
- /**
992
- * Allows for `super.disconnectedCallback()` in extensions while
993
- * reserving the possibility of making non-breaking feature additions
994
- * when disconnecting at some point in the future.
995
- */
996
-
997
-
998
- disconnectedCallback() {}
999
- /**
1000
- * Synchronizes property values when attributes change.
1001
- */
1002
-
1003
-
1004
- attributeChangedCallback(name, old, value) {
1005
- if (old !== value) {
1006
- this._attributeToProperty(name, value);
1007
- }
1008
- }
1009
-
1010
- _propertyToAttribute(name, value, options = defaultPropertyDeclaration) {
1011
- const ctor = this.constructor;
1012
-
1013
- const attr = ctor._attributeNameForProperty(name, options);
1014
-
1015
- if (attr !== undefined) {
1016
- const attrValue = ctor._propertyValueToAttribute(value, options); // an undefined value does not change the attribute.
1017
-
1018
-
1019
- if (attrValue === undefined) {
1020
- return;
1021
- } // Track if the property is being reflected to avoid
1022
- // setting the property again via `attributeChangedCallback`. Note:
1023
- // 1. this takes advantage of the fact that the callback is synchronous.
1024
- // 2. will behave incorrectly if multiple attributes are in the reaction
1025
- // stack at time of calling. However, since we process attributes
1026
- // in `update` this should not be possible (or an extreme corner case
1027
- // that we'd like to discover).
1028
- // mark state reflecting
1029
-
1030
-
1031
- this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;
1032
-
1033
- if (attrValue == null) {
1034
- this.removeAttribute(attr);
1035
- } else {
1036
- this.setAttribute(attr, attrValue);
1037
- } // mark state not reflecting
1038
-
1039
-
1040
- this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;
1041
- }
1042
- }
1043
-
1044
- _attributeToProperty(name, value) {
1045
- // Use tracking info to avoid deserializing attribute value if it was
1046
- // just set from a property setter.
1047
- if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {
1048
- return;
1049
- }
1050
-
1051
- const ctor = this.constructor; // Note, hint this as an `AttributeMap` so closure clearly understands
1052
- // the type; it has issues with tracking types through statics
1053
- // tslint:disable-next-line:no-unnecessary-type-assertion
1054
-
1055
- const propName = ctor._attributeToPropertyMap.get(name);
1056
-
1057
- if (propName !== undefined) {
1058
- const options = ctor.getPropertyOptions(propName); // mark state reflecting
1059
-
1060
- this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;
1061
- this[propName] = // tslint:disable-next-line:no-any
1062
- ctor._propertyValueFromAttribute(value, options); // mark state not reflecting
1063
-
1064
- this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;
1065
- }
1066
- }
1067
- /**
1068
- * This protected version of `requestUpdate` does not access or return the
1069
- * `updateComplete` promise. This promise can be overridden and is therefore
1070
- * not free to access.
1071
- */
1072
-
1073
-
1074
- requestUpdateInternal(name, oldValue, options) {
1075
- let shouldRequestUpdate = true; // If we have a property key, perform property update steps.
1076
-
1077
- if (name !== undefined) {
1078
- const ctor = this.constructor;
1079
- options = options || ctor.getPropertyOptions(name);
1080
-
1081
- if (ctor._valueHasChanged(this[name], oldValue, options.hasChanged)) {
1082
- if (!this._changedProperties.has(name)) {
1083
- this._changedProperties.set(name, oldValue);
1084
- } // Add to reflecting properties set.
1085
- // Note, it's important that every change has a chance to add the
1086
- // property to `_reflectingProperties`. This ensures setting
1087
- // attribute + property reflects correctly.
1088
-
1089
-
1090
- if (options.reflect === true && !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {
1091
- if (this._reflectingProperties === undefined) {
1092
- this._reflectingProperties = new Map();
1093
- }
1094
-
1095
- this._reflectingProperties.set(name, options);
1096
- }
1097
- } else {
1098
- // Abort the request if the property should not be considered changed.
1099
- shouldRequestUpdate = false;
1100
- }
1101
- }
1102
-
1103
- if (!this._hasRequestedUpdate && shouldRequestUpdate) {
1104
- this._updatePromise = this._enqueueUpdate();
1105
- }
1106
- }
1107
- /**
1108
- * Requests an update which is processed asynchronously. This should
1109
- * be called when an element should update based on some state not triggered
1110
- * by setting a property. In this case, pass no arguments. It should also be
1111
- * called when manually implementing a property setter. In this case, pass the
1112
- * property `name` and `oldValue` to ensure that any configured property
1113
- * options are honored. Returns the `updateComplete` Promise which is resolved
1114
- * when the update completes.
1115
- *
1116
- * @param name {PropertyKey} (optional) name of requesting property
1117
- * @param oldValue {any} (optional) old value of requesting property
1118
- * @returns {Promise} A Promise that is resolved when the update completes.
1119
- */
1120
-
1121
-
1122
- requestUpdate(name, oldValue) {
1123
- this.requestUpdateInternal(name, oldValue);
1124
- return this.updateComplete;
1125
- }
1126
- /**
1127
- * Sets up the element to asynchronously update.
1128
- */
1129
-
1130
-
1131
- async _enqueueUpdate() {
1132
- this._updateState = this._updateState | STATE_UPDATE_REQUESTED;
1133
-
1134
- try {
1135
- // Ensure any previous update has resolved before updating.
1136
- // This `await` also ensures that property changes are batched.
1137
- await this._updatePromise;
1138
- } catch (e) {// Ignore any previous errors. We only care that the previous cycle is
1139
- // done. Any error should have been handled in the previous update.
1140
- }
1141
-
1142
- const result = this.performUpdate(); // If `performUpdate` returns a Promise, we await it. This is done to
1143
- // enable coordinating updates with a scheduler. Note, the result is
1144
- // checked to avoid delaying an additional microtask unless we need to.
1145
-
1146
- if (result != null) {
1147
- await result;
1148
- }
1149
-
1150
- return !this._hasRequestedUpdate;
1151
- }
1152
-
1153
- get _hasRequestedUpdate() {
1154
- return this._updateState & STATE_UPDATE_REQUESTED;
1155
- }
1156
-
1157
- get hasUpdated() {
1158
- return this._updateState & STATE_HAS_UPDATED;
1159
- }
1160
- /**
1161
- * Performs an element update. Note, if an exception is thrown during the
1162
- * update, `firstUpdated` and `updated` will not be called.
1163
- *
1164
- * You can override this method to change the timing of updates. If this
1165
- * method is overridden, `super.performUpdate()` must be called.
1166
- *
1167
- * For instance, to schedule updates to occur just before the next frame:
1168
- *
1169
- * ```
1170
- * protected async performUpdate(): Promise<unknown> {
1171
- * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
1172
- * super.performUpdate();
1173
- * }
1174
- * ```
1175
- */
1176
-
1177
-
1178
- performUpdate() {
1179
- // Abort any update if one is not pending when this is called.
1180
- // This can happen if `performUpdate` is called early to "flush"
1181
- // the update.
1182
- if (!this._hasRequestedUpdate) {
1183
- return;
1184
- } // Mixin instance properties once, if they exist.
1185
-
1186
-
1187
- if (this._instanceProperties) {
1188
- this._applyInstanceProperties();
1189
- }
1190
-
1191
- let shouldUpdate = false;
1192
- const changedProperties = this._changedProperties;
1193
-
1194
- try {
1195
- shouldUpdate = this.shouldUpdate(changedProperties);
1196
-
1197
- if (shouldUpdate) {
1198
- this.update(changedProperties);
1199
- } else {
1200
- this._markUpdated();
1201
- }
1202
- } catch (e) {
1203
- // Prevent `firstUpdated` and `updated` from running when there's an
1204
- // update exception.
1205
- shouldUpdate = false; // Ensure element can accept additional updates after an exception.
1206
-
1207
- this._markUpdated();
1208
-
1209
- throw e;
1210
- }
1211
-
1212
- if (shouldUpdate) {
1213
- if (!(this._updateState & STATE_HAS_UPDATED)) {
1214
- this._updateState = this._updateState | STATE_HAS_UPDATED;
1215
- this.firstUpdated(changedProperties);
1216
- }
1217
-
1218
- this.updated(changedProperties);
1219
- }
1220
- }
1221
-
1222
- _markUpdated() {
1223
- this._changedProperties = new Map();
1224
- this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;
1225
- }
1226
- /**
1227
- * Returns a Promise that resolves when the element has completed updating.
1228
- * The Promise value is a boolean that is `true` if the element completed the
1229
- * update without triggering another update. The Promise result is `false` if
1230
- * a property was set inside `updated()`. If the Promise is rejected, an
1231
- * exception was thrown during the update.
1232
- *
1233
- * To await additional asynchronous work, override the `_getUpdateComplete`
1234
- * method. For example, it is sometimes useful to await a rendered element
1235
- * before fulfilling this Promise. To do this, first await
1236
- * `super._getUpdateComplete()`, then any subsequent state.
1237
- *
1238
- * @returns {Promise} The Promise returns a boolean that indicates if the
1239
- * update resolved without triggering another update.
1240
- */
1241
-
1242
-
1243
- get updateComplete() {
1244
- return this._getUpdateComplete();
1245
- }
1246
- /**
1247
- * Override point for the `updateComplete` promise.
1248
- *
1249
- * It is not safe to override the `updateComplete` getter directly due to a
1250
- * limitation in TypeScript which means it is not possible to call a
1251
- * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
1252
- * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
1253
- * This method should be overridden instead. For example:
1254
- *
1255
- * class MyElement extends LitElement {
1256
- * async _getUpdateComplete() {
1257
- * await super._getUpdateComplete();
1258
- * await this._myChild.updateComplete;
1259
- * }
1260
- * }
1261
- * @deprecated Override `getUpdateComplete()` instead for forward
1262
- * compatibility with `lit-element` 3.0 / `@lit/reactive-element`.
1263
- */
1264
-
1265
-
1266
- _getUpdateComplete() {
1267
- return this.getUpdateComplete();
1268
- }
1269
- /**
1270
- * Override point for the `updateComplete` promise.
1271
- *
1272
- * It is not safe to override the `updateComplete` getter directly due to a
1273
- * limitation in TypeScript which means it is not possible to call a
1274
- * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
1275
- * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
1276
- * This method should be overridden instead. For example:
1277
- *
1278
- * class MyElement extends LitElement {
1279
- * async getUpdateComplete() {
1280
- * await super.getUpdateComplete();
1281
- * await this._myChild.updateComplete;
1282
- * }
1283
- * }
1284
- */
1285
-
1286
-
1287
- getUpdateComplete() {
1288
- return this._updatePromise;
1289
- }
1290
- /**
1291
- * Controls whether or not `update` should be called when the element requests
1292
- * an update. By default, this method always returns `true`, but this can be
1293
- * customized to control when to update.
1294
- *
1295
- * @param _changedProperties Map of changed properties with old values
1296
- */
1297
-
1298
-
1299
- shouldUpdate(_changedProperties) {
1300
- return true;
1301
- }
1302
- /**
1303
- * Updates the element. This method reflects property values to attributes.
1304
- * It can be overridden to render and keep updated element DOM.
1305
- * Setting properties inside this method will *not* trigger
1306
- * another update.
1307
- *
1308
- * @param _changedProperties Map of changed properties with old values
1309
- */
1310
-
1311
-
1312
- update(_changedProperties) {
1313
- if (this._reflectingProperties !== undefined && this._reflectingProperties.size > 0) {
1314
- // Use forEach so this works even if for/of loops are compiled to for
1315
- // loops expecting arrays
1316
- this._reflectingProperties.forEach((v, k) => this._propertyToAttribute(k, this[k], v));
1317
-
1318
- this._reflectingProperties = undefined;
1319
- }
1320
-
1321
- this._markUpdated();
1322
- }
1323
- /**
1324
- * Invoked whenever the element is updated. Implement to perform
1325
- * post-updating tasks via DOM APIs, for example, focusing an element.
1326
- *
1327
- * Setting properties inside this method will trigger the element to update
1328
- * again after this update cycle completes.
1329
- *
1330
- * @param _changedProperties Map of changed properties with old values
1331
- */
1332
-
1333
-
1334
- updated(_changedProperties) {}
1335
- /**
1336
- * Invoked when the element is first updated. Implement to perform one time
1337
- * work on the element after update.
1338
- *
1339
- * Setting properties inside this method will trigger the element to update
1340
- * again after this update cycle completes.
1341
- *
1342
- * @param _changedProperties Map of changed properties with old values
1343
- */
1344
-
1345
-
1346
- firstUpdated(_changedProperties) {}
1347
-
1348
- }
1349
- _a = finalized;
1350
- /**
1351
- * Marks class as having finished creating properties.
1352
- */
1353
-
1354
- UpdatingElement[_a] = true;
1355
-
1356
- /***/ }),
1357
-
1358
- /***/ "./node_modules/lit-element/lit-element.js":
1359
- /*!*************************************************!*\
1360
- !*** ./node_modules/lit-element/lit-element.js ***!
1361
- \*************************************************/
1362
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1363
-
1364
- __webpack_require__.r(__webpack_exports__);
1365
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1366
- /* harmony export */ "CSSResult": () => (/* reexport safe */ _lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.CSSResult),
1367
- /* harmony export */ "LitElement": () => (/* binding */ LitElement),
1368
- /* harmony export */ "ReactiveElement": () => (/* reexport safe */ _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__.UpdatingElement),
1369
- /* harmony export */ "SVGTemplateResult": () => (/* reexport safe */ lit_html_lit_html_js__WEBPACK_IMPORTED_MODULE_3__.SVGTemplateResult),
1370
- /* harmony export */ "TemplateResult": () => (/* reexport safe */ lit_html_lit_html_js__WEBPACK_IMPORTED_MODULE_3__.TemplateResult),
1371
- /* harmony export */ "UpdatingElement": () => (/* reexport safe */ _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__.UpdatingElement),
1372
- /* harmony export */ "css": () => (/* reexport safe */ _lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.css),
1373
- /* harmony export */ "customElement": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.customElement),
1374
- /* harmony export */ "defaultConverter": () => (/* reexport safe */ _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__.defaultConverter),
1375
- /* harmony export */ "eventOptions": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.eventOptions),
1376
- /* harmony export */ "html": () => (/* reexport safe */ lit_html_lit_html_js__WEBPACK_IMPORTED_MODULE_3__.html),
1377
- /* harmony export */ "internalProperty": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.internalProperty),
1378
- /* harmony export */ "notEqual": () => (/* reexport safe */ _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__.notEqual),
1379
- /* harmony export */ "property": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.property),
1380
- /* harmony export */ "query": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.query),
1381
- /* harmony export */ "queryAll": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.queryAll),
1382
- /* harmony export */ "queryAssignedNodes": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.queryAssignedNodes),
1383
- /* harmony export */ "queryAsync": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.queryAsync),
1384
- /* harmony export */ "state": () => (/* reexport safe */ _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__.state),
1385
- /* harmony export */ "supportsAdoptingStyleSheets": () => (/* reexport safe */ _lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.supportsAdoptingStyleSheets),
1386
- /* harmony export */ "svg": () => (/* reexport safe */ lit_html_lit_html_js__WEBPACK_IMPORTED_MODULE_3__.svg),
1387
- /* harmony export */ "unsafeCSS": () => (/* reexport safe */ _lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.unsafeCSS)
1388
- /* harmony export */ });
1389
- /* harmony import */ var lit_html_lib_shady_render_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit-html/lib/shady-render.js */ "./node_modules/lit-html/lib/shady-render.js");
1390
- /* harmony import */ var _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/updating-element.js */ "./node_modules/lit-element/lib/updating-element.js");
1391
- /* harmony import */ var _lib_decorators_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/decorators.js */ "./node_modules/lit-element/lib/decorators.js");
1392
- /* harmony import */ var lit_html_lit_html_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lit-html/lit-html.js */ "./node_modules/lit-html/lit-html.js");
1393
- /* harmony import */ var _lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/css-tag.js */ "./node_modules/lit-element/lib/css-tag.js");
1394
- /**
1395
- * @license
1396
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1397
- * This code may only be used under the BSD style license found at
1398
- * http://polymer.github.io/LICENSE.txt
1399
- * The complete set of authors may be found at
1400
- * http://polymer.github.io/AUTHORS.txt
1401
- * The complete set of contributors may be found at
1402
- * http://polymer.github.io/CONTRIBUTORS.txt
1403
- * Code distributed by Google as part of the polymer project is also
1404
- * subject to an additional IP rights grant found at
1405
- * http://polymer.github.io/PATENTS.txt
1406
- */
1407
-
1408
- /**
1409
- * The main LitElement module, which defines the [[`LitElement`]] base class and
1410
- * related APIs.
1411
- *
1412
- * LitElement components can define a template and a set of observed
1413
- * properties. Changing an observed property triggers a re-render of the
1414
- * element.
1415
- *
1416
- * Import [[`LitElement`]] and [[`html`]] from this module to create a
1417
- * component:
1418
- *
1419
- * ```js
1420
- * import {LitElement, html} from 'lit-element';
1421
- *
1422
- * class MyElement extends LitElement {
1423
- *
1424
- * // Declare observed properties
1425
- * static get properties() {
1426
- * return {
1427
- * adjective: {}
1428
- * }
1429
- * }
1430
- *
1431
- * constructor() {
1432
- * this.adjective = 'awesome';
1433
- * }
1434
- *
1435
- * // Define the element's template
1436
- * render() {
1437
- * return html`<p>your ${adjective} template here</p>`;
1438
- * }
1439
- * }
1440
- *
1441
- * customElements.define('my-element', MyElement);
1442
- * ```
1443
- *
1444
- * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.
1445
- * The `UpdatingElement` class is provided for users that want to build
1446
- * their own custom element base classes that don't use lit-html.
1447
- *
1448
- * @packageDocumentation
1449
- */
1450
-
1451
-
1452
-
1453
-
1454
-
1455
-
1456
-
1457
- // IMPORTANT: do not change the property name or the assignment expression.
1458
- // This line will be used in regexes to search for LitElement usage.
1459
- // TODO(justinfagnani): inject version number at build time
1460
-
1461
- (window['litElementVersions'] || (window['litElementVersions'] = [])).push('2.5.1');
1462
- /**
1463
- * Sentinal value used to avoid calling lit-html's render function when
1464
- * subclasses do not implement `render`
1465
- */
1466
-
1467
- const renderNotImplemented = {};
1468
- /**
1469
- * Base element class that manages element properties and attributes, and
1470
- * renders a lit-html template.
1471
- *
1472
- * To define a component, subclass `LitElement` and implement a
1473
- * `render` method to provide the component's template. Define properties
1474
- * using the [[`properties`]] property or the [[`property`]] decorator.
1475
- */
1476
-
1477
- class LitElement extends _lib_updating_element_js__WEBPACK_IMPORTED_MODULE_1__.UpdatingElement {
1478
- /**
1479
- * Return the array of styles to apply to the element.
1480
- * Override this method to integrate into a style management system.
1481
- *
1482
- * @nocollapse
1483
- */
1484
- static getStyles() {
1485
- return this.styles;
1486
- }
1487
- /** @nocollapse */
1488
-
1489
-
1490
- static _getUniqueStyles() {
1491
- // Only gather styles once per class
1492
- if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {
1493
- return;
1494
- } // Take care not to call `this.getStyles()` multiple times since this
1495
- // generates new CSSResults each time.
1496
- // TODO(sorvell): Since we do not cache CSSResults by input, any
1497
- // shared styles will generate new stylesheet objects, which is wasteful.
1498
- // This should be addressed when a browser ships constructable
1499
- // stylesheets.
1500
-
1501
-
1502
- const userStyles = this.getStyles();
1503
-
1504
- if (Array.isArray(userStyles)) {
1505
- // De-duplicate styles preserving the _last_ instance in the set.
1506
- // This is a performance optimization to avoid duplicated styles that can
1507
- // occur especially when composing via subclassing.
1508
- // The last item is kept to try to preserve the cascade order with the
1509
- // assumption that it's most important that last added styles override
1510
- // previous styles.
1511
- const addStyles = (styles, set) => styles.reduceRight((set, s) => // Note: On IE set.add() does not return the set
1512
- Array.isArray(s) ? addStyles(s, set) : (set.add(s), set), set); // Array.from does not work on Set in IE, otherwise return
1513
- // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()
1514
-
1515
-
1516
- const set = addStyles(userStyles, new Set());
1517
- const styles = [];
1518
- set.forEach(v => styles.unshift(v));
1519
- this._styles = styles;
1520
- } else {
1521
- this._styles = userStyles === undefined ? [] : [userStyles];
1522
- } // Ensure that there are no invalid CSSStyleSheet instances here. They are
1523
- // invalid in two conditions.
1524
- // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but
1525
- // this is impossible to check except via .replaceSync or use
1526
- // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is
1527
- // false)
1528
-
1529
-
1530
- this._styles = this._styles.map(s => {
1531
- if (s instanceof CSSStyleSheet && !_lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.supportsAdoptingStyleSheets) {
1532
- // Flatten the cssText from the passed constructible stylesheet (or
1533
- // undetectable non-constructible stylesheet). The user might have
1534
- // expected to update their stylesheets over time, but the alternative
1535
- // is a crash.
1536
- const cssText = Array.prototype.slice.call(s.cssRules).reduce((css, rule) => css + rule.cssText, '');
1537
- return (0,_lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.unsafeCSS)(cssText);
1538
- }
1539
-
1540
- return s;
1541
- });
1542
- }
1543
- /**
1544
- * Performs element initialization. By default this calls
1545
- * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and
1546
- * captures any pre-set values for registered properties.
1547
- */
1548
-
1549
-
1550
- initialize() {
1551
- super.initialize();
1552
-
1553
- this.constructor._getUniqueStyles();
1554
-
1555
- this.renderRoot = this.createRenderRoot(); // Note, if renderRoot is not a shadowRoot, styles would/could apply to the
1556
- // element's getRootNode(). While this could be done, we're choosing not to
1557
- // support this now since it would require different logic around de-duping.
1558
-
1559
- if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {
1560
- this.adoptStyles();
1561
- }
1562
- }
1563
- /**
1564
- * Returns the node into which the element should render and by default
1565
- * creates and returns an open shadowRoot. Implement to customize where the
1566
- * element's DOM is rendered. For example, to render into the element's
1567
- * childNodes, return `this`.
1568
- * @returns {Element|DocumentFragment} Returns a node into which to render.
1569
- */
1570
-
1571
-
1572
- createRenderRoot() {
1573
- return this.attachShadow(this.constructor.shadowRootOptions);
1574
- }
1575
- /**
1576
- * Applies styling to the element shadowRoot using the [[`styles`]]
1577
- * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where
1578
- * available and will fallback otherwise. When Shadow DOM is polyfilled,
1579
- * ShadyCSS scopes styles and adds them to the document. When Shadow DOM
1580
- * is available but `adoptedStyleSheets` is not, styles are appended to the
1581
- * end of the `shadowRoot` to [mimic spec
1582
- * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
1583
- */
1584
-
1585
-
1586
- adoptStyles() {
1587
- const styles = this.constructor._styles;
1588
-
1589
- if (styles.length === 0) {
1590
- return;
1591
- } // There are three separate cases here based on Shadow DOM support.
1592
- // (1) shadowRoot polyfilled: use ShadyCSS
1593
- // (2) shadowRoot.adoptedStyleSheets available: use it
1594
- // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after
1595
- // rendering
1596
-
1597
-
1598
- if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {
1599
- window.ShadyCSS.ScopingShim.prepareAdoptedCssText(styles.map(s => s.cssText), this.localName);
1600
- } else if (_lib_css_tag_js__WEBPACK_IMPORTED_MODULE_4__.supportsAdoptingStyleSheets) {
1601
- this.renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
1602
- } else {
1603
- // This must be done after rendering so the actual style insertion is done
1604
- // in `update`.
1605
- this._needsShimAdoptedStyleSheets = true;
1606
- }
1607
- }
1608
-
1609
- connectedCallback() {
1610
- super.connectedCallback(); // Note, first update/render handles styleElement so we only call this if
1611
- // connected after first update.
1612
-
1613
- if (this.hasUpdated && window.ShadyCSS !== undefined) {
1614
- window.ShadyCSS.styleElement(this);
1615
- }
1616
- }
1617
- /**
1618
- * Updates the element. This method reflects property values to attributes
1619
- * and calls `render` to render DOM via lit-html. Setting properties inside
1620
- * this method will *not* trigger another update.
1621
- * @param _changedProperties Map of changed properties with old values
1622
- */
1623
-
1624
-
1625
- update(changedProperties) {
1626
- // Setting properties in `render` should not trigger an update. Since
1627
- // updates are allowed after super.update, it's important to call `render`
1628
- // before that.
1629
- const templateResult = this.render();
1630
- super.update(changedProperties); // If render is not implemented by the component, don't call lit-html render
1631
-
1632
- if (templateResult !== renderNotImplemented) {
1633
- this.constructor.render(templateResult, this.renderRoot, {
1634
- scopeName: this.localName,
1635
- eventContext: this
1636
- });
1637
- } // When native Shadow DOM is used but adoptedStyles are not supported,
1638
- // insert styling after rendering to ensure adoptedStyles have highest
1639
- // priority.
1640
-
1641
-
1642
- if (this._needsShimAdoptedStyleSheets) {
1643
- this._needsShimAdoptedStyleSheets = false;
1644
-
1645
- this.constructor._styles.forEach(s => {
1646
- const style = document.createElement('style');
1647
- style.textContent = s.cssText;
1648
- this.renderRoot.appendChild(style);
1649
- });
1650
- }
1651
- }
1652
- /**
1653
- * Invoked on each update to perform rendering tasks. This method may return
1654
- * any value renderable by lit-html's `NodePart` - typically a
1655
- * `TemplateResult`. Setting properties inside this method will *not* trigger
1656
- * the element to update.
1657
- */
1658
-
1659
-
1660
- render() {
1661
- return renderNotImplemented;
1662
- }
1663
-
1664
- }
1665
- /**
1666
- * Ensure this class is marked as `finalized` as an optimization ensuring
1667
- * it will not needlessly try to `finalize`.
1668
- *
1669
- * Note this property name is a string to prevent breaking Closure JS Compiler
1670
- * optimizations. See updating-element.ts for more information.
1671
- */
1672
-
1673
- LitElement['finalized'] = true;
1674
- /**
1675
- * Reference to the underlying library method used to render the element's
1676
- * DOM. By default, points to the `render` method from lit-html's shady-render
1677
- * module.
1678
- *
1679
- * **Most users will never need to touch this property.**
1680
- *
1681
- * This property should not be confused with the `render` instance method,
1682
- * which should be overridden to define a template for the element.
1683
- *
1684
- * Advanced users creating a new base class based on LitElement can override
1685
- * this property to point to a custom render method with a signature that
1686
- * matches [shady-render's `render`
1687
- * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).
1688
- *
1689
- * @nocollapse
1690
- */
1691
-
1692
- LitElement.render = lit_html_lib_shady_render_js__WEBPACK_IMPORTED_MODULE_0__.render;
1693
- /** @nocollapse */
1694
-
1695
- LitElement.shadowRootOptions = {
1696
- mode: 'open'
1697
- };
1698
-
1699
- /***/ }),
1700
-
1701
- /***/ "./node_modules/lit-html/lib/default-template-processor.js":
1702
- /*!*****************************************************************!*\
1703
- !*** ./node_modules/lit-html/lib/default-template-processor.js ***!
1704
- \*****************************************************************/
1705
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1706
-
1707
- __webpack_require__.r(__webpack_exports__);
1708
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1709
- /* harmony export */ "DefaultTemplateProcessor": () => (/* binding */ DefaultTemplateProcessor),
1710
- /* harmony export */ "defaultTemplateProcessor": () => (/* binding */ defaultTemplateProcessor)
1711
- /* harmony export */ });
1712
- /* harmony import */ var _parts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parts.js */ "./node_modules/lit-html/lib/parts.js");
1713
- /**
1714
- * @license
1715
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1716
- * This code may only be used under the BSD style license found at
1717
- * http://polymer.github.io/LICENSE.txt
1718
- * The complete set of authors may be found at
1719
- * http://polymer.github.io/AUTHORS.txt
1720
- * The complete set of contributors may be found at
1721
- * http://polymer.github.io/CONTRIBUTORS.txt
1722
- * Code distributed by Google as part of the polymer project is also
1723
- * subject to an additional IP rights grant found at
1724
- * http://polymer.github.io/PATENTS.txt
1725
- */
1726
-
1727
- /**
1728
- * Creates Parts when a template is instantiated.
1729
- */
1730
-
1731
- class DefaultTemplateProcessor {
1732
- /**
1733
- * Create parts for an attribute-position binding, given the event, attribute
1734
- * name, and string literals.
1735
- *
1736
- * @param element The element containing the binding
1737
- * @param name The attribute name
1738
- * @param strings The string literals. There are always at least two strings,
1739
- * event for fully-controlled bindings with a single expression.
1740
- */
1741
- handleAttributeExpressions(element, name, strings, options) {
1742
- const prefix = name[0];
1743
-
1744
- if (prefix === '.') {
1745
- const committer = new _parts_js__WEBPACK_IMPORTED_MODULE_0__.PropertyCommitter(element, name.slice(1), strings);
1746
- return committer.parts;
1747
- }
1748
-
1749
- if (prefix === '@') {
1750
- return [new _parts_js__WEBPACK_IMPORTED_MODULE_0__.EventPart(element, name.slice(1), options.eventContext)];
1751
- }
1752
-
1753
- if (prefix === '?') {
1754
- return [new _parts_js__WEBPACK_IMPORTED_MODULE_0__.BooleanAttributePart(element, name.slice(1), strings)];
1755
- }
1756
-
1757
- const committer = new _parts_js__WEBPACK_IMPORTED_MODULE_0__.AttributeCommitter(element, name, strings);
1758
- return committer.parts;
1759
- }
1760
- /**
1761
- * Create parts for a text-position binding.
1762
- * @param templateFactory
1763
- */
1764
-
1765
-
1766
- handleTextExpression(options) {
1767
- return new _parts_js__WEBPACK_IMPORTED_MODULE_0__.NodePart(options);
1768
- }
1769
-
1770
- }
1771
- const defaultTemplateProcessor = new DefaultTemplateProcessor();
1772
-
1773
- /***/ }),
1774
-
1775
- /***/ "./node_modules/lit-html/lib/directive.js":
1776
- /*!************************************************!*\
1777
- !*** ./node_modules/lit-html/lib/directive.js ***!
1778
- \************************************************/
1779
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1780
-
1781
- __webpack_require__.r(__webpack_exports__);
1782
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1783
- /* harmony export */ "directive": () => (/* binding */ directive),
1784
- /* harmony export */ "isDirective": () => (/* binding */ isDirective)
1785
- /* harmony export */ });
1786
- /**
1787
- * @license
1788
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1789
- * This code may only be used under the BSD style license found at
1790
- * http://polymer.github.io/LICENSE.txt
1791
- * The complete set of authors may be found at
1792
- * http://polymer.github.io/AUTHORS.txt
1793
- * The complete set of contributors may be found at
1794
- * http://polymer.github.io/CONTRIBUTORS.txt
1795
- * Code distributed by Google as part of the polymer project is also
1796
- * subject to an additional IP rights grant found at
1797
- * http://polymer.github.io/PATENTS.txt
1798
- */
1799
- const directives = new WeakMap();
1800
- /**
1801
- * Brands a function as a directive factory function so that lit-html will call
1802
- * the function during template rendering, rather than passing as a value.
1803
- *
1804
- * A _directive_ is a function that takes a Part as an argument. It has the
1805
- * signature: `(part: Part) => void`.
1806
- *
1807
- * A directive _factory_ is a function that takes arguments for data and
1808
- * configuration and returns a directive. Users of directive usually refer to
1809
- * the directive factory as the directive. For example, "The repeat directive".
1810
- *
1811
- * Usually a template author will invoke a directive factory in their template
1812
- * with relevant arguments, which will then return a directive function.
1813
- *
1814
- * Here's an example of using the `repeat()` directive factory that takes an
1815
- * array and a function to render an item:
1816
- *
1817
- * ```js
1818
- * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`
1819
- * ```
1820
- *
1821
- * When `repeat` is invoked, it returns a directive function that closes over
1822
- * `items` and the template function. When the outer template is rendered, the
1823
- * return directive function is called with the Part for the expression.
1824
- * `repeat` then performs it's custom logic to render multiple items.
1825
- *
1826
- * @param f The directive factory function. Must be a function that returns a
1827
- * function of the signature `(part: Part) => void`. The returned function will
1828
- * be called with the part object.
1829
- *
1830
- * @example
1831
- *
1832
- * import {directive, html} from 'lit-html';
1833
- *
1834
- * const immutable = directive((v) => (part) => {
1835
- * if (part.value !== v) {
1836
- * part.setValue(v)
1837
- * }
1838
- * });
1839
- */
1840
-
1841
- const directive = f => (...args) => {
1842
- const d = f(...args);
1843
- directives.set(d, true);
1844
- return d;
1845
- };
1846
- const isDirective = o => {
1847
- return typeof o === 'function' && directives.has(o);
1848
- };
1849
-
1850
- /***/ }),
1851
-
1852
- /***/ "./node_modules/lit-html/lib/dom.js":
1853
- /*!******************************************!*\
1854
- !*** ./node_modules/lit-html/lib/dom.js ***!
1855
- \******************************************/
1856
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1857
-
1858
- __webpack_require__.r(__webpack_exports__);
1859
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1860
- /* harmony export */ "isCEPolyfill": () => (/* binding */ isCEPolyfill),
1861
- /* harmony export */ "removeNodes": () => (/* binding */ removeNodes),
1862
- /* harmony export */ "reparentNodes": () => (/* binding */ reparentNodes)
1863
- /* harmony export */ });
1864
- /**
1865
- * @license
1866
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1867
- * This code may only be used under the BSD style license found at
1868
- * http://polymer.github.io/LICENSE.txt
1869
- * The complete set of authors may be found at
1870
- * http://polymer.github.io/AUTHORS.txt
1871
- * The complete set of contributors may be found at
1872
- * http://polymer.github.io/CONTRIBUTORS.txt
1873
- * Code distributed by Google as part of the polymer project is also
1874
- * subject to an additional IP rights grant found at
1875
- * http://polymer.github.io/PATENTS.txt
1876
- */
1877
-
1878
- /**
1879
- * True if the custom elements polyfill is in use.
1880
- */
1881
- const isCEPolyfill = typeof window !== 'undefined' && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== undefined;
1882
- /**
1883
- * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),
1884
- * into another container (could be the same container), before `before`. If
1885
- * `before` is null, it appends the nodes to the container.
1886
- */
1887
-
1888
- const reparentNodes = (container, start, end = null, before = null) => {
1889
- while (start !== end) {
1890
- const n = start.nextSibling;
1891
- container.insertBefore(start, before);
1892
- start = n;
1893
- }
1894
- };
1895
- /**
1896
- * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from
1897
- * `container`.
1898
- */
1899
-
1900
- const removeNodes = (container, start, end = null) => {
1901
- while (start !== end) {
1902
- const n = start.nextSibling;
1903
- container.removeChild(start);
1904
- start = n;
1905
- }
1906
- };
1907
-
1908
- /***/ }),
1909
-
1910
- /***/ "./node_modules/lit-html/lib/modify-template.js":
1911
- /*!******************************************************!*\
1912
- !*** ./node_modules/lit-html/lib/modify-template.js ***!
1913
- \******************************************************/
1914
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1915
-
1916
- __webpack_require__.r(__webpack_exports__);
1917
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1918
- /* harmony export */ "insertNodeIntoTemplate": () => (/* binding */ insertNodeIntoTemplate),
1919
- /* harmony export */ "removeNodesFromTemplate": () => (/* binding */ removeNodesFromTemplate)
1920
- /* harmony export */ });
1921
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
1922
- /**
1923
- * @license
1924
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1925
- * This code may only be used under the BSD style license found at
1926
- * http://polymer.github.io/LICENSE.txt
1927
- * The complete set of authors may be found at
1928
- * http://polymer.github.io/AUTHORS.txt
1929
- * The complete set of contributors may be found at
1930
- * http://polymer.github.io/CONTRIBUTORS.txt
1931
- * Code distributed by Google as part of the polymer project is also
1932
- * subject to an additional IP rights grant found at
1933
- * http://polymer.github.io/PATENTS.txt
1934
- */
1935
-
1936
- const walkerNodeFilter = 133
1937
- /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */
1938
- ;
1939
- /**
1940
- * Removes the list of nodes from a Template safely. In addition to removing
1941
- * nodes from the Template, the Template part indices are updated to match
1942
- * the mutated Template DOM.
1943
- *
1944
- * As the template is walked the removal state is tracked and
1945
- * part indices are adjusted as needed.
1946
- *
1947
- * div
1948
- * div#1 (remove) <-- start removing (removing node is div#1)
1949
- * div
1950
- * div#2 (remove) <-- continue removing (removing node is still div#1)
1951
- * div
1952
- * div <-- stop removing since previous sibling is the removing node (div#1,
1953
- * removed 4 nodes)
1954
- */
1955
-
1956
- function removeNodesFromTemplate(template, nodesToRemove) {
1957
- const {
1958
- element: {
1959
- content
1960
- },
1961
- parts
1962
- } = template;
1963
- const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);
1964
- let partIndex = nextActiveIndexInTemplateParts(parts);
1965
- let part = parts[partIndex];
1966
- let nodeIndex = -1;
1967
- let removeCount = 0;
1968
- const nodesToRemoveInTemplate = [];
1969
- let currentRemovingNode = null;
1970
-
1971
- while (walker.nextNode()) {
1972
- nodeIndex++;
1973
- const node = walker.currentNode; // End removal if stepped past the removing node
1974
-
1975
- if (node.previousSibling === currentRemovingNode) {
1976
- currentRemovingNode = null;
1977
- } // A node to remove was found in the template
1978
-
1979
-
1980
- if (nodesToRemove.has(node)) {
1981
- nodesToRemoveInTemplate.push(node); // Track node we're removing
1982
-
1983
- if (currentRemovingNode === null) {
1984
- currentRemovingNode = node;
1985
- }
1986
- } // When removing, increment count by which to adjust subsequent part indices
1987
-
1988
-
1989
- if (currentRemovingNode !== null) {
1990
- removeCount++;
1991
- }
1992
-
1993
- while (part !== undefined && part.index === nodeIndex) {
1994
- // If part is in a removed node deactivate it by setting index to -1 or
1995
- // adjust the index as needed.
1996
- part.index = currentRemovingNode !== null ? -1 : part.index - removeCount; // go to the next active part.
1997
-
1998
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
1999
- part = parts[partIndex];
2000
- }
2001
- }
2002
-
2003
- nodesToRemoveInTemplate.forEach(n => n.parentNode.removeChild(n));
2004
- }
2005
-
2006
- const countNodes = node => {
2007
- let count = node.nodeType === 11
2008
- /* Node.DOCUMENT_FRAGMENT_NODE */
2009
- ? 0 : 1;
2010
- const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);
2011
-
2012
- while (walker.nextNode()) {
2013
- count++;
2014
- }
2015
-
2016
- return count;
2017
- };
2018
-
2019
- const nextActiveIndexInTemplateParts = (parts, startIndex = -1) => {
2020
- for (let i = startIndex + 1; i < parts.length; i++) {
2021
- const part = parts[i];
2022
-
2023
- if ((0,_template_js__WEBPACK_IMPORTED_MODULE_0__.isTemplatePartActive)(part)) {
2024
- return i;
2025
- }
2026
- }
2027
-
2028
- return -1;
2029
- };
2030
- /**
2031
- * Inserts the given node into the Template, optionally before the given
2032
- * refNode. In addition to inserting the node into the Template, the Template
2033
- * part indices are updated to match the mutated Template DOM.
2034
- */
2035
-
2036
-
2037
- function insertNodeIntoTemplate(template, node, refNode = null) {
2038
- const {
2039
- element: {
2040
- content
2041
- },
2042
- parts
2043
- } = template; // If there's no refNode, then put node at end of template.
2044
- // No part indices need to be shifted in this case.
2045
-
2046
- if (refNode === null || refNode === undefined) {
2047
- content.appendChild(node);
2048
- return;
2049
- }
2050
-
2051
- const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);
2052
- let partIndex = nextActiveIndexInTemplateParts(parts);
2053
- let insertCount = 0;
2054
- let walkerIndex = -1;
2055
-
2056
- while (walker.nextNode()) {
2057
- walkerIndex++;
2058
- const walkerNode = walker.currentNode;
2059
-
2060
- if (walkerNode === refNode) {
2061
- insertCount = countNodes(node);
2062
- refNode.parentNode.insertBefore(node, refNode);
2063
- }
2064
-
2065
- while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {
2066
- // If we've inserted the node, simply adjust all subsequent parts
2067
- if (insertCount > 0) {
2068
- while (partIndex !== -1) {
2069
- parts[partIndex].index += insertCount;
2070
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
2071
- }
2072
-
2073
- return;
2074
- }
2075
-
2076
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
2077
- }
2078
- }
2079
- }
2080
-
2081
- /***/ }),
2082
-
2083
- /***/ "./node_modules/lit-html/lib/part.js":
2084
- /*!*******************************************!*\
2085
- !*** ./node_modules/lit-html/lib/part.js ***!
2086
- \*******************************************/
2087
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2088
-
2089
- __webpack_require__.r(__webpack_exports__);
2090
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2091
- /* harmony export */ "noChange": () => (/* binding */ noChange),
2092
- /* harmony export */ "nothing": () => (/* binding */ nothing)
2093
- /* harmony export */ });
2094
- /**
2095
- * @license
2096
- * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
2097
- * This code may only be used under the BSD style license found at
2098
- * http://polymer.github.io/LICENSE.txt
2099
- * The complete set of authors may be found at
2100
- * http://polymer.github.io/AUTHORS.txt
2101
- * The complete set of contributors may be found at
2102
- * http://polymer.github.io/CONTRIBUTORS.txt
2103
- * Code distributed by Google as part of the polymer project is also
2104
- * subject to an additional IP rights grant found at
2105
- * http://polymer.github.io/PATENTS.txt
2106
- */
2107
-
2108
- /**
2109
- * A sentinel value that signals that a value was handled by a directive and
2110
- * should not be written to the DOM.
2111
- */
2112
- const noChange = {};
2113
- /**
2114
- * A sentinel value that signals a NodePart to fully clear its content.
2115
- */
2116
-
2117
- const nothing = {};
2118
-
2119
- /***/ }),
2120
-
2121
- /***/ "./node_modules/lit-html/lib/parts.js":
2122
- /*!********************************************!*\
2123
- !*** ./node_modules/lit-html/lib/parts.js ***!
2124
- \********************************************/
2125
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2126
-
2127
- __webpack_require__.r(__webpack_exports__);
2128
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2129
- /* harmony export */ "AttributeCommitter": () => (/* binding */ AttributeCommitter),
2130
- /* harmony export */ "AttributePart": () => (/* binding */ AttributePart),
2131
- /* harmony export */ "BooleanAttributePart": () => (/* binding */ BooleanAttributePart),
2132
- /* harmony export */ "EventPart": () => (/* binding */ EventPart),
2133
- /* harmony export */ "NodePart": () => (/* binding */ NodePart),
2134
- /* harmony export */ "PropertyCommitter": () => (/* binding */ PropertyCommitter),
2135
- /* harmony export */ "PropertyPart": () => (/* binding */ PropertyPart),
2136
- /* harmony export */ "isIterable": () => (/* binding */ isIterable),
2137
- /* harmony export */ "isPrimitive": () => (/* binding */ isPrimitive)
2138
- /* harmony export */ });
2139
- /* harmony import */ var _directive_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./directive.js */ "./node_modules/lit-html/lib/directive.js");
2140
- /* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom.js */ "./node_modules/lit-html/lib/dom.js");
2141
- /* harmony import */ var _part_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./part.js */ "./node_modules/lit-html/lib/part.js");
2142
- /* harmony import */ var _template_instance_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./template-instance.js */ "./node_modules/lit-html/lib/template-instance.js");
2143
- /* harmony import */ var _template_result_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./template-result.js */ "./node_modules/lit-html/lib/template-result.js");
2144
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
2145
- /**
2146
- * @license
2147
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
2148
- * This code may only be used under the BSD style license found at
2149
- * http://polymer.github.io/LICENSE.txt
2150
- * The complete set of authors may be found at
2151
- * http://polymer.github.io/AUTHORS.txt
2152
- * The complete set of contributors may be found at
2153
- * http://polymer.github.io/CONTRIBUTORS.txt
2154
- * Code distributed by Google as part of the polymer project is also
2155
- * subject to an additional IP rights grant found at
2156
- * http://polymer.github.io/PATENTS.txt
2157
- */
2158
-
2159
-
2160
-
2161
-
2162
-
2163
-
2164
- const isPrimitive = value => {
2165
- return value === null || !(typeof value === 'object' || typeof value === 'function');
2166
- };
2167
- const isIterable = value => {
2168
- return Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
2169
- !!(value && value[Symbol.iterator]);
2170
- };
2171
- /**
2172
- * Writes attribute values to the DOM for a group of AttributeParts bound to a
2173
- * single attribute. The value is only set once even if there are multiple parts
2174
- * for an attribute.
2175
- */
2176
-
2177
- class AttributeCommitter {
2178
- constructor(element, name, strings) {
2179
- this.dirty = true;
2180
- this.element = element;
2181
- this.name = name;
2182
- this.strings = strings;
2183
- this.parts = [];
2184
-
2185
- for (let i = 0; i < strings.length - 1; i++) {
2186
- this.parts[i] = this._createPart();
2187
- }
2188
- }
2189
- /**
2190
- * Creates a single part. Override this to create a differnt type of part.
2191
- */
2192
-
2193
-
2194
- _createPart() {
2195
- return new AttributePart(this);
2196
- }
2197
-
2198
- _getValue() {
2199
- const strings = this.strings;
2200
- const l = strings.length - 1;
2201
- const parts = this.parts; // If we're assigning an attribute via syntax like:
2202
- // attr="${foo}" or attr=${foo}
2203
- // but not
2204
- // attr="${foo} ${bar}" or attr="${foo} baz"
2205
- // then we don't want to coerce the attribute value into one long
2206
- // string. Instead we want to just return the value itself directly,
2207
- // so that sanitizeDOMValue can get the actual value rather than
2208
- // String(value)
2209
- // The exception is if v is an array, in which case we do want to smash
2210
- // it together into a string without calling String() on the array.
2211
- //
2212
- // This also allows trusted values (when using TrustedTypes) being
2213
- // assigned to DOM sinks without being stringified in the process.
2214
-
2215
- if (l === 1 && strings[0] === '' && strings[1] === '') {
2216
- const v = parts[0].value;
2217
-
2218
- if (typeof v === 'symbol') {
2219
- return String(v);
2220
- }
2221
-
2222
- if (typeof v === 'string' || !isIterable(v)) {
2223
- return v;
2224
- }
2225
- }
2226
-
2227
- let text = '';
2228
-
2229
- for (let i = 0; i < l; i++) {
2230
- text += strings[i];
2231
- const part = parts[i];
2232
-
2233
- if (part !== undefined) {
2234
- const v = part.value;
2235
-
2236
- if (isPrimitive(v) || !isIterable(v)) {
2237
- text += typeof v === 'string' ? v : String(v);
2238
- } else {
2239
- for (const t of v) {
2240
- text += typeof t === 'string' ? t : String(t);
2241
- }
2242
- }
2243
- }
2244
- }
2245
-
2246
- text += strings[l];
2247
- return text;
2248
- }
2249
-
2250
- commit() {
2251
- if (this.dirty) {
2252
- this.dirty = false;
2253
- this.element.setAttribute(this.name, this._getValue());
2254
- }
2255
- }
2256
-
2257
- }
2258
- /**
2259
- * A Part that controls all or part of an attribute value.
2260
- */
2261
-
2262
- class AttributePart {
2263
- constructor(committer) {
2264
- this.value = undefined;
2265
- this.committer = committer;
2266
- }
2267
-
2268
- setValue(value) {
2269
- if (value !== _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange && (!isPrimitive(value) || value !== this.value)) {
2270
- this.value = value; // If the value is a not a directive, dirty the committer so that it'll
2271
- // call setAttribute. If the value is a directive, it'll dirty the
2272
- // committer if it calls setValue().
2273
-
2274
- if (!(0,_directive_js__WEBPACK_IMPORTED_MODULE_0__.isDirective)(value)) {
2275
- this.committer.dirty = true;
2276
- }
2277
- }
2278
- }
2279
-
2280
- commit() {
2281
- while ((0,_directive_js__WEBPACK_IMPORTED_MODULE_0__.isDirective)(this.value)) {
2282
- const directive = this.value;
2283
- this.value = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2284
- directive(this);
2285
- }
2286
-
2287
- if (this.value === _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange) {
2288
- return;
2289
- }
2290
-
2291
- this.committer.commit();
2292
- }
2293
-
2294
- }
2295
- /**
2296
- * A Part that controls a location within a Node tree. Like a Range, NodePart
2297
- * has start and end locations and can set and update the Nodes between those
2298
- * locations.
2299
- *
2300
- * NodeParts support several value types: primitives, Nodes, TemplateResults,
2301
- * as well as arrays and iterables of those types.
2302
- */
2303
-
2304
- class NodePart {
2305
- constructor(options) {
2306
- this.value = undefined;
2307
- this.__pendingValue = undefined;
2308
- this.options = options;
2309
- }
2310
- /**
2311
- * Appends this part into a container.
2312
- *
2313
- * This part must be empty, as its contents are not automatically moved.
2314
- */
2315
-
2316
-
2317
- appendInto(container) {
2318
- this.startNode = container.appendChild((0,_template_js__WEBPACK_IMPORTED_MODULE_5__.createMarker)());
2319
- this.endNode = container.appendChild((0,_template_js__WEBPACK_IMPORTED_MODULE_5__.createMarker)());
2320
- }
2321
- /**
2322
- * Inserts this part after the `ref` node (between `ref` and `ref`'s next
2323
- * sibling). Both `ref` and its next sibling must be static, unchanging nodes
2324
- * such as those that appear in a literal section of a template.
2325
- *
2326
- * This part must be empty, as its contents are not automatically moved.
2327
- */
2328
-
2329
-
2330
- insertAfterNode(ref) {
2331
- this.startNode = ref;
2332
- this.endNode = ref.nextSibling;
2333
- }
2334
- /**
2335
- * Appends this part into a parent part.
2336
- *
2337
- * This part must be empty, as its contents are not automatically moved.
2338
- */
2339
-
2340
-
2341
- appendIntoPart(part) {
2342
- part.__insert(this.startNode = (0,_template_js__WEBPACK_IMPORTED_MODULE_5__.createMarker)());
2343
-
2344
- part.__insert(this.endNode = (0,_template_js__WEBPACK_IMPORTED_MODULE_5__.createMarker)());
2345
- }
2346
- /**
2347
- * Inserts this part after the `ref` part.
2348
- *
2349
- * This part must be empty, as its contents are not automatically moved.
2350
- */
2351
-
2352
-
2353
- insertAfterPart(ref) {
2354
- ref.__insert(this.startNode = (0,_template_js__WEBPACK_IMPORTED_MODULE_5__.createMarker)());
2355
-
2356
- this.endNode = ref.endNode;
2357
- ref.endNode = this.startNode;
2358
- }
2359
-
2360
- setValue(value) {
2361
- this.__pendingValue = value;
2362
- }
2363
-
2364
- commit() {
2365
- if (this.startNode.parentNode === null) {
2366
- return;
2367
- }
2368
-
2369
- while ((0,_directive_js__WEBPACK_IMPORTED_MODULE_0__.isDirective)(this.__pendingValue)) {
2370
- const directive = this.__pendingValue;
2371
- this.__pendingValue = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2372
- directive(this);
2373
- }
2374
-
2375
- const value = this.__pendingValue;
2376
-
2377
- if (value === _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange) {
2378
- return;
2379
- }
2380
-
2381
- if (isPrimitive(value)) {
2382
- if (value !== this.value) {
2383
- this.__commitText(value);
2384
- }
2385
- } else if (value instanceof _template_result_js__WEBPACK_IMPORTED_MODULE_4__.TemplateResult) {
2386
- this.__commitTemplateResult(value);
2387
- } else if (value instanceof Node) {
2388
- this.__commitNode(value);
2389
- } else if (isIterable(value)) {
2390
- this.__commitIterable(value);
2391
- } else if (value === _part_js__WEBPACK_IMPORTED_MODULE_2__.nothing) {
2392
- this.value = _part_js__WEBPACK_IMPORTED_MODULE_2__.nothing;
2393
- this.clear();
2394
- } else {
2395
- // Fallback, will render the string representation
2396
- this.__commitText(value);
2397
- }
2398
- }
2399
-
2400
- __insert(node) {
2401
- this.endNode.parentNode.insertBefore(node, this.endNode);
2402
- }
2403
-
2404
- __commitNode(value) {
2405
- if (this.value === value) {
2406
- return;
2407
- }
2408
-
2409
- this.clear();
2410
-
2411
- this.__insert(value);
2412
-
2413
- this.value = value;
2414
- }
2415
-
2416
- __commitText(value) {
2417
- const node = this.startNode.nextSibling;
2418
- value = value == null ? '' : value; // If `value` isn't already a string, we explicitly convert it here in case
2419
- // it can't be implicitly converted - i.e. it's a symbol.
2420
-
2421
- const valueAsString = typeof value === 'string' ? value : String(value);
2422
-
2423
- if (node === this.endNode.previousSibling && node.nodeType === 3
2424
- /* Node.TEXT_NODE */
2425
- ) {
2426
- // If we only have a single text node between the markers, we can just
2427
- // set its value, rather than replacing it.
2428
- // TODO(justinfagnani): Can we just check if this.value is primitive?
2429
- node.data = valueAsString;
2430
- } else {
2431
- this.__commitNode(document.createTextNode(valueAsString));
2432
- }
2433
-
2434
- this.value = value;
2435
- }
2436
-
2437
- __commitTemplateResult(value) {
2438
- const template = this.options.templateFactory(value);
2439
-
2440
- if (this.value instanceof _template_instance_js__WEBPACK_IMPORTED_MODULE_3__.TemplateInstance && this.value.template === template) {
2441
- this.value.update(value.values);
2442
- } else {
2443
- // Make sure we propagate the template processor from the TemplateResult
2444
- // so that we use its syntax extension, etc. The template factory comes
2445
- // from the render function options so that it can control template
2446
- // caching and preprocessing.
2447
- const instance = new _template_instance_js__WEBPACK_IMPORTED_MODULE_3__.TemplateInstance(template, value.processor, this.options);
2448
-
2449
- const fragment = instance._clone();
2450
-
2451
- instance.update(value.values);
2452
-
2453
- this.__commitNode(fragment);
2454
-
2455
- this.value = instance;
2456
- }
2457
- }
2458
-
2459
- __commitIterable(value) {
2460
- // For an Iterable, we create a new InstancePart per item, then set its
2461
- // value to the item. This is a little bit of overhead for every item in
2462
- // an Iterable, but it lets us recurse easily and efficiently update Arrays
2463
- // of TemplateResults that will be commonly returned from expressions like:
2464
- // array.map((i) => html`${i}`), by reusing existing TemplateInstances.
2465
- // If _value is an array, then the previous render was of an
2466
- // iterable and _value will contain the NodeParts from the previous
2467
- // render. If _value is not an array, clear this part and make a new
2468
- // array for NodeParts.
2469
- if (!Array.isArray(this.value)) {
2470
- this.value = [];
2471
- this.clear();
2472
- } // Lets us keep track of how many items we stamped so we can clear leftover
2473
- // items from a previous render
2474
-
2475
-
2476
- const itemParts = this.value;
2477
- let partIndex = 0;
2478
- let itemPart;
2479
-
2480
- for (const item of value) {
2481
- // Try to reuse an existing part
2482
- itemPart = itemParts[partIndex]; // If no existing part, create a new one
2483
-
2484
- if (itemPart === undefined) {
2485
- itemPart = new NodePart(this.options);
2486
- itemParts.push(itemPart);
2487
-
2488
- if (partIndex === 0) {
2489
- itemPart.appendIntoPart(this);
2490
- } else {
2491
- itemPart.insertAfterPart(itemParts[partIndex - 1]);
2492
- }
2493
- }
2494
-
2495
- itemPart.setValue(item);
2496
- itemPart.commit();
2497
- partIndex++;
2498
- }
2499
-
2500
- if (partIndex < itemParts.length) {
2501
- // Truncate the parts array so _value reflects the current state
2502
- itemParts.length = partIndex;
2503
- this.clear(itemPart && itemPart.endNode);
2504
- }
2505
- }
2506
-
2507
- clear(startNode = this.startNode) {
2508
- (0,_dom_js__WEBPACK_IMPORTED_MODULE_1__.removeNodes)(this.startNode.parentNode, startNode.nextSibling, this.endNode);
2509
- }
2510
-
2511
- }
2512
- /**
2513
- * Implements a boolean attribute, roughly as defined in the HTML
2514
- * specification.
2515
- *
2516
- * If the value is truthy, then the attribute is present with a value of
2517
- * ''. If the value is falsey, the attribute is removed.
2518
- */
2519
-
2520
- class BooleanAttributePart {
2521
- constructor(element, name, strings) {
2522
- this.value = undefined;
2523
- this.__pendingValue = undefined;
2524
-
2525
- if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {
2526
- throw new Error('Boolean attributes can only contain a single expression');
2527
- }
2528
-
2529
- this.element = element;
2530
- this.name = name;
2531
- this.strings = strings;
2532
- }
2533
-
2534
- setValue(value) {
2535
- this.__pendingValue = value;
2536
- }
2537
-
2538
- commit() {
2539
- while ((0,_directive_js__WEBPACK_IMPORTED_MODULE_0__.isDirective)(this.__pendingValue)) {
2540
- const directive = this.__pendingValue;
2541
- this.__pendingValue = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2542
- directive(this);
2543
- }
2544
-
2545
- if (this.__pendingValue === _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange) {
2546
- return;
2547
- }
2548
-
2549
- const value = !!this.__pendingValue;
2550
-
2551
- if (this.value !== value) {
2552
- if (value) {
2553
- this.element.setAttribute(this.name, '');
2554
- } else {
2555
- this.element.removeAttribute(this.name);
2556
- }
2557
-
2558
- this.value = value;
2559
- }
2560
-
2561
- this.__pendingValue = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2562
- }
2563
-
2564
- }
2565
- /**
2566
- * Sets attribute values for PropertyParts, so that the value is only set once
2567
- * even if there are multiple parts for a property.
2568
- *
2569
- * If an expression controls the whole property value, then the value is simply
2570
- * assigned to the property under control. If there are string literals or
2571
- * multiple expressions, then the strings are expressions are interpolated into
2572
- * a string first.
2573
- */
2574
-
2575
- class PropertyCommitter extends AttributeCommitter {
2576
- constructor(element, name, strings) {
2577
- super(element, name, strings);
2578
- this.single = strings.length === 2 && strings[0] === '' && strings[1] === '';
2579
- }
2580
-
2581
- _createPart() {
2582
- return new PropertyPart(this);
2583
- }
2584
-
2585
- _getValue() {
2586
- if (this.single) {
2587
- return this.parts[0].value;
2588
- }
2589
-
2590
- return super._getValue();
2591
- }
2592
-
2593
- commit() {
2594
- if (this.dirty) {
2595
- this.dirty = false; // eslint-disable-next-line @typescript-eslint/no-explicit-any
2596
-
2597
- this.element[this.name] = this._getValue();
2598
- }
2599
- }
2600
-
2601
- }
2602
- class PropertyPart extends AttributePart {} // Detect event listener options support. If the `capture` property is read
2603
- // from the options object, then options are supported. If not, then the third
2604
- // argument to add/removeEventListener is interpreted as the boolean capture
2605
- // value so we should only pass the `capture` property.
2606
-
2607
- let eventOptionsSupported = false; // Wrap into an IIFE because MS Edge <= v41 does not support having try/catch
2608
- // blocks right into the body of a module
2609
-
2610
- (() => {
2611
- try {
2612
- const options = {
2613
- get capture() {
2614
- eventOptionsSupported = true;
2615
- return false;
2616
- }
2617
-
2618
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
2619
-
2620
- window.addEventListener('test', options, options); // eslint-disable-next-line @typescript-eslint/no-explicit-any
2621
-
2622
- window.removeEventListener('test', options, options);
2623
- } catch (_e) {// event options not supported
2624
- }
2625
- })();
2626
-
2627
- class EventPart {
2628
- constructor(element, eventName, eventContext) {
2629
- this.value = undefined;
2630
- this.__pendingValue = undefined;
2631
- this.element = element;
2632
- this.eventName = eventName;
2633
- this.eventContext = eventContext;
2634
-
2635
- this.__boundHandleEvent = e => this.handleEvent(e);
2636
- }
2637
-
2638
- setValue(value) {
2639
- this.__pendingValue = value;
2640
- }
2641
-
2642
- commit() {
2643
- while ((0,_directive_js__WEBPACK_IMPORTED_MODULE_0__.isDirective)(this.__pendingValue)) {
2644
- const directive = this.__pendingValue;
2645
- this.__pendingValue = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2646
- directive(this);
2647
- }
2648
-
2649
- if (this.__pendingValue === _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange) {
2650
- return;
2651
- }
2652
-
2653
- const newListener = this.__pendingValue;
2654
- const oldListener = this.value;
2655
- const shouldRemoveListener = newListener == null || oldListener != null && (newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive);
2656
- const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener);
2657
-
2658
- if (shouldRemoveListener) {
2659
- this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options);
2660
- }
2661
-
2662
- if (shouldAddListener) {
2663
- this.__options = getOptions(newListener);
2664
- this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options);
2665
- }
2666
-
2667
- this.value = newListener;
2668
- this.__pendingValue = _part_js__WEBPACK_IMPORTED_MODULE_2__.noChange;
2669
- }
2670
-
2671
- handleEvent(event) {
2672
- if (typeof this.value === 'function') {
2673
- this.value.call(this.eventContext || this.element, event);
2674
- } else {
2675
- this.value.handleEvent(event);
2676
- }
2677
- }
2678
-
2679
- } // We copy options because of the inconsistent behavior of browsers when reading
2680
- // the third argument of add/removeEventListener. IE11 doesn't support options
2681
- // at all. Chrome 41 only reads `capture` if the argument is an object.
2682
-
2683
- const getOptions = o => o && (eventOptionsSupported ? {
2684
- capture: o.capture,
2685
- passive: o.passive,
2686
- once: o.once
2687
- } : o.capture);
2688
-
2689
- /***/ }),
2690
-
2691
- /***/ "./node_modules/lit-html/lib/render.js":
2692
- /*!*********************************************!*\
2693
- !*** ./node_modules/lit-html/lib/render.js ***!
2694
- \*********************************************/
2695
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2696
-
2697
- __webpack_require__.r(__webpack_exports__);
2698
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2699
- /* harmony export */ "parts": () => (/* binding */ parts),
2700
- /* harmony export */ "render": () => (/* binding */ render)
2701
- /* harmony export */ });
2702
- /* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom.js */ "./node_modules/lit-html/lib/dom.js");
2703
- /* harmony import */ var _parts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parts.js */ "./node_modules/lit-html/lib/parts.js");
2704
- /* harmony import */ var _template_factory_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./template-factory.js */ "./node_modules/lit-html/lib/template-factory.js");
2705
- /**
2706
- * @license
2707
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
2708
- * This code may only be used under the BSD style license found at
2709
- * http://polymer.github.io/LICENSE.txt
2710
- * The complete set of authors may be found at
2711
- * http://polymer.github.io/AUTHORS.txt
2712
- * The complete set of contributors may be found at
2713
- * http://polymer.github.io/CONTRIBUTORS.txt
2714
- * Code distributed by Google as part of the polymer project is also
2715
- * subject to an additional IP rights grant found at
2716
- * http://polymer.github.io/PATENTS.txt
2717
- */
2718
-
2719
-
2720
-
2721
- const parts = new WeakMap();
2722
- /**
2723
- * Renders a template result or other value to a container.
2724
- *
2725
- * To update a container with new values, reevaluate the template literal and
2726
- * call `render` with the new result.
2727
- *
2728
- * @param result Any value renderable by NodePart - typically a TemplateResult
2729
- * created by evaluating a template tag like `html` or `svg`.
2730
- * @param container A DOM parent to render to. The entire contents are either
2731
- * replaced, or efficiently updated if the same result type was previous
2732
- * rendered there.
2733
- * @param options RenderOptions for the entire render tree rendered to this
2734
- * container. Render options must *not* change between renders to the same
2735
- * container, as those changes will not effect previously rendered DOM.
2736
- */
2737
-
2738
- const render = (result, container, options) => {
2739
- let part = parts.get(container);
2740
-
2741
- if (part === undefined) {
2742
- (0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.removeNodes)(container, container.firstChild);
2743
- parts.set(container, part = new _parts_js__WEBPACK_IMPORTED_MODULE_1__.NodePart(Object.assign({
2744
- templateFactory: _template_factory_js__WEBPACK_IMPORTED_MODULE_2__.templateFactory
2745
- }, options)));
2746
- part.appendInto(container);
2747
- }
2748
-
2749
- part.setValue(result);
2750
- part.commit();
2751
- };
2752
-
2753
- /***/ }),
2754
-
2755
- /***/ "./node_modules/lit-html/lib/shady-render.js":
2756
- /*!***************************************************!*\
2757
- !*** ./node_modules/lit-html/lib/shady-render.js ***!
2758
- \***************************************************/
2759
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
2760
-
2761
- __webpack_require__.r(__webpack_exports__);
2762
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2763
- /* harmony export */ "TemplateResult": () => (/* reexport safe */ _lit_html_js__WEBPACK_IMPORTED_MODULE_6__.TemplateResult),
2764
- /* harmony export */ "html": () => (/* reexport safe */ _lit_html_js__WEBPACK_IMPORTED_MODULE_6__.html),
2765
- /* harmony export */ "render": () => (/* binding */ render),
2766
- /* harmony export */ "shadyTemplateFactory": () => (/* binding */ shadyTemplateFactory),
2767
- /* harmony export */ "svg": () => (/* reexport safe */ _lit_html_js__WEBPACK_IMPORTED_MODULE_6__.svg)
2768
- /* harmony export */ });
2769
- /* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom.js */ "./node_modules/lit-html/lib/dom.js");
2770
- /* harmony import */ var _modify_template_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modify-template.js */ "./node_modules/lit-html/lib/modify-template.js");
2771
- /* harmony import */ var _render_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./render.js */ "./node_modules/lit-html/lib/render.js");
2772
- /* harmony import */ var _template_factory_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./template-factory.js */ "./node_modules/lit-html/lib/template-factory.js");
2773
- /* harmony import */ var _template_instance_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./template-instance.js */ "./node_modules/lit-html/lib/template-instance.js");
2774
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
2775
- /* harmony import */ var _lit_html_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lit-html.js */ "./node_modules/lit-html/lit-html.js");
2776
- /**
2777
- * @license
2778
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
2779
- * This code may only be used under the BSD style license found at
2780
- * http://polymer.github.io/LICENSE.txt
2781
- * The complete set of authors may be found at
2782
- * http://polymer.github.io/AUTHORS.txt
2783
- * The complete set of contributors may be found at
2784
- * http://polymer.github.io/CONTRIBUTORS.txt
2785
- * Code distributed by Google as part of the polymer project is also
2786
- * subject to an additional IP rights grant found at
2787
- * http://polymer.github.io/PATENTS.txt
2788
- */
2789
-
2790
- /**
2791
- * Module to add shady DOM/shady CSS polyfill support to lit-html template
2792
- * rendering. See the [[render]] method for details.
2793
- *
2794
- * @packageDocumentation
2795
- */
2796
-
2797
- /**
2798
- * Do not remove this comment; it keeps typedoc from misplacing the module
2799
- * docs.
2800
- */
2801
-
2802
-
2803
-
2804
-
2805
-
2806
-
2807
- // Get a key to lookup in `templateCaches`.
2808
-
2809
- const getTemplateCacheKey = (type, scopeName) => `${type}--${scopeName}`;
2810
-
2811
- let compatibleShadyCSSVersion = true;
2812
-
2813
- if (typeof window.ShadyCSS === 'undefined') {
2814
- compatibleShadyCSSVersion = false;
2815
- } else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {
2816
- console.warn(`Incompatible ShadyCSS version detected. ` + `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` + `@webcomponents/shadycss@1.3.1.`);
2817
- compatibleShadyCSSVersion = false;
2818
- }
2819
- /**
2820
- * Template factory which scopes template DOM using ShadyCSS.
2821
- * @param scopeName {string}
2822
- */
2823
-
2824
-
2825
- const shadyTemplateFactory = scopeName => result => {
2826
- const cacheKey = getTemplateCacheKey(result.type, scopeName);
2827
- let templateCache = _template_factory_js__WEBPACK_IMPORTED_MODULE_3__.templateCaches.get(cacheKey);
2828
-
2829
- if (templateCache === undefined) {
2830
- templateCache = {
2831
- stringsArray: new WeakMap(),
2832
- keyString: new Map()
2833
- };
2834
- _template_factory_js__WEBPACK_IMPORTED_MODULE_3__.templateCaches.set(cacheKey, templateCache);
2835
- }
2836
-
2837
- let template = templateCache.stringsArray.get(result.strings);
2838
-
2839
- if (template !== undefined) {
2840
- return template;
2841
- }
2842
-
2843
- const key = result.strings.join(_template_js__WEBPACK_IMPORTED_MODULE_5__.marker);
2844
- template = templateCache.keyString.get(key);
2845
-
2846
- if (template === undefined) {
2847
- const element = result.getTemplateElement();
2848
-
2849
- if (compatibleShadyCSSVersion) {
2850
- window.ShadyCSS.prepareTemplateDom(element, scopeName);
2851
- }
2852
-
2853
- template = new _template_js__WEBPACK_IMPORTED_MODULE_5__.Template(result, element);
2854
- templateCache.keyString.set(key, template);
2855
- }
2856
-
2857
- templateCache.stringsArray.set(result.strings, template);
2858
- return template;
2859
- };
2860
- const TEMPLATE_TYPES = ['html', 'svg'];
2861
- /**
2862
- * Removes all style elements from Templates for the given scopeName.
2863
- */
2864
-
2865
- const removeStylesFromLitTemplates = scopeName => {
2866
- TEMPLATE_TYPES.forEach(type => {
2867
- const templates = _template_factory_js__WEBPACK_IMPORTED_MODULE_3__.templateCaches.get(getTemplateCacheKey(type, scopeName));
2868
-
2869
- if (templates !== undefined) {
2870
- templates.keyString.forEach(template => {
2871
- const {
2872
- element: {
2873
- content
2874
- }
2875
- } = template; // IE 11 doesn't support the iterable param Set constructor
2876
-
2877
- const styles = new Set();
2878
- Array.from(content.querySelectorAll('style')).forEach(s => {
2879
- styles.add(s);
2880
- });
2881
- (0,_modify_template_js__WEBPACK_IMPORTED_MODULE_1__.removeNodesFromTemplate)(template, styles);
2882
- });
2883
- }
2884
- });
2885
- };
2886
-
2887
- const shadyRenderSet = new Set();
2888
- /**
2889
- * For the given scope name, ensures that ShadyCSS style scoping is performed.
2890
- * This is done just once per scope name so the fragment and template cannot
2891
- * be modified.
2892
- * (1) extracts styles from the rendered fragment and hands them to ShadyCSS
2893
- * to be scoped and appended to the document
2894
- * (2) removes style elements from all lit-html Templates for this scope name.
2895
- *
2896
- * Note, <style> elements can only be placed into templates for the
2897
- * initial rendering of the scope. If <style> elements are included in templates
2898
- * dynamically rendered to the scope (after the first scope render), they will
2899
- * not be scoped and the <style> will be left in the template and rendered
2900
- * output.
2901
- */
2902
-
2903
- const prepareTemplateStyles = (scopeName, renderedDOM, template) => {
2904
- shadyRenderSet.add(scopeName); // If `renderedDOM` is stamped from a Template, then we need to edit that
2905
- // Template's underlying template element. Otherwise, we create one here
2906
- // to give to ShadyCSS, which still requires one while scoping.
2907
-
2908
- const templateElement = !!template ? template.element : document.createElement('template'); // Move styles out of rendered DOM and store.
2909
-
2910
- const styles = renderedDOM.querySelectorAll('style');
2911
- const {
2912
- length
2913
- } = styles; // If there are no styles, skip unnecessary work
2914
-
2915
- if (length === 0) {
2916
- // Ensure prepareTemplateStyles is called to support adding
2917
- // styles via `prepareAdoptedCssText` since that requires that
2918
- // `prepareTemplateStyles` is called.
2919
- //
2920
- // ShadyCSS will only update styles containing @apply in the template
2921
- // given to `prepareTemplateStyles`. If no lit Template was given,
2922
- // ShadyCSS will not be able to update uses of @apply in any relevant
2923
- // template. However, this is not a problem because we only create the
2924
- // template for the purpose of supporting `prepareAdoptedCssText`,
2925
- // which doesn't support @apply at all.
2926
- window.ShadyCSS.prepareTemplateStyles(templateElement, scopeName);
2927
- return;
2928
- }
2929
-
2930
- const condensedStyle = document.createElement('style'); // Collect styles into a single style. This helps us make sure ShadyCSS
2931
- // manipulations will not prevent us from being able to fix up template
2932
- // part indices.
2933
- // NOTE: collecting styles is inefficient for browsers but ShadyCSS
2934
- // currently does this anyway. When it does not, this should be changed.
2935
-
2936
- for (let i = 0; i < length; i++) {
2937
- const style = styles[i];
2938
- style.parentNode.removeChild(style);
2939
- condensedStyle.textContent += style.textContent;
2940
- } // Remove styles from nested templates in this scope.
2941
-
2942
-
2943
- removeStylesFromLitTemplates(scopeName); // And then put the condensed style into the "root" template passed in as
2944
- // `template`.
2945
-
2946
- const content = templateElement.content;
2947
-
2948
- if (!!template) {
2949
- (0,_modify_template_js__WEBPACK_IMPORTED_MODULE_1__.insertNodeIntoTemplate)(template, condensedStyle, content.firstChild);
2950
- } else {
2951
- content.insertBefore(condensedStyle, content.firstChild);
2952
- } // Note, it's important that ShadyCSS gets the template that `lit-html`
2953
- // will actually render so that it can update the style inside when
2954
- // needed (e.g. @apply native Shadow DOM case).
2955
-
2956
-
2957
- window.ShadyCSS.prepareTemplateStyles(templateElement, scopeName);
2958
- const style = content.querySelector('style');
2959
-
2960
- if (window.ShadyCSS.nativeShadow && style !== null) {
2961
- // When in native Shadow DOM, ensure the style created by ShadyCSS is
2962
- // included in initially rendered output (`renderedDOM`).
2963
- renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);
2964
- } else if (!!template) {
2965
- // When no style is left in the template, parts will be broken as a
2966
- // result. To fix this, we put back the style node ShadyCSS removed
2967
- // and then tell lit to remove that node from the template.
2968
- // There can be no style in the template in 2 cases (1) when Shady DOM
2969
- // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM
2970
- // is in use ShadyCSS removes the style if it contains no content.
2971
- // NOTE, ShadyCSS creates its own style so we can safely add/remove
2972
- // `condensedStyle` here.
2973
- content.insertBefore(condensedStyle, content.firstChild);
2974
- const removes = new Set();
2975
- removes.add(condensedStyle);
2976
- (0,_modify_template_js__WEBPACK_IMPORTED_MODULE_1__.removeNodesFromTemplate)(template, removes);
2977
- }
2978
- };
2979
- /**
2980
- * Extension to the standard `render` method which supports rendering
2981
- * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)
2982
- * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used
2983
- * or when the webcomponentsjs
2984
- * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.
2985
- *
2986
- * Adds a `scopeName` option which is used to scope element DOM and stylesheets
2987
- * when native ShadowDOM is unavailable. The `scopeName` will be added to
2988
- * the class attribute of all rendered DOM. In addition, any style elements will
2989
- * be automatically re-written with this `scopeName` selector and moved out
2990
- * of the rendered DOM and into the document `<head>`.
2991
- *
2992
- * It is common to use this render method in conjunction with a custom element
2993
- * which renders a shadowRoot. When this is done, typically the element's
2994
- * `localName` should be used as the `scopeName`.
2995
- *
2996
- * In addition to DOM scoping, ShadyCSS also supports a basic shim for css
2997
- * custom properties (needed only on older browsers like IE11) and a shim for
2998
- * a deprecated feature called `@apply` that supports applying a set of css
2999
- * custom properties to a given location.
3000
- *
3001
- * Usage considerations:
3002
- *
3003
- * * Part values in `<style>` elements are only applied the first time a given
3004
- * `scopeName` renders. Subsequent changes to parts in style elements will have
3005
- * no effect. Because of this, parts in style elements should only be used for
3006
- * values that will never change, for example parts that set scope-wide theme
3007
- * values or parts which render shared style elements.
3008
- *
3009
- * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a
3010
- * custom element's `constructor` is not supported. Instead rendering should
3011
- * either done asynchronously, for example at microtask timing (for example
3012
- * `Promise.resolve()`), or be deferred until the first time the element's
3013
- * `connectedCallback` runs.
3014
- *
3015
- * Usage considerations when using shimmed custom properties or `@apply`:
3016
- *
3017
- * * Whenever any dynamic changes are made which affect
3018
- * css custom properties, `ShadyCSS.styleElement(element)` must be called
3019
- * to update the element. There are two cases when this is needed:
3020
- * (1) the element is connected to a new parent, (2) a class is added to the
3021
- * element that causes it to match different custom properties.
3022
- * To address the first case when rendering a custom element, `styleElement`
3023
- * should be called in the element's `connectedCallback`.
3024
- *
3025
- * * Shimmed custom properties may only be defined either for an entire
3026
- * shadowRoot (for example, in a `:host` rule) or via a rule that directly
3027
- * matches an element with a shadowRoot. In other words, instead of flowing from
3028
- * parent to child as do native css custom properties, shimmed custom properties
3029
- * flow only from shadowRoots to nested shadowRoots.
3030
- *
3031
- * * When using `@apply` mixing css shorthand property names with
3032
- * non-shorthand names (for example `border` and `border-width`) is not
3033
- * supported.
3034
- */
3035
-
3036
-
3037
- const render = (result, container, options) => {
3038
- if (!options || typeof options !== 'object' || !options.scopeName) {
3039
- throw new Error('The `scopeName` option is required.');
3040
- }
3041
-
3042
- const scopeName = options.scopeName;
3043
- const hasRendered = _render_js__WEBPACK_IMPORTED_MODULE_2__.parts.has(container);
3044
- const needsScoping = compatibleShadyCSSVersion && container.nodeType === 11
3045
- /* Node.DOCUMENT_FRAGMENT_NODE */
3046
- && !!container.host; // Handle first render to a scope specially...
3047
-
3048
- const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName); // On first scope render, render into a fragment; this cannot be a single
3049
- // fragment that is reused since nested renders can occur synchronously.
3050
-
3051
- const renderContainer = firstScopeRender ? document.createDocumentFragment() : container;
3052
- (0,_render_js__WEBPACK_IMPORTED_MODULE_2__.render)(result, renderContainer, Object.assign({
3053
- templateFactory: shadyTemplateFactory(scopeName)
3054
- }, options)); // When performing first scope render,
3055
- // (1) We've rendered into a fragment so that there's a chance to
3056
- // `prepareTemplateStyles` before sub-elements hit the DOM
3057
- // (which might cause them to render based on a common pattern of
3058
- // rendering in a custom element's `connectedCallback`);
3059
- // (2) Scope the template with ShadyCSS one time only for this scope.
3060
- // (3) Render the fragment into the container and make sure the
3061
- // container knows its `part` is the one we just rendered. This ensures
3062
- // DOM will be re-used on subsequent renders.
3063
-
3064
- if (firstScopeRender) {
3065
- const part = _render_js__WEBPACK_IMPORTED_MODULE_2__.parts.get(renderContainer);
3066
- _render_js__WEBPACK_IMPORTED_MODULE_2__.parts["delete"](renderContainer); // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)
3067
- // that should apply to `renderContainer` even if the rendered value is
3068
- // not a TemplateInstance. However, it will only insert scoped styles
3069
- // into the document if `prepareTemplateStyles` has already been called
3070
- // for the given scope name.
3071
-
3072
- const template = part.value instanceof _template_instance_js__WEBPACK_IMPORTED_MODULE_4__.TemplateInstance ? part.value.template : undefined;
3073
- prepareTemplateStyles(scopeName, renderContainer, template);
3074
- (0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.removeNodes)(container, container.firstChild);
3075
- container.appendChild(renderContainer);
3076
- _render_js__WEBPACK_IMPORTED_MODULE_2__.parts.set(container, part);
3077
- } // After elements have hit the DOM, update styling if this is the
3078
- // initial render to this container.
3079
- // This is needed whenever dynamic changes are made so it would be
3080
- // safest to do every render; however, this would regress performance
3081
- // so we leave it up to the user to call `ShadyCSS.styleElement`
3082
- // for dynamic changes.
3083
-
3084
-
3085
- if (!hasRendered && needsScoping) {
3086
- window.ShadyCSS.styleElement(container.host);
3087
- }
3088
- };
3089
-
3090
- /***/ }),
3091
-
3092
- /***/ "./node_modules/lit-html/lib/template-factory.js":
3093
- /*!*******************************************************!*\
3094
- !*** ./node_modules/lit-html/lib/template-factory.js ***!
3095
- \*******************************************************/
3096
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
3097
-
3098
- __webpack_require__.r(__webpack_exports__);
3099
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3100
- /* harmony export */ "templateCaches": () => (/* binding */ templateCaches),
3101
- /* harmony export */ "templateFactory": () => (/* binding */ templateFactory)
3102
- /* harmony export */ });
3103
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
3104
- /**
3105
- * @license
3106
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
3107
- * This code may only be used under the BSD style license found at
3108
- * http://polymer.github.io/LICENSE.txt
3109
- * The complete set of authors may be found at
3110
- * http://polymer.github.io/AUTHORS.txt
3111
- * The complete set of contributors may be found at
3112
- * http://polymer.github.io/CONTRIBUTORS.txt
3113
- * Code distributed by Google as part of the polymer project is also
3114
- * subject to an additional IP rights grant found at
3115
- * http://polymer.github.io/PATENTS.txt
3116
- */
3117
-
3118
- /**
3119
- * The default TemplateFactory which caches Templates keyed on
3120
- * result.type and result.strings.
3121
- */
3122
-
3123
- function templateFactory(result) {
3124
- let templateCache = templateCaches.get(result.type);
3125
-
3126
- if (templateCache === undefined) {
3127
- templateCache = {
3128
- stringsArray: new WeakMap(),
3129
- keyString: new Map()
3130
- };
3131
- templateCaches.set(result.type, templateCache);
3132
- }
3133
-
3134
- let template = templateCache.stringsArray.get(result.strings);
3135
-
3136
- if (template !== undefined) {
3137
- return template;
3138
- } // If the TemplateStringsArray is new, generate a key from the strings
3139
- // This key is shared between all templates with identical content
3140
-
3141
-
3142
- const key = result.strings.join(_template_js__WEBPACK_IMPORTED_MODULE_0__.marker); // Check if we already have a Template for this key
3143
-
3144
- template = templateCache.keyString.get(key);
3145
-
3146
- if (template === undefined) {
3147
- // If we have not seen this key before, create a new Template
3148
- template = new _template_js__WEBPACK_IMPORTED_MODULE_0__.Template(result, result.getTemplateElement()); // Cache the Template for this key
3149
-
3150
- templateCache.keyString.set(key, template);
3151
- } // Cache all future queries for this TemplateStringsArray
3152
-
3153
-
3154
- templateCache.stringsArray.set(result.strings, template);
3155
- return template;
3156
- }
3157
- const templateCaches = new Map();
3158
-
3159
- /***/ }),
3160
-
3161
- /***/ "./node_modules/lit-html/lib/template-instance.js":
3162
- /*!********************************************************!*\
3163
- !*** ./node_modules/lit-html/lib/template-instance.js ***!
3164
- \********************************************************/
3165
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
3166
-
3167
- __webpack_require__.r(__webpack_exports__);
3168
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3169
- /* harmony export */ "TemplateInstance": () => (/* binding */ TemplateInstance)
3170
- /* harmony export */ });
3171
- /* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom.js */ "./node_modules/lit-html/lib/dom.js");
3172
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
3173
- /**
3174
- * @license
3175
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
3176
- * This code may only be used under the BSD style license found at
3177
- * http://polymer.github.io/LICENSE.txt
3178
- * The complete set of authors may be found at
3179
- * http://polymer.github.io/AUTHORS.txt
3180
- * The complete set of contributors may be found at
3181
- * http://polymer.github.io/CONTRIBUTORS.txt
3182
- * Code distributed by Google as part of the polymer project is also
3183
- * subject to an additional IP rights grant found at
3184
- * http://polymer.github.io/PATENTS.txt
3185
- */
3186
-
3187
-
3188
- /**
3189
- * An instance of a `Template` that can be attached to the DOM and updated
3190
- * with new values.
3191
- */
3192
-
3193
- class TemplateInstance {
3194
- constructor(template, processor, options) {
3195
- this.__parts = [];
3196
- this.template = template;
3197
- this.processor = processor;
3198
- this.options = options;
3199
- }
3200
-
3201
- update(values) {
3202
- let i = 0;
3203
-
3204
- for (const part of this.__parts) {
3205
- if (part !== undefined) {
3206
- part.setValue(values[i]);
3207
- }
3208
-
3209
- i++;
3210
- }
3211
-
3212
- for (const part of this.__parts) {
3213
- if (part !== undefined) {
3214
- part.commit();
3215
- }
3216
- }
3217
- }
3218
-
3219
- _clone() {
3220
- // There are a number of steps in the lifecycle of a template instance's
3221
- // DOM fragment:
3222
- // 1. Clone - create the instance fragment
3223
- // 2. Adopt - adopt into the main document
3224
- // 3. Process - find part markers and create parts
3225
- // 4. Upgrade - upgrade custom elements
3226
- // 5. Update - set node, attribute, property, etc., values
3227
- // 6. Connect - connect to the document. Optional and outside of this
3228
- // method.
3229
- //
3230
- // We have a few constraints on the ordering of these steps:
3231
- // * We need to upgrade before updating, so that property values will pass
3232
- // through any property setters.
3233
- // * We would like to process before upgrading so that we're sure that the
3234
- // cloned fragment is inert and not disturbed by self-modifying DOM.
3235
- // * We want custom elements to upgrade even in disconnected fragments.
3236
- //
3237
- // Given these constraints, with full custom elements support we would
3238
- // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect
3239
- //
3240
- // But Safari does not implement CustomElementRegistry#upgrade, so we
3241
- // can not implement that order and still have upgrade-before-update and
3242
- // upgrade disconnected fragments. So we instead sacrifice the
3243
- // process-before-upgrade constraint, since in Custom Elements v1 elements
3244
- // must not modify their light DOM in the constructor. We still have issues
3245
- // when co-existing with CEv0 elements like Polymer 1, and with polyfills
3246
- // that don't strictly adhere to the no-modification rule because shadow
3247
- // DOM, which may be created in the constructor, is emulated by being placed
3248
- // in the light DOM.
3249
- //
3250
- // The resulting order is on native is: Clone, Adopt, Upgrade, Process,
3251
- // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade
3252
- // in one step.
3253
- //
3254
- // The Custom Elements v1 polyfill supports upgrade(), so the order when
3255
- // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,
3256
- // Connect.
3257
- const fragment = _dom_js__WEBPACK_IMPORTED_MODULE_0__.isCEPolyfill ? this.template.element.content.cloneNode(true) : document.importNode(this.template.element.content, true);
3258
- const stack = [];
3259
- const parts = this.template.parts; // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null
3260
-
3261
- const walker = document.createTreeWalker(fragment, 133
3262
- /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */
3263
- , null, false);
3264
- let partIndex = 0;
3265
- let nodeIndex = 0;
3266
- let part;
3267
- let node = walker.nextNode(); // Loop through all the nodes and parts of a template
3268
-
3269
- while (partIndex < parts.length) {
3270
- part = parts[partIndex];
3271
-
3272
- if (!(0,_template_js__WEBPACK_IMPORTED_MODULE_1__.isTemplatePartActive)(part)) {
3273
- this.__parts.push(undefined);
3274
-
3275
- partIndex++;
3276
- continue;
3277
- } // Progress the tree walker until we find our next part's node.
3278
- // Note that multiple parts may share the same node (attribute parts
3279
- // on a single element), so this loop may not run at all.
3280
-
3281
-
3282
- while (nodeIndex < part.index) {
3283
- nodeIndex++;
3284
-
3285
- if (node.nodeName === 'TEMPLATE') {
3286
- stack.push(node);
3287
- walker.currentNode = node.content;
3288
- }
3289
-
3290
- if ((node = walker.nextNode()) === null) {
3291
- // We've exhausted the content inside a nested template element.
3292
- // Because we still have parts (the outer for-loop), we know:
3293
- // - There is a template in the stack
3294
- // - The walker will find a nextNode outside the template
3295
- walker.currentNode = stack.pop();
3296
- node = walker.nextNode();
3297
- }
3298
- } // We've arrived at our part's node.
3299
-
3300
-
3301
- if (part.type === 'node') {
3302
- const part = this.processor.handleTextExpression(this.options);
3303
- part.insertAfterNode(node.previousSibling);
3304
-
3305
- this.__parts.push(part);
3306
- } else {
3307
- this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));
3308
- }
3309
-
3310
- partIndex++;
3311
- }
3312
-
3313
- if (_dom_js__WEBPACK_IMPORTED_MODULE_0__.isCEPolyfill) {
3314
- document.adoptNode(fragment);
3315
- customElements.upgrade(fragment);
3316
- }
3317
-
3318
- return fragment;
3319
- }
3320
-
3321
- }
3322
-
3323
- /***/ }),
3324
-
3325
- /***/ "./node_modules/lit-html/lib/template-result.js":
3326
- /*!******************************************************!*\
3327
- !*** ./node_modules/lit-html/lib/template-result.js ***!
3328
- \******************************************************/
3329
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
3330
-
3331
- __webpack_require__.r(__webpack_exports__);
3332
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3333
- /* harmony export */ "SVGTemplateResult": () => (/* binding */ SVGTemplateResult),
3334
- /* harmony export */ "TemplateResult": () => (/* binding */ TemplateResult)
3335
- /* harmony export */ });
3336
- /* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom.js */ "./node_modules/lit-html/lib/dom.js");
3337
- /* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./template.js */ "./node_modules/lit-html/lib/template.js");
3338
- /**
3339
- * @license
3340
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
3341
- * This code may only be used under the BSD style license found at
3342
- * http://polymer.github.io/LICENSE.txt
3343
- * The complete set of authors may be found at
3344
- * http://polymer.github.io/AUTHORS.txt
3345
- * The complete set of contributors may be found at
3346
- * http://polymer.github.io/CONTRIBUTORS.txt
3347
- * Code distributed by Google as part of the polymer project is also
3348
- * subject to an additional IP rights grant found at
3349
- * http://polymer.github.io/PATENTS.txt
3350
- */
3351
-
3352
- /**
3353
- * @module lit-html
3354
- */
3355
-
3356
-
3357
- /**
3358
- * Our TrustedTypePolicy for HTML which is declared using the html template
3359
- * tag function.
3360
- *
3361
- * That HTML is a developer-authored constant, and is parsed with innerHTML
3362
- * before any untrusted expressions have been mixed in. Therefor it is
3363
- * considered safe by construction.
3364
- */
3365
-
3366
- const policy = window.trustedTypes && trustedTypes.createPolicy('lit-html', {
3367
- createHTML: s => s
3368
- });
3369
- const commentMarker = ` ${_template_js__WEBPACK_IMPORTED_MODULE_1__.marker} `;
3370
- /**
3371
- * The return type of `html`, which holds a Template and the values from
3372
- * interpolated expressions.
3373
- */
3374
-
3375
- class TemplateResult {
3376
- constructor(strings, values, type, processor) {
3377
- this.strings = strings;
3378
- this.values = values;
3379
- this.type = type;
3380
- this.processor = processor;
3381
- }
3382
- /**
3383
- * Returns a string of HTML used to create a `<template>` element.
3384
- */
3385
-
3386
-
3387
- getHTML() {
3388
- const l = this.strings.length - 1;
3389
- let html = '';
3390
- let isCommentBinding = false;
3391
-
3392
- for (let i = 0; i < l; i++) {
3393
- const s = this.strings[i]; // For each binding we want to determine the kind of marker to insert
3394
- // into the template source before it's parsed by the browser's HTML
3395
- // parser. The marker type is based on whether the expression is in an
3396
- // attribute, text, or comment position.
3397
- // * For node-position bindings we insert a comment with the marker
3398
- // sentinel as its text content, like <!--{{lit-guid}}-->.
3399
- // * For attribute bindings we insert just the marker sentinel for the
3400
- // first binding, so that we support unquoted attribute bindings.
3401
- // Subsequent bindings can use a comment marker because multi-binding
3402
- // attributes must be quoted.
3403
- // * For comment bindings we insert just the marker sentinel so we don't
3404
- // close the comment.
3405
- //
3406
- // The following code scans the template source, but is *not* an HTML
3407
- // parser. We don't need to track the tree structure of the HTML, only
3408
- // whether a binding is inside a comment, and if not, if it appears to be
3409
- // the first binding in an attribute.
3410
-
3411
- const commentOpen = s.lastIndexOf('<!--'); // We're in comment position if we have a comment open with no following
3412
- // comment close. Because <-- can appear in an attribute value there can
3413
- // be false positives.
3414
-
3415
- isCommentBinding = (commentOpen > -1 || isCommentBinding) && s.indexOf('-->', commentOpen + 1) === -1; // Check to see if we have an attribute-like sequence preceding the
3416
- // expression. This can match "name=value" like structures in text,
3417
- // comments, and attribute values, so there can be false-positives.
3418
-
3419
- const attributeMatch = _template_js__WEBPACK_IMPORTED_MODULE_1__.lastAttributeNameRegex.exec(s);
3420
-
3421
- if (attributeMatch === null) {
3422
- // We're only in this branch if we don't have a attribute-like
3423
- // preceding sequence. For comments, this guards against unusual
3424
- // attribute values like <div foo="<!--${'bar'}">. Cases like
3425
- // <!-- foo=${'bar'}--> are handled correctly in the attribute branch
3426
- // below.
3427
- html += s + (isCommentBinding ? commentMarker : _template_js__WEBPACK_IMPORTED_MODULE_1__.nodeMarker);
3428
- } else {
3429
- // For attributes we use just a marker sentinel, and also append a
3430
- // $lit$ suffix to the name to opt-out of attribute-specific parsing
3431
- // that IE and Edge do for style and certain SVG attributes.
3432
- html += s.substr(0, attributeMatch.index) + attributeMatch[1] + attributeMatch[2] + _template_js__WEBPACK_IMPORTED_MODULE_1__.boundAttributeSuffix + attributeMatch[3] + _template_js__WEBPACK_IMPORTED_MODULE_1__.marker;
3433
- }
3434
- }
3435
-
3436
- html += this.strings[l];
3437
- return html;
3438
- }
3439
-
3440
- getTemplateElement() {
3441
- const template = document.createElement('template');
3442
- let value = this.getHTML();
3443
-
3444
- if (policy !== undefined) {
3445
- // this is secure because `this.strings` is a TemplateStringsArray.
3446
- // TODO: validate this when
3447
- // https://github.com/tc39/proposal-array-is-template-object is
3448
- // implemented.
3449
- value = policy.createHTML(value);
3450
- }
3451
-
3452
- template.innerHTML = value;
3453
- return template;
3454
- }
3455
-
3456
- }
3457
- /**
3458
- * A TemplateResult for SVG fragments.
3459
- *
3460
- * This class wraps HTML in an `<svg>` tag in order to parse its contents in the
3461
- * SVG namespace, then modifies the template to remove the `<svg>` tag so that
3462
- * clones only container the original fragment.
3463
- */
3464
-
3465
- class SVGTemplateResult extends TemplateResult {
3466
- getHTML() {
3467
- return `<svg>${super.getHTML()}</svg>`;
3468
- }
3469
-
3470
- getTemplateElement() {
3471
- const template = super.getTemplateElement();
3472
- const content = template.content;
3473
- const svgElement = content.firstChild;
3474
- content.removeChild(svgElement);
3475
- (0,_dom_js__WEBPACK_IMPORTED_MODULE_0__.reparentNodes)(content, svgElement.firstChild);
3476
- return template;
3477
- }
3478
-
3479
- }
3480
-
3481
- /***/ }),
3482
-
3483
- /***/ "./node_modules/lit-html/lib/template.js":
3484
- /*!***********************************************!*\
3485
- !*** ./node_modules/lit-html/lib/template.js ***!
3486
- \***********************************************/
3487
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
3488
-
3489
- __webpack_require__.r(__webpack_exports__);
3490
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3491
- /* harmony export */ "Template": () => (/* binding */ Template),
3492
- /* harmony export */ "boundAttributeSuffix": () => (/* binding */ boundAttributeSuffix),
3493
- /* harmony export */ "createMarker": () => (/* binding */ createMarker),
3494
- /* harmony export */ "isTemplatePartActive": () => (/* binding */ isTemplatePartActive),
3495
- /* harmony export */ "lastAttributeNameRegex": () => (/* binding */ lastAttributeNameRegex),
3496
- /* harmony export */ "marker": () => (/* binding */ marker),
3497
- /* harmony export */ "markerRegex": () => (/* binding */ markerRegex),
3498
- /* harmony export */ "nodeMarker": () => (/* binding */ nodeMarker)
3499
- /* harmony export */ });
3500
- /**
3501
- * @license
3502
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
3503
- * This code may only be used under the BSD style license found at
3504
- * http://polymer.github.io/LICENSE.txt
3505
- * The complete set of authors may be found at
3506
- * http://polymer.github.io/AUTHORS.txt
3507
- * The complete set of contributors may be found at
3508
- * http://polymer.github.io/CONTRIBUTORS.txt
3509
- * Code distributed by Google as part of the polymer project is also
3510
- * subject to an additional IP rights grant found at
3511
- * http://polymer.github.io/PATENTS.txt
3512
- */
3513
-
3514
- /**
3515
- * An expression marker with embedded unique key to avoid collision with
3516
- * possible text in templates.
3517
- */
3518
- const marker = `{{lit-${String(Math.random()).slice(2)}}}`;
3519
- /**
3520
- * An expression marker used text-positions, multi-binding attributes, and
3521
- * attributes with markup-like text values.
3522
- */
3523
-
3524
- const nodeMarker = `<!--${marker}-->`;
3525
- const markerRegex = new RegExp(`${marker}|${nodeMarker}`);
3526
- /**
3527
- * Suffix appended to all bound attribute names.
3528
- */
3529
-
3530
- const boundAttributeSuffix = '$lit$';
3531
- /**
3532
- * An updatable Template that tracks the location of dynamic parts.
3533
- */
3534
-
3535
- class Template {
3536
- constructor(result, element) {
3537
- this.parts = [];
3538
- this.element = element;
3539
- const nodesToRemove = [];
3540
- const stack = []; // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null
3541
-
3542
- const walker = document.createTreeWalker(element.content, 133
3543
- /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */
3544
- , null, false); // Keeps track of the last index associated with a part. We try to delete
3545
- // unnecessary nodes, but we never want to associate two different parts
3546
- // to the same index. They must have a constant node between.
3547
-
3548
- let lastPartIndex = 0;
3549
- let index = -1;
3550
- let partIndex = 0;
3551
- const {
3552
- strings,
3553
- values: {
3554
- length
3555
- }
3556
- } = result;
3557
-
3558
- while (partIndex < length) {
3559
- const node = walker.nextNode();
3560
-
3561
- if (node === null) {
3562
- // We've exhausted the content inside a nested template element.
3563
- // Because we still have parts (the outer for-loop), we know:
3564
- // - There is a template in the stack
3565
- // - The walker will find a nextNode outside the template
3566
- walker.currentNode = stack.pop();
3567
- continue;
3568
- }
3569
-
3570
- index++;
3571
-
3572
- if (node.nodeType === 1
3573
- /* Node.ELEMENT_NODE */
3574
- ) {
3575
- if (node.hasAttributes()) {
3576
- const attributes = node.attributes;
3577
- const {
3578
- length
3579
- } = attributes; // Per
3580
- // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,
3581
- // attributes are not guaranteed to be returned in document order.
3582
- // In particular, Edge/IE can return them out of order, so we cannot
3583
- // assume a correspondence between part index and attribute index.
3584
-
3585
- let count = 0;
3586
-
3587
- for (let i = 0; i < length; i++) {
3588
- if (endsWith(attributes[i].name, boundAttributeSuffix)) {
3589
- count++;
3590
- }
3591
- }
3592
-
3593
- while (count-- > 0) {
3594
- // Get the template literal section leading up to the first
3595
- // expression in this attribute
3596
- const stringForPart = strings[partIndex]; // Find the attribute name
3597
-
3598
- const name = lastAttributeNameRegex.exec(stringForPart)[2]; // Find the corresponding attribute
3599
- // All bound attributes have had a suffix added in
3600
- // TemplateResult#getHTML to opt out of special attribute
3601
- // handling. To look up the attribute value we also need to add
3602
- // the suffix.
3603
-
3604
- const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;
3605
- const attributeValue = node.getAttribute(attributeLookupName);
3606
- node.removeAttribute(attributeLookupName);
3607
- const statics = attributeValue.split(markerRegex);
3608
- this.parts.push({
3609
- type: 'attribute',
3610
- index,
3611
- name,
3612
- strings: statics
3613
- });
3614
- partIndex += statics.length - 1;
3615
- }
3616
- }
3617
-
3618
- if (node.tagName === 'TEMPLATE') {
3619
- stack.push(node);
3620
- walker.currentNode = node.content;
3621
- }
3622
- } else if (node.nodeType === 3
3623
- /* Node.TEXT_NODE */
3624
- ) {
3625
- const data = node.data;
3626
-
3627
- if (data.indexOf(marker) >= 0) {
3628
- const parent = node.parentNode;
3629
- const strings = data.split(markerRegex);
3630
- const lastIndex = strings.length - 1; // Generate a new text node for each literal section
3631
- // These nodes are also used as the markers for node parts
3632
-
3633
- for (let i = 0; i < lastIndex; i++) {
3634
- let insert;
3635
- let s = strings[i];
3636
-
3637
- if (s === '') {
3638
- insert = createMarker();
3639
- } else {
3640
- const match = lastAttributeNameRegex.exec(s);
3641
-
3642
- if (match !== null && endsWith(match[2], boundAttributeSuffix)) {
3643
- s = s.slice(0, match.index) + match[1] + match[2].slice(0, -boundAttributeSuffix.length) + match[3];
3644
- }
3645
-
3646
- insert = document.createTextNode(s);
3647
- }
3648
-
3649
- parent.insertBefore(insert, node);
3650
- this.parts.push({
3651
- type: 'node',
3652
- index: ++index
3653
- });
3654
- } // If there's no text, we must insert a comment to mark our place.
3655
- // Else, we can trust it will stick around after cloning.
3656
-
3657
-
3658
- if (strings[lastIndex] === '') {
3659
- parent.insertBefore(createMarker(), node);
3660
- nodesToRemove.push(node);
3661
- } else {
3662
- node.data = strings[lastIndex];
3663
- } // We have a part for each match found
3664
-
3665
-
3666
- partIndex += lastIndex;
3667
- }
3668
- } else if (node.nodeType === 8
3669
- /* Node.COMMENT_NODE */
3670
- ) {
3671
- if (node.data === marker) {
3672
- const parent = node.parentNode; // Add a new marker node to be the startNode of the Part if any of
3673
- // the following are true:
3674
- // * We don't have a previousSibling
3675
- // * The previousSibling is already the start of a previous part
3676
-
3677
- if (node.previousSibling === null || index === lastPartIndex) {
3678
- index++;
3679
- parent.insertBefore(createMarker(), node);
3680
- }
3681
-
3682
- lastPartIndex = index;
3683
- this.parts.push({
3684
- type: 'node',
3685
- index
3686
- }); // If we don't have a nextSibling, keep this node so we have an end.
3687
- // Else, we can remove it to save future costs.
3688
-
3689
- if (node.nextSibling === null) {
3690
- node.data = '';
3691
- } else {
3692
- nodesToRemove.push(node);
3693
- index--;
3694
- }
3695
-
3696
- partIndex++;
3697
- } else {
3698
- let i = -1;
3699
-
3700
- while ((i = node.data.indexOf(marker, i + 1)) !== -1) {
3701
- // Comment node has a binding marker inside, make an inactive part
3702
- // The binding won't work, but subsequent bindings will
3703
- // TODO (justinfagnani): consider whether it's even worth it to
3704
- // make bindings in comments work
3705
- this.parts.push({
3706
- type: 'node',
3707
- index: -1
3708
- });
3709
- partIndex++;
3710
- }
3711
- }
3712
- }
3713
- } // Remove text binding nodes after the walk to not disturb the TreeWalker
3714
-
3715
-
3716
- for (const n of nodesToRemove) {
3717
- n.parentNode.removeChild(n);
3718
- }
3719
- }
3720
-
3721
- }
3722
-
3723
- const endsWith = (str, suffix) => {
3724
- const index = str.length - suffix.length;
3725
- return index >= 0 && str.slice(index) === suffix;
3726
- };
3727
-
3728
- const isTemplatePartActive = part => part.index !== -1; // Allows `document.createComment('')` to be renamed for a
3729
- // small manual size-savings.
3730
-
3731
- const createMarker = () => document.createComment('');
3732
- /**
3733
- * This regex extracts the attribute name preceding an attribute-position
3734
- * expression. It does this by matching the syntax allowed for attributes
3735
- * against the string literal directly preceding the expression, assuming that
3736
- * the expression is in an attribute-value position.
3737
- *
3738
- * See attributes in the HTML spec:
3739
- * https://www.w3.org/TR/html5/syntax.html#elements-attributes
3740
- *
3741
- * " \x09\x0a\x0c\x0d" are HTML space characters:
3742
- * https://www.w3.org/TR/html5/infrastructure.html#space-characters
3743
- *
3744
- * "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every
3745
- * space character except " ".
3746
- *
3747
- * So an attribute is:
3748
- * * The name: any character except a control character, space character, ('),
3749
- * ("), ">", "=", or "/"
3750
- * * Followed by zero or more space characters
3751
- * * Followed by "="
3752
- * * Followed by zero or more space characters
3753
- * * Followed by:
3754
- * * Any character except space, ('), ("), "<", ">", "=", (`), or
3755
- * * (") then any non-("), or
3756
- * * (') then any non-(')
3757
- */
3758
-
3759
- const lastAttributeNameRegex = // eslint-disable-next-line no-control-regex
3760
- /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
3761
-
3762
- /***/ }),
3763
-
3764
- /***/ "./node_modules/lit-html/lit-html.js":
3765
- /*!*******************************************!*\
3766
- !*** ./node_modules/lit-html/lit-html.js ***!
3767
- \*******************************************/
3768
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
3769
-
3770
- __webpack_require__.r(__webpack_exports__);
3771
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3772
- /* harmony export */ "AttributeCommitter": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.AttributeCommitter),
3773
- /* harmony export */ "AttributePart": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.AttributePart),
3774
- /* harmony export */ "BooleanAttributePart": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.BooleanAttributePart),
3775
- /* harmony export */ "DefaultTemplateProcessor": () => (/* reexport safe */ _lib_default_template_processor_js__WEBPACK_IMPORTED_MODULE_0__.DefaultTemplateProcessor),
3776
- /* harmony export */ "EventPart": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.EventPart),
3777
- /* harmony export */ "NodePart": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.NodePart),
3778
- /* harmony export */ "PropertyCommitter": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.PropertyCommitter),
3779
- /* harmony export */ "PropertyPart": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.PropertyPart),
3780
- /* harmony export */ "SVGTemplateResult": () => (/* reexport safe */ _lib_template_result_js__WEBPACK_IMPORTED_MODULE_1__.SVGTemplateResult),
3781
- /* harmony export */ "Template": () => (/* reexport safe */ _lib_template_js__WEBPACK_IMPORTED_MODULE_9__.Template),
3782
- /* harmony export */ "TemplateInstance": () => (/* reexport safe */ _lib_template_instance_js__WEBPACK_IMPORTED_MODULE_8__.TemplateInstance),
3783
- /* harmony export */ "TemplateResult": () => (/* reexport safe */ _lib_template_result_js__WEBPACK_IMPORTED_MODULE_1__.TemplateResult),
3784
- /* harmony export */ "createMarker": () => (/* reexport safe */ _lib_template_js__WEBPACK_IMPORTED_MODULE_9__.createMarker),
3785
- /* harmony export */ "defaultTemplateProcessor": () => (/* reexport safe */ _lib_default_template_processor_js__WEBPACK_IMPORTED_MODULE_0__.defaultTemplateProcessor),
3786
- /* harmony export */ "directive": () => (/* reexport safe */ _lib_directive_js__WEBPACK_IMPORTED_MODULE_2__.directive),
3787
- /* harmony export */ "html": () => (/* binding */ html),
3788
- /* harmony export */ "isDirective": () => (/* reexport safe */ _lib_directive_js__WEBPACK_IMPORTED_MODULE_2__.isDirective),
3789
- /* harmony export */ "isIterable": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.isIterable),
3790
- /* harmony export */ "isPrimitive": () => (/* reexport safe */ _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__.isPrimitive),
3791
- /* harmony export */ "isTemplatePartActive": () => (/* reexport safe */ _lib_template_js__WEBPACK_IMPORTED_MODULE_9__.isTemplatePartActive),
3792
- /* harmony export */ "noChange": () => (/* reexport safe */ _lib_part_js__WEBPACK_IMPORTED_MODULE_4__.noChange),
3793
- /* harmony export */ "nothing": () => (/* reexport safe */ _lib_part_js__WEBPACK_IMPORTED_MODULE_4__.nothing),
3794
- /* harmony export */ "parts": () => (/* reexport safe */ _lib_render_js__WEBPACK_IMPORTED_MODULE_6__.parts),
3795
- /* harmony export */ "removeNodes": () => (/* reexport safe */ _lib_dom_js__WEBPACK_IMPORTED_MODULE_3__.removeNodes),
3796
- /* harmony export */ "render": () => (/* reexport safe */ _lib_render_js__WEBPACK_IMPORTED_MODULE_6__.render),
3797
- /* harmony export */ "reparentNodes": () => (/* reexport safe */ _lib_dom_js__WEBPACK_IMPORTED_MODULE_3__.reparentNodes),
3798
- /* harmony export */ "svg": () => (/* binding */ svg),
3799
- /* harmony export */ "templateCaches": () => (/* reexport safe */ _lib_template_factory_js__WEBPACK_IMPORTED_MODULE_7__.templateCaches),
3800
- /* harmony export */ "templateFactory": () => (/* reexport safe */ _lib_template_factory_js__WEBPACK_IMPORTED_MODULE_7__.templateFactory)
3801
- /* harmony export */ });
3802
- /* harmony import */ var _lib_default_template_processor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/default-template-processor.js */ "./node_modules/lit-html/lib/default-template-processor.js");
3803
- /* harmony import */ var _lib_template_result_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/template-result.js */ "./node_modules/lit-html/lib/template-result.js");
3804
- /* harmony import */ var _lib_directive_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/directive.js */ "./node_modules/lit-html/lib/directive.js");
3805
- /* harmony import */ var _lib_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/dom.js */ "./node_modules/lit-html/lib/dom.js");
3806
- /* harmony import */ var _lib_part_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/part.js */ "./node_modules/lit-html/lib/part.js");
3807
- /* harmony import */ var _lib_parts_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/parts.js */ "./node_modules/lit-html/lib/parts.js");
3808
- /* harmony import */ var _lib_render_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/render.js */ "./node_modules/lit-html/lib/render.js");
3809
- /* harmony import */ var _lib_template_factory_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/template-factory.js */ "./node_modules/lit-html/lib/template-factory.js");
3810
- /* harmony import */ var _lib_template_instance_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/template-instance.js */ "./node_modules/lit-html/lib/template-instance.js");
3811
- /* harmony import */ var _lib_template_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/template.js */ "./node_modules/lit-html/lib/template.js");
3812
- /**
3813
- * @license
3814
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
3815
- * This code may only be used under the BSD style license found at
3816
- * http://polymer.github.io/LICENSE.txt
3817
- * The complete set of authors may be found at
3818
- * http://polymer.github.io/AUTHORS.txt
3819
- * The complete set of contributors may be found at
3820
- * http://polymer.github.io/CONTRIBUTORS.txt
3821
- * Code distributed by Google as part of the polymer project is also
3822
- * subject to an additional IP rights grant found at
3823
- * http://polymer.github.io/PATENTS.txt
3824
- */
3825
-
3826
- /**
3827
- *
3828
- * Main lit-html module.
3829
- *
3830
- * Main exports:
3831
- *
3832
- * - [[html]]
3833
- * - [[svg]]
3834
- * - [[render]]
3835
- *
3836
- * @packageDocumentation
3837
- */
3838
-
3839
- /**
3840
- * Do not remove this comment; it keeps typedoc from misplacing the module
3841
- * docs.
3842
- */
3843
-
3844
-
3845
-
3846
- // TODO(justinfagnani): remove line when we get NodePart moving methods
3847
-
3848
-
3849
-
3850
-
3851
-
3852
-
3853
-
3854
-
3855
- // IMPORTANT: do not change the property name or the assignment expression.
3856
- // This line will be used in regexes to search for lit-html usage.
3857
- // TODO(justinfagnani): inject version number at build time
3858
-
3859
- if (typeof window !== 'undefined') {
3860
- (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.4.1');
3861
- }
3862
- /**
3863
- * Interprets a template literal as an HTML template that can efficiently
3864
- * render to and update a container.
3865
- */
3866
-
3867
-
3868
- const html = (strings, ...values) => new _lib_template_result_js__WEBPACK_IMPORTED_MODULE_1__.TemplateResult(strings, values, 'html', _lib_default_template_processor_js__WEBPACK_IMPORTED_MODULE_0__.defaultTemplateProcessor);
3869
- /**
3870
- * Interprets a template literal as an SVG template that can efficiently
3871
- * render to and update a container.
3872
- */
3873
-
3874
- const svg = (strings, ...values) => new _lib_template_result_js__WEBPACK_IMPORTED_MODULE_1__.SVGTemplateResult(strings, values, 'svg', _lib_default_template_processor_js__WEBPACK_IMPORTED_MODULE_0__.defaultTemplateProcessor);
3875
-
3876
- /***/ })
3877
-
3878
- /******/ });
3879
- /************************************************************************/
3880
- /******/ // The module cache
3881
- /******/ var __webpack_module_cache__ = {};
3882
- /******/
3883
- /******/ // The require function
3884
- /******/ function __webpack_require__(moduleId) {
3885
- /******/ // Check if module is in cache
3886
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
3887
- /******/ if (cachedModule !== undefined) {
3888
- /******/ return cachedModule.exports;
3889
- /******/ }
3890
- /******/ // Create a new module (and put it into the cache)
3891
- /******/ var module = __webpack_module_cache__[moduleId] = {
3892
- /******/ // no module.id needed
3893
- /******/ // no module.loaded needed
3894
- /******/ exports: {}
3895
- /******/ };
3896
- /******/
3897
- /******/ // Execute the module function
3898
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
3899
- /******/
3900
- /******/ // Return the exports of the module
3901
- /******/ return module.exports;
3902
- /******/ }
3903
- /******/
3904
- /************************************************************************/
3905
- /******/ /* webpack/runtime/define property getters */
3906
- /******/ (() => {
3907
- /******/ // define getter functions for harmony exports
3908
- /******/ __webpack_require__.d = (exports, definition) => {
3909
- /******/ for(var key in definition) {
3910
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
3911
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
3912
- /******/ }
3913
- /******/ }
3914
- /******/ };
3915
- /******/ })();
3916
- /******/
3917
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
3918
- /******/ (() => {
3919
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
3920
- /******/ })();
3921
- /******/
3922
- /******/ /* webpack/runtime/make namespace object */
3923
- /******/ (() => {
3924
- /******/ // define __esModule on exports
3925
- /******/ __webpack_require__.r = (exports) => {
3926
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
3927
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3928
- /******/ }
3929
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
3930
- /******/ };
3931
- /******/ })();
3932
- /******/
3933
- /************************************************************************/
3934
- var __webpack_exports__ = {};
3935
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
3936
- (() => {
3937
- /*!************************************!*\
3938
- !*** ./src/web-component/index.js ***!
3939
- \************************************/
3940
- __webpack_require__.r(__webpack_exports__);
3941
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3942
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
3943
- /* harmony export */ });
3944
- /* harmony import */ var lit_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit-element */ "./node_modules/lit-element/lit-element.js");
3945
-
3946
-
3947
- class PdbeMolstar extends lit_element__WEBPACK_IMPORTED_MODULE_0__.LitElement {
3948
- static get properties() {
3949
- return {
3950
- moleculeId: {
3951
- type: String,
3952
- attribute: 'molecule-id'
3953
- },
3954
- assemblyId: {
3955
- type: String,
3956
- attribute: 'assembly-id'
3957
- },
3958
- customDataUrl: {
3959
- type: String,
3960
- attribute: 'custom-data-url'
3961
- },
3962
- customDataFormat: {
3963
- type: String,
3964
- attribute: 'custom-data-format'
3965
- },
3966
- customDataBinary: {
3967
- type: Boolean,
3968
- attribute: 'custom-data-binary'
3969
- },
3970
- ligandLabelCompId: {
3971
- type: String,
3972
- attribute: 'ligand-label-comp-id'
3973
- },
3974
- ligandAuthAsymId: {
3975
- type: String,
3976
- attribute: 'ligand-auth-asym-Id'
3977
- },
3978
- ligandAuthSeqId: {
3979
- type: String,
3980
- attribute: 'ligand-auth-seq-id'
3981
- },
3982
- ligandHydrogens: {
3983
- type: Boolean,
3984
- attribute: 'ligand-hydrogens'
3985
- },
3986
- pdbeUrl: {
3987
- type: String,
3988
- attribute: 'pdbe-url'
3989
- },
3990
- bgColorR: {
3991
- type: Number,
3992
- attribute: 'bg-color-r'
3993
- },
3994
- bgColorG: {
3995
- type: Number,
3996
- attribute: 'bg-color-g'
3997
- },
3998
- bgColorB: {
3999
- type: Number,
4000
- attribute: 'bg-color-b'
4001
- },
4002
- loadMaps: {
4003
- type: Boolean,
4004
- attribute: 'load-maps'
4005
- },
4006
- validationAnnotation: {
4007
- type: Boolean,
4008
- attribute: 'validation-annotation'
4009
- },
4010
- domainAnnotation: {
4011
- type: Boolean,
4012
- attribute: 'domain-annotation'
4013
- },
4014
- lowPrecisionCoords: {
4015
- type: Boolean,
4016
- attribute: 'low-precision'
4017
- },
4018
- expanded: {
4019
- type: Boolean,
4020
- attribute: 'expanded'
4021
- },
4022
- hideControls: {
4023
- type: Boolean,
4024
- attribute: 'hide-controls'
4025
- },
4026
- subscribeEvents: {
4027
- type: Boolean,
4028
- attribute: 'subscribe-events'
4029
- },
4030
- pdbeLink: {
4031
- type: Boolean,
4032
- attribute: 'pdbe-link'
4033
- },
4034
- loadCartoonsOnly: {
4035
- type: Boolean,
4036
- attribute: 'load-cartoons-only'
4037
- },
4038
- selectInteraction: {
4039
- type: Boolean,
4040
- attribute: 'select-interaction'
4041
- },
4042
- landscape: {
4043
- type: Boolean,
4044
- attribute: 'landscape'
4045
- },
4046
- highlightColorR: {
4047
- type: Number,
4048
- attribute: 'highlight-color-r'
4049
- },
4050
- highlightColorG: {
4051
- type: Number,
4052
- attribute: 'highlight-color-g'
4053
- },
4054
- highlightColorB: {
4055
- type: Number,
4056
- attribute: 'highlight-color-b'
4057
- },
4058
- selectColorR: {
4059
- type: Number,
4060
- attribute: 'select-color-r'
4061
- },
4062
- selectColorG: {
4063
- type: Number,
4064
- attribute: 'select-color-g'
4065
- },
4066
- selectColorB: {
4067
- type: Number,
4068
- attribute: 'select-color-b'
4069
- },
4070
- hidePolymer: {
4071
- type: Boolean,
4072
- attribute: 'hide-polymer'
4073
- },
4074
- hideWater: {
4075
- type: Boolean,
4076
- attribute: 'hide-water'
4077
- },
4078
- hideHet: {
4079
- type: Boolean,
4080
- attribute: 'hide-het'
4081
- },
4082
- hideCarbs: {
4083
- type: Boolean,
4084
- attribute: 'hide-carbs'
4085
- },
4086
- hideNonStandard: {
4087
- type: Boolean,
4088
- attribute: 'hide-non-standard'
4089
- },
4090
- hideCoarse: {
4091
- type: Boolean,
4092
- attribute: 'hide-coarse'
4093
- },
4094
- visualStyle: {
4095
- type: String,
4096
- attribute: 'visual-style'
4097
- },
4098
- hideExpandIcon: {
4099
- type: Boolean,
4100
- attribute: 'hide-expand-icon'
4101
- },
4102
- hideSelectionIcon: {
4103
- type: Boolean,
4104
- attribute: 'hide-selection-icon'
4105
- },
4106
- hideAnimationIcon: {
4107
- type: Boolean,
4108
- attribute: 'hide-animation-icon'
4109
- },
4110
- hideControlToggleIcon: {
4111
- type: Boolean,
4112
- attribute: 'hide-control-toggle-icon'
4113
- },
4114
- hideControlInfoIcon: {
4115
- type: Boolean,
4116
- attribute: 'hide-control-info-icon'
4117
- },
4118
- alphafoldView: {
4119
- type: Boolean,
4120
- attribute: 'alphafold-view'
4121
- },
4122
- lighting: {
4123
- type: String,
4124
- attribute: 'lighting'
4125
- },
4126
- defaultPreset: {
4127
- type: String,
4128
- attribute: 'default-preset'
4129
- },
4130
- sequencePanel: {
4131
- type: Boolean,
4132
- attribute: 'sequence-panel'
4133
- }
4134
- };
4135
- }
4136
-
4137
- validateParams() {
4138
- if (!this.moleculeId && !this.customDataUrl) return false;
4139
- if (this.customDataUrl && !this.customDataFormat) return false;
4140
- return true;
4141
- }
4142
-
4143
- formatParam(propName) {
4144
- //ligand params mapping
4145
- const ligandParamsMap = {
4146
- 'ligandLabelCompId': 'label_comp_id',
4147
- 'ligandAuthAsymId': 'auth_asym_id',
4148
- 'ligandAuthSeqId': 'auth_seq_id',
4149
- 'ligandHydrogens': 'hydrogens'
4150
- };
4151
- const ligandParams = Object.keys(ligandParamsMap); //hidestructure params
4152
-
4153
- const hideStructParamsMap = {
4154
- 'hidePolymer': 'polymer',
4155
- 'hideWater': 'water',
4156
- 'hideHet': 'het',
4157
- 'hideCarbs': 'carbs',
4158
- 'hideNonStandard': 'nonStandard',
4159
- 'hideCoarse': 'coarse'
4160
- };
4161
- const hideStructParams = Object.keys(hideStructParamsMap); //hideCanvasControls params
4162
-
4163
- const hideIconsParamsMap = {
4164
- 'hideExpandIcon': 'expand',
4165
- 'hideSelectionIcon': 'selection',
4166
- 'hideAnimationIcon': 'animation',
4167
- 'hideControlToggleIcon': 'controlToggle',
4168
- 'hideControlInfoIcon': 'controlInfo'
4169
- };
4170
- const hideIconsParams = Object.keys(hideIconsParamsMap);
4171
-
4172
- if (propName == 'customDataUrl' || propName == 'customDataFormat') {
4173
- if (this.initParams.customData) return;
4174
- this.initParams.customData = {
4175
- url: this.customDataUrl,
4176
- format: this.customDataFormat
4177
- };
4178
- } else if (ligandParams.indexOf(propName) > -1) {
4179
- if (this.initParams.ligandView) return;
4180
- this.initParams.ligandView = Object.assign({}, {});
4181
- ligandParams.forEach(ligandParam => {
4182
- if (this[ligandParam]) {
4183
- this.initParams.ligandView[ligandParamsMap[ligandParam]] = this[ligandParam];
4184
- }
4185
- });
4186
- } else if (['highlightColorR', 'highlightColorG', 'highlightColorB'].indexOf(propName) > -1 && this.highlightColorR && this.highlightColorG && this.highlightColorB) {
4187
- this.initParams.highlightColor = {
4188
- r: this.highlightColorR,
4189
- g: this.highlightColorG,
4190
- b: this.highlightColorB
4191
- };
4192
- } else if (['selectColorR', 'selectColorG', 'selectColorB'].indexOf(propName) > -1 && this.selectColorR && this.selectColorG && this.selectColorB) {
4193
- this.initParams.selectColor = {
4194
- r: this.selectColorR,
4195
- g: this.selectColorG,
4196
- b: this.selectColorB
4197
- };
4198
- } else if (['bgColorR', 'bgColorG', 'bgColorB'].indexOf(propName) > -1 && this.bgColorR && this.bgColorG && this.bgColorB) {
4199
- this.initParams.bgColor = {
4200
- r: this.bgColorR,
4201
- g: this.bgColorG,
4202
- b: this.bgColorB
4203
- };
4204
- } else if (hideStructParams.indexOf(propName) > -1) {
4205
- if (this.initParams.hideStructure) return;
4206
- this.initParams.hideStructure = [];
4207
- hideStructParams.forEach(hideStructParam => {
4208
- if (this[hideStructParam]) {
4209
- this.initParams.hideStructure.push(hideStructParamsMap[hideStructParam]);
4210
- }
4211
- });
4212
- } else if (hideIconsParams.indexOf(propName) > -1) {
4213
- if (this.initParams.hideCanvasControls) return;
4214
- this.initParams.hideCanvasControls = [];
4215
- hideIconsParams.forEach(hideIconsParam => {
4216
- if (this[hideIconsParam]) {
4217
- this.initParams.hideCanvasControls.push(hideIconsParamsMap[hideIconsParam]);
4218
- }
4219
- });
4220
- }
4221
- }
4222
-
4223
- createParamModel() {
4224
- const specialProps = ['customDataUrl', 'customDataFormat', 'ligandLabelCompId', 'bgColorR', 'bgColorG', 'bgColorB', 'ligandAuthAsymId', 'ligandAuthSeqId', 'ligandHydrogens', 'highlightColorR', 'highlightColorG', 'highlightColorB', 'selectColorR', 'selectColorG', 'selectColorB', 'hidePolymer', 'hideWater', 'hideHet', 'hideCarbs', 'hideNonStandard', 'hideCoarse', 'hideExpandIcon', 'hideSelectionIcon', 'hideAnimationIcon', 'hideControlToggleIcon', 'hideControlInfoIcon'];
4225
- const componentProps = this.constructor['properties'];
4226
-
4227
- if (componentProps) {
4228
- for (let propName in componentProps) {
4229
- if (this[propName]) {
4230
- if (!this.initParams) this.initParams = Object.assign({}, {});
4231
-
4232
- if (specialProps.indexOf(propName) == -1) {
4233
- this.initParams[propName] = this[propName];
4234
- } else {
4235
- this.formatParam(propName);
4236
- }
4237
- }
4238
- }
4239
- }
4240
- }
4241
-
4242
- connectedCallback() {
4243
- super.connectedCallback();
4244
- this.createParamModel(); // create an instance of the plugin
4245
-
4246
- this.viewerInstance = new PDBeMolstarPlugin();
4247
- let paramValidatity = this.validateParams();
4248
- if (!paramValidatity) return;
4249
- if (this.initParams) this.viewerInstance.render(this, this.initParams);
4250
- } // render() {
4251
- // return html`
4252
- // <div>Loading!</div>
4253
- // `}
4254
-
4255
-
4256
- createRenderRoot() {
4257
- return this;
4258
- }
4259
-
4260
- }
4261
-
4262
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PdbeMolstar);
4263
- customElements.define('pdbe-molstar', PdbeMolstar);
4264
- })();
4265
-
4266
- /******/ })()
4267
- ;
4268
- //# sourceMappingURL=drugflow-molstar-component-build-0.1.2.js.map