@govbr-ds/webcomponents 2.0.0-next.17 → 2.0.0-next.19

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 (388) hide show
  1. package/README.md +43 -11
  2. package/dist/cjs/app-globals-77a217c6.js +11 -0
  3. package/dist/cjs/app-globals-77a217c6.js.map +1 -0
  4. package/dist/cjs/br-avatar.cjs.entry.js +18 -68
  5. package/dist/cjs/br-avatar.cjs.entry.js.map +1 -1
  6. package/dist/cjs/br-button_2.cjs.entry.js +13 -93
  7. package/dist/cjs/br-button_2.cjs.entry.js.map +1 -1
  8. package/dist/cjs/br-checkbox.cjs.entry.js +11 -61
  9. package/dist/cjs/br-checkbox.cjs.entry.js.map +1 -1
  10. package/dist/cjs/br-dropdown.cjs.entry.js +8 -50
  11. package/dist/cjs/br-dropdown.cjs.entry.js.map +1 -1
  12. package/dist/cjs/br-input.cjs.entry.js +18 -67
  13. package/dist/cjs/br-input.cjs.entry.js.map +1 -1
  14. package/dist/cjs/br-item.cjs.entry.js +9 -53
  15. package/dist/cjs/br-item.cjs.entry.js.map +1 -1
  16. package/dist/cjs/br-list.cjs.entry.js +12 -56
  17. package/dist/cjs/br-list.cjs.entry.js.map +1 -1
  18. package/dist/cjs/br-loading.cjs.entry.js +10 -40
  19. package/dist/cjs/br-loading.cjs.entry.js.map +1 -1
  20. package/dist/cjs/br-message.cjs.entry.js +10 -40
  21. package/dist/cjs/br-message.cjs.entry.js.map +1 -1
  22. package/dist/cjs/br-radio.cjs.entry.js +13 -88
  23. package/dist/cjs/br-radio.cjs.entry.js.map +1 -1
  24. package/dist/cjs/br-switch.cjs.entry.js +13 -68
  25. package/dist/cjs/br-switch.cjs.entry.js.map +1 -1
  26. package/dist/cjs/br-textarea.cjs.entry.js +41 -97
  27. package/dist/cjs/br-textarea.cjs.entry.js.map +1 -1
  28. package/dist/cjs/br-upload.cjs.entry.js +168 -0
  29. package/dist/cjs/br-upload.cjs.entry.js.map +1 -0
  30. package/dist/cjs/{index-a1cc4aa4.js → index-81c11ce2.js} +149 -5
  31. package/dist/cjs/index-81c11ce2.js.map +1 -0
  32. package/dist/cjs/index.cjs.js +4 -0
  33. package/dist/cjs/index.cjs.js.map +1 -1
  34. package/dist/cjs/{inherited-attributes-61a2aff9.js → inherited-attributes-16f7d388.js} +5 -1
  35. package/dist/cjs/inherited-attributes-16f7d388.js.map +1 -0
  36. package/dist/cjs/loader.cjs.js +7 -3
  37. package/dist/cjs/loader.cjs.js.map +1 -1
  38. package/dist/cjs/{v4-c23234d2.js → v4-2a0fe526.js} +5 -1
  39. package/dist/cjs/v4-2a0fe526.js.map +1 -0
  40. package/dist/cjs/webcomponents.cjs.js +29 -4
  41. package/dist/cjs/webcomponents.cjs.js.map +1 -1
  42. package/dist/collection/collection-manifest.json +4 -3
  43. package/dist/collection/components/avatar/avatar.css +12 -0
  44. package/dist/collection/components/avatar/avatar.js +53 -187
  45. package/dist/collection/components/avatar/avatar.js.map +1 -1
  46. package/dist/collection/components/button/button.css +12 -35
  47. package/dist/collection/components/button/button.js +10 -257
  48. package/dist/collection/components/button/button.js.map +1 -1
  49. package/dist/collection/components/checkbox/checkbox.css +12 -0
  50. package/dist/collection/components/checkbox/checkbox.js +13 -262
  51. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  52. package/dist/collection/components/dropdown/dropdown.css +12 -0
  53. package/dist/collection/components/dropdown/dropdown.js +5 -246
  54. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  55. package/dist/collection/components/icon/icon.css +12 -0
  56. package/dist/collection/components/icon/icon.js +9 -168
  57. package/dist/collection/components/icon/icon.js.map +1 -1
  58. package/dist/collection/components/input/input.css +12 -0
  59. package/dist/collection/components/input/input.js +26 -329
  60. package/dist/collection/components/input/input.js.map +1 -1
  61. package/dist/collection/components/item/item.css +12 -0
  62. package/dist/collection/components/item/item.js +11 -253
  63. package/dist/collection/components/item/item.js.map +1 -1
  64. package/dist/collection/components/list/list.css +12 -0
  65. package/dist/collection/components/list/list.js +12 -258
  66. package/dist/collection/components/list/list.js.map +1 -1
  67. package/dist/collection/components/loading/loading.css +12 -35
  68. package/dist/collection/components/loading/loading.js +9 -170
  69. package/dist/collection/components/loading/loading.js.map +1 -1
  70. package/dist/collection/components/message/message.css +12 -0
  71. package/dist/collection/components/message/message.js +12 -170
  72. package/dist/collection/components/message/message.js.map +1 -1
  73. package/dist/collection/components/radio/radio.css +12 -0
  74. package/dist/collection/components/radio/radio.js +15 -289
  75. package/dist/collection/components/radio/radio.js.map +1 -1
  76. package/dist/collection/components/switch/switch.css +12 -0
  77. package/dist/collection/components/switch/switch.js +15 -270
  78. package/dist/collection/components/switch/switch.js.map +1 -1
  79. package/dist/collection/components/textarea/textarea.css +12 -0
  80. package/dist/collection/components/textarea/textarea.js +55 -323
  81. package/dist/collection/components/textarea/textarea.js.map +1 -1
  82. package/dist/collection/components/upload/upload.css +560 -0
  83. package/dist/collection/components/upload/upload.js +469 -0
  84. package/dist/collection/components/upload/upload.js.map +1 -0
  85. package/dist/collection/index.js +1 -1
  86. package/dist/collection/index.js.map +1 -1
  87. package/dist/collection/pages/components/upload/index.js +19 -0
  88. package/dist/collection/pages/scripts/menu.js +221 -0
  89. package/dist/collection/pages/scripts/pageLoader.js +180 -0
  90. package/dist/collection/utils/inherited-attributes.js +4 -0
  91. package/dist/collection/utils/inherited-attributes.js.map +1 -1
  92. package/dist/collection/utils/interfaces.js.map +1 -1
  93. package/dist/collection/utils/unique-id-generator.js +4 -0
  94. package/dist/collection/utils/unique-id-generator.js.map +1 -1
  95. package/dist/components/br-avatar.js +5 -154
  96. package/dist/components/br-avatar.js.map +1 -1
  97. package/dist/components/br-button.js +5 -7
  98. package/dist/components/br-button.js.map +1 -1
  99. package/dist/components/br-checkbox.js +5 -145
  100. package/dist/components/br-checkbox.js.map +1 -1
  101. package/dist/components/br-dropdown.js +5 -155
  102. package/dist/components/br-dropdown.js.map +1 -1
  103. package/dist/components/br-icon.js +5 -7
  104. package/dist/components/br-icon.js.map +1 -1
  105. package/dist/components/br-input.js +5 -236
  106. package/dist/components/br-input.js.map +1 -1
  107. package/dist/components/br-item.js +5 -212
  108. package/dist/components/br-item.js.map +1 -1
  109. package/dist/components/br-list.js +5 -137
  110. package/dist/components/br-list.js.map +1 -1
  111. package/dist/components/br-loading.js +5 -91
  112. package/dist/components/br-loading.js.map +1 -1
  113. package/dist/components/br-message.js +5 -125
  114. package/dist/components/br-message.js.map +1 -1
  115. package/dist/components/br-radio.js +5 -173
  116. package/dist/components/br-radio.js.map +1 -1
  117. package/dist/components/br-switch.js +5 -158
  118. package/dist/components/br-switch.js.map +1 -1
  119. package/dist/components/br-textarea.js +5 -180
  120. package/dist/components/br-textarea.js.map +1 -1
  121. package/dist/components/br-upload.d.ts +11 -0
  122. package/dist/components/br-upload.js +6 -0
  123. package/dist/components/br-upload.js.map +1 -0
  124. package/dist/components/index.d.ts +0 -29
  125. package/dist/components/index.js +5 -15
  126. package/dist/components/index.js.map +1 -1
  127. package/dist/components/p-2d8e59f6.js +7 -0
  128. package/dist/components/p-2d8e59f6.js.map +1 -0
  129. package/dist/{webcomponents/p-ee6f4f3f.js → components/p-74a4eb38.js} +5 -1
  130. package/dist/{webcomponents/p-ee6f4f3f.js.map → components/p-74a4eb38.js.map} +1 -1
  131. package/dist/components/p-a23c3f6b.js +17 -0
  132. package/dist/components/p-a23c3f6b.js.map +1 -0
  133. package/dist/{webcomponents/p-14616bce.js → components/p-d5a8d30c.js} +5 -1
  134. package/dist/{webcomponents/p-14616bce.js.map → components/p-d5a8d30c.js.map} +1 -1
  135. package/dist/components/p-e4af8eac.js +6 -0
  136. package/dist/components/p-e4af8eac.js.map +1 -0
  137. package/dist/esm/app-globals-72548b13.js +9 -0
  138. package/dist/esm/app-globals-72548b13.js.map +1 -0
  139. package/dist/esm/br-avatar.entry.js +18 -68
  140. package/dist/esm/br-avatar.entry.js.map +1 -1
  141. package/dist/esm/br-button_2.entry.js +13 -93
  142. package/dist/esm/br-button_2.entry.js.map +1 -1
  143. package/dist/esm/br-checkbox.entry.js +11 -61
  144. package/dist/esm/br-checkbox.entry.js.map +1 -1
  145. package/dist/esm/br-dropdown.entry.js +8 -50
  146. package/dist/esm/br-dropdown.entry.js.map +1 -1
  147. package/dist/esm/br-input.entry.js +18 -67
  148. package/dist/esm/br-input.entry.js.map +1 -1
  149. package/dist/esm/br-item.entry.js +9 -53
  150. package/dist/esm/br-item.entry.js.map +1 -1
  151. package/dist/esm/br-list.entry.js +12 -56
  152. package/dist/esm/br-list.entry.js.map +1 -1
  153. package/dist/esm/br-loading.entry.js +10 -40
  154. package/dist/esm/br-loading.entry.js.map +1 -1
  155. package/dist/esm/br-message.entry.js +10 -40
  156. package/dist/esm/br-message.entry.js.map +1 -1
  157. package/dist/esm/br-radio.entry.js +13 -88
  158. package/dist/esm/br-radio.entry.js.map +1 -1
  159. package/dist/esm/br-switch.entry.js +13 -68
  160. package/dist/esm/br-switch.entry.js.map +1 -1
  161. package/dist/esm/br-textarea.entry.js +41 -97
  162. package/dist/esm/br-textarea.entry.js.map +1 -1
  163. package/dist/esm/br-upload.entry.js +164 -0
  164. package/dist/esm/br-upload.entry.js.map +1 -0
  165. package/dist/esm/{index-cad6e6c3.js → index-aab4a630.js} +149 -6
  166. package/dist/esm/index-aab4a630.js.map +1 -0
  167. package/dist/esm/index.js +4 -1
  168. package/dist/esm/index.js.map +1 -1
  169. package/dist/esm/{inherited-attributes-c856c729.js → inherited-attributes-553a7c36.js} +5 -1
  170. package/dist/esm/inherited-attributes-553a7c36.js.map +1 -0
  171. package/dist/esm/loader.js +8 -4
  172. package/dist/esm/loader.js.map +1 -1
  173. package/dist/esm/polyfills/core-js.js +11 -0
  174. package/dist/esm/polyfills/dom.js +79 -0
  175. package/dist/esm/polyfills/es5-html-element.js +1 -0
  176. package/dist/esm/polyfills/index.js +34 -0
  177. package/dist/esm/polyfills/system.js +6 -0
  178. package/dist/esm/{v4-23648a96.js → v4-c99c1585.js} +5 -1
  179. package/dist/esm/v4-c99c1585.js.map +1 -0
  180. package/dist/esm/webcomponents.js +30 -5
  181. package/dist/esm/webcomponents.js.map +1 -1
  182. package/dist/esm-es5/app-globals-72548b13.js +6 -0
  183. package/dist/esm-es5/app-globals-72548b13.js.map +1 -0
  184. package/dist/esm-es5/br-avatar.entry.js +6 -0
  185. package/dist/esm-es5/br-avatar.entry.js.map +1 -0
  186. package/dist/esm-es5/br-button_2.entry.js +17 -0
  187. package/dist/esm-es5/br-button_2.entry.js.map +1 -0
  188. package/dist/esm-es5/br-checkbox.entry.js +6 -0
  189. package/dist/esm-es5/br-checkbox.entry.js.map +1 -0
  190. package/dist/esm-es5/br-dropdown.entry.js +6 -0
  191. package/dist/esm-es5/br-dropdown.entry.js.map +1 -0
  192. package/dist/esm-es5/br-input.entry.js +6 -0
  193. package/dist/esm-es5/br-input.entry.js.map +1 -0
  194. package/dist/esm-es5/br-item.entry.js +6 -0
  195. package/dist/esm-es5/br-item.entry.js.map +1 -0
  196. package/dist/esm-es5/br-list.entry.js +6 -0
  197. package/dist/esm-es5/br-list.entry.js.map +1 -0
  198. package/dist/esm-es5/br-loading.entry.js +6 -0
  199. package/dist/esm-es5/br-loading.entry.js.map +1 -0
  200. package/dist/esm-es5/br-message.entry.js +6 -0
  201. package/dist/esm-es5/br-message.entry.js.map +1 -0
  202. package/dist/esm-es5/br-radio.entry.js +6 -0
  203. package/dist/esm-es5/br-radio.entry.js.map +1 -0
  204. package/dist/esm-es5/br-switch.entry.js +6 -0
  205. package/dist/esm-es5/br-switch.entry.js.map +1 -0
  206. package/dist/esm-es5/br-textarea.entry.js +6 -0
  207. package/dist/esm-es5/br-textarea.entry.js.map +1 -0
  208. package/dist/esm-es5/br-upload.entry.js +6 -0
  209. package/dist/esm-es5/br-upload.entry.js.map +1 -0
  210. package/dist/esm-es5/index-aab4a630.js +6 -0
  211. package/dist/esm-es5/index-aab4a630.js.map +1 -0
  212. package/dist/esm-es5/index.js +5 -0
  213. package/dist/esm-es5/index.js.map +1 -0
  214. package/dist/esm-es5/inherited-attributes-553a7c36.js +6 -0
  215. package/dist/esm-es5/inherited-attributes-553a7c36.js.map +1 -0
  216. package/dist/esm-es5/loader.js +6 -0
  217. package/dist/esm-es5/loader.js.map +1 -0
  218. package/dist/esm-es5/v4-c99c1585.js +6 -0
  219. package/dist/esm-es5/v4-c99c1585.js.map +1 -0
  220. package/dist/esm-es5/webcomponents.js +6 -0
  221. package/dist/esm-es5/webcomponents.js.map +1 -0
  222. package/dist/index.js +1 -1
  223. package/dist/playwright.config.js +39 -0
  224. package/dist/playwright.config.js.map +1 -0
  225. package/dist/types/builds/govbr-ds/bibliotecas/wbc/govbr-ds-wbc/packages/webcomponents/.stencil/playwright.config.d.ts +5 -0
  226. package/dist/types/components/avatar/avatar.d.ts +8 -65
  227. package/dist/types/components/button/button.d.ts +1 -94
  228. package/dist/types/components/checkbox/checkbox.d.ts +4 -97
  229. package/dist/types/components/dropdown/dropdown.d.ts +0 -90
  230. package/dist/types/components/icon/icon.d.ts +2 -64
  231. package/dist/types/components/input/input.d.ts +11 -109
  232. package/dist/types/components/item/item.d.ts +1 -92
  233. package/dist/types/components/list/list.d.ts +2 -94
  234. package/dist/types/components/loading/loading.d.ts +0 -62
  235. package/dist/types/components/message/message.d.ts +2 -63
  236. package/dist/types/components/radio/radio.d.ts +4 -105
  237. package/dist/types/components/switch/switch.d.ts +2 -100
  238. package/dist/types/components/textarea/textarea.d.ts +9 -100
  239. package/dist/types/components/upload/upload.d.ts +160 -0
  240. package/dist/types/components.d.ts +209 -948
  241. package/dist/types/index.d.ts +10 -1
  242. package/dist/types/stencil-public-runtime.d.ts +6 -0
  243. package/dist/webcomponents/index.esm.js +4 -0
  244. package/dist/webcomponents/p-05343155.system.entry.js +6 -0
  245. package/dist/webcomponents/p-05343155.system.entry.js.map +1 -0
  246. package/dist/webcomponents/p-155191ea.entry.js +6 -0
  247. package/dist/webcomponents/p-155191ea.entry.js.map +1 -0
  248. package/dist/webcomponents/p-183614c8.system.entry.js +6 -0
  249. package/dist/webcomponents/p-183614c8.system.entry.js.map +1 -0
  250. package/dist/webcomponents/p-2083ff7b.entry.js +6 -0
  251. package/dist/webcomponents/p-2083ff7b.entry.js.map +1 -0
  252. package/dist/webcomponents/p-24da392a.entry.js +6 -0
  253. package/dist/webcomponents/p-24da392a.entry.js.map +1 -0
  254. package/dist/webcomponents/p-254a2b7c.js +6 -0
  255. package/dist/webcomponents/{p-e1255160.js.map → p-254a2b7c.js.map} +1 -1
  256. package/dist/webcomponents/p-28aa7e4d.system.entry.js +6 -0
  257. package/dist/webcomponents/p-28aa7e4d.system.entry.js.map +1 -0
  258. package/dist/webcomponents/p-2c2c8629.js +7 -0
  259. package/dist/webcomponents/p-2c2c8629.js.map +1 -0
  260. package/dist/webcomponents/p-2cc63872.system.entry.js +6 -0
  261. package/dist/webcomponents/p-2cc63872.system.entry.js.map +1 -0
  262. package/dist/webcomponents/p-2cef0b07.system.entry.js +17 -0
  263. package/dist/webcomponents/p-2cef0b07.system.entry.js.map +1 -0
  264. package/dist/webcomponents/p-34cec0b3.system.entry.js +6 -0
  265. package/dist/webcomponents/p-34cec0b3.system.entry.js.map +1 -0
  266. package/dist/webcomponents/p-3c4dea67.entry.js +6 -0
  267. package/dist/webcomponents/p-3c4dea67.entry.js.map +1 -0
  268. package/dist/webcomponents/p-3f00a196.entry.js +6 -0
  269. package/dist/webcomponents/p-3f00a196.entry.js.map +1 -0
  270. package/dist/webcomponents/p-430afeb5.system.js +7 -0
  271. package/dist/webcomponents/p-430afeb5.system.js.map +1 -0
  272. package/dist/webcomponents/p-5539ffa8.entry.js +6 -0
  273. package/dist/webcomponents/p-5539ffa8.entry.js.map +1 -0
  274. package/dist/webcomponents/p-626fe2cb.entry.js +6 -0
  275. package/dist/webcomponents/p-626fe2cb.entry.js.map +1 -0
  276. package/dist/webcomponents/p-66b81760.entry.js +17 -0
  277. package/dist/webcomponents/p-66b81760.entry.js.map +1 -0
  278. package/dist/webcomponents/p-6a8226b3.system.entry.js +6 -0
  279. package/dist/webcomponents/p-6a8226b3.system.entry.js.map +1 -0
  280. package/dist/webcomponents/p-6e286eba.system.js +6 -0
  281. package/dist/webcomponents/p-6e286eba.system.js.map +1 -0
  282. package/dist/webcomponents/p-71be2e3f.system.entry.js +6 -0
  283. package/dist/webcomponents/p-71be2e3f.system.entry.js.map +1 -0
  284. package/dist/webcomponents/p-74a4eb38.js +6 -0
  285. package/dist/webcomponents/p-74a4eb38.js.map +1 -0
  286. package/dist/webcomponents/p-7a4e1265.system.entry.js +6 -0
  287. package/dist/webcomponents/p-7a4e1265.system.entry.js.map +1 -0
  288. package/dist/webcomponents/p-8039a644.system.entry.js +6 -0
  289. package/dist/webcomponents/p-8039a644.system.entry.js.map +1 -0
  290. package/dist/webcomponents/p-842b2513.entry.js +6 -0
  291. package/dist/webcomponents/p-842b2513.entry.js.map +1 -0
  292. package/dist/webcomponents/p-90e2e623.system.js +6 -0
  293. package/dist/webcomponents/p-90e2e623.system.js.map +1 -0
  294. package/dist/webcomponents/p-a71689a5.system.js +6 -0
  295. package/dist/webcomponents/p-a71689a5.system.js.map +1 -0
  296. package/dist/webcomponents/p-ae629243.system.entry.js +6 -0
  297. package/dist/webcomponents/p-ae629243.system.entry.js.map +1 -0
  298. package/dist/webcomponents/p-b88a5d9a.system.js +6 -0
  299. package/dist/webcomponents/p-b88a5d9a.system.js.map +1 -0
  300. package/dist/webcomponents/p-b9fd2bc0.system.entry.js +6 -0
  301. package/dist/webcomponents/p-b9fd2bc0.system.entry.js.map +1 -0
  302. package/dist/webcomponents/p-d5a8d30c.js +6 -0
  303. package/dist/webcomponents/p-d5a8d30c.js.map +1 -0
  304. package/dist/webcomponents/p-dcf41d91.entry.js +6 -0
  305. package/dist/webcomponents/p-dcf41d91.entry.js.map +1 -0
  306. package/dist/webcomponents/p-e027fca2.entry.js +6 -0
  307. package/dist/webcomponents/p-e027fca2.entry.js.map +1 -0
  308. package/dist/webcomponents/p-e751c991.system.js +6 -0
  309. package/dist/webcomponents/p-e751c991.system.js.map +1 -0
  310. package/dist/webcomponents/p-e8b5b14f.entry.js +6 -0
  311. package/dist/webcomponents/p-e8b5b14f.entry.js.map +1 -0
  312. package/dist/webcomponents/p-f5e674ba.system.entry.js +6 -0
  313. package/dist/webcomponents/p-f5e674ba.system.entry.js.map +1 -0
  314. package/dist/webcomponents/p-fd6c166e.entry.js +6 -0
  315. package/dist/webcomponents/p-fd6c166e.entry.js.map +1 -0
  316. package/dist/webcomponents/webcomponents.esm.js +5 -1
  317. package/dist/webcomponents/webcomponents.esm.js.map +1 -1
  318. package/dist/webcomponents/webcomponents.js +127 -0
  319. package/hydrate/index.d.ts +6 -0
  320. package/hydrate/index.js +837 -1084
  321. package/hydrate/index.mjs +837 -1084
  322. package/loader/cdn.js +6 -1
  323. package/loader/index.cjs.js +6 -1
  324. package/loader/index.es2017.js +5 -0
  325. package/loader/index.js +6 -1
  326. package/package.json +21 -24
  327. package/vscode-data.json +119 -44
  328. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  329. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  330. package/dist/cjs/index-a1cc4aa4.js.map +0 -1
  331. package/dist/cjs/inherited-attributes-61a2aff9.js.map +0 -1
  332. package/dist/cjs/v4-c23234d2.js.map +0 -1
  333. package/dist/collection/scripts/menu.js +0 -132
  334. package/dist/collection/scripts/pageLoader.js +0 -64
  335. package/dist/collection/scripts/utils.js +0 -16
  336. package/dist/components/p-14616bce.js +0 -68
  337. package/dist/components/p-14616bce.js.map +0 -1
  338. package/dist/components/p-215ac56c.js +0 -2476
  339. package/dist/components/p-215ac56c.js.map +0 -1
  340. package/dist/components/p-62a01df5.js +0 -1518
  341. package/dist/components/p-62a01df5.js.map +0 -1
  342. package/dist/components/p-6eb1a607.js +0 -138
  343. package/dist/components/p-6eb1a607.js.map +0 -1
  344. package/dist/components/p-ee6f4f3f.js +0 -101
  345. package/dist/components/p-ee6f4f3f.js.map +0 -1
  346. package/dist/esm/app-globals-0f993ce5.js +0 -5
  347. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  348. package/dist/esm/index-cad6e6c3.js.map +0 -1
  349. package/dist/esm/inherited-attributes-c856c729.js.map +0 -1
  350. package/dist/esm/v4-23648a96.js.map +0 -1
  351. package/dist/webcomponents/p-35f43cf0.entry.js +0 -2
  352. package/dist/webcomponents/p-35f43cf0.entry.js.map +0 -1
  353. package/dist/webcomponents/p-3bbf9a07.entry.js +0 -2
  354. package/dist/webcomponents/p-3bbf9a07.entry.js.map +0 -1
  355. package/dist/webcomponents/p-70216f4a.entry.js +0 -13
  356. package/dist/webcomponents/p-70216f4a.entry.js.map +0 -1
  357. package/dist/webcomponents/p-7ef2814e.entry.js +0 -2
  358. package/dist/webcomponents/p-7ef2814e.entry.js.map +0 -1
  359. package/dist/webcomponents/p-8030cff4.entry.js +0 -2
  360. package/dist/webcomponents/p-8030cff4.entry.js.map +0 -1
  361. package/dist/webcomponents/p-80726c0b.entry.js +0 -2
  362. package/dist/webcomponents/p-80726c0b.entry.js.map +0 -1
  363. package/dist/webcomponents/p-8dfeb926.js +0 -3
  364. package/dist/webcomponents/p-8dfeb926.js.map +0 -1
  365. package/dist/webcomponents/p-9a6aecb4.entry.js +0 -2
  366. package/dist/webcomponents/p-9a6aecb4.entry.js.map +0 -1
  367. package/dist/webcomponents/p-a80407ae.entry.js +0 -2
  368. package/dist/webcomponents/p-a80407ae.entry.js.map +0 -1
  369. package/dist/webcomponents/p-a9efcaff.entry.js +0 -2
  370. package/dist/webcomponents/p-a9efcaff.entry.js.map +0 -1
  371. package/dist/webcomponents/p-c8bf074f.entry.js +0 -2
  372. package/dist/webcomponents/p-c8bf074f.entry.js.map +0 -1
  373. package/dist/webcomponents/p-d3bb77aa.entry.js +0 -2
  374. package/dist/webcomponents/p-d3bb77aa.entry.js.map +0 -1
  375. package/dist/webcomponents/p-e1255160.js +0 -2
  376. package/dist/webcomponents/p-e24e46e9.entry.js +0 -2
  377. package/dist/webcomponents/p-e24e46e9.entry.js.map +0 -1
  378. /package/dist/collection/pages/{button/button.js → components/button/index.js} +0 -0
  379. /package/dist/collection/pages/{checkbox/checkbox.js → components/checkbox/index.js} +0 -0
  380. /package/dist/collection/pages/{dropdown/dropdown.js → components/dropdown/index.js} +0 -0
  381. /package/dist/collection/pages/{icon/icon.js → components/icon/index.js} +0 -0
  382. /package/dist/collection/pages/{input/input.js → components/input/index.js} +0 -0
  383. /package/dist/collection/pages/{item/item.js → components/item/index.js} +0 -0
  384. /package/dist/collection/pages/{list/list.js → components/list/index.js} +0 -0
  385. /package/dist/collection/pages/{message/message.js → components/message/index.js} +0 -0
  386. /package/dist/collection/pages/{radio/radio.js → components/radio/index.js} +0 -0
  387. /package/dist/collection/pages/{switch/switch.js → components/switch/index.js} +0 -0
  388. /package/dist/collection/pages/{textarea/textarea.js → components/textarea/index.js} +0 -0
@@ -1,2476 +0,0 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-62a01df5.js';
2
- import { i as inheritAriaAttributes } from './p-ee6f4f3f.js';
3
-
4
- /**
5
- * (c) Iconify
6
- *
7
- * For the full copyright and license information, please view the license.txt
8
- * files at https://github.com/iconify/iconify
9
- *
10
- * Licensed under MIT.
11
- *
12
- * @license MIT
13
- * @version 2.1.0
14
- */
15
- const defaultIconDimensions = Object.freeze(
16
- {
17
- left: 0,
18
- top: 0,
19
- width: 16,
20
- height: 16
21
- }
22
- );
23
- const defaultIconTransformations = Object.freeze({
24
- rotate: 0,
25
- vFlip: false,
26
- hFlip: false
27
- });
28
- const defaultIconProps = Object.freeze({
29
- ...defaultIconDimensions,
30
- ...defaultIconTransformations
31
- });
32
- const defaultExtendedIconProps = Object.freeze({
33
- ...defaultIconProps,
34
- body: "",
35
- hidden: false
36
- });
37
-
38
- const defaultIconSizeCustomisations = Object.freeze({
39
- width: null,
40
- height: null
41
- });
42
- const defaultIconCustomisations = Object.freeze({
43
- // Dimensions
44
- ...defaultIconSizeCustomisations,
45
- // Transformations
46
- ...defaultIconTransformations
47
- });
48
-
49
- function rotateFromString(value, defaultValue = 0) {
50
- const units = value.replace(/^-?[0-9.]*/, "");
51
- function cleanup(value2) {
52
- while (value2 < 0) {
53
- value2 += 4;
54
- }
55
- return value2 % 4;
56
- }
57
- if (units === "") {
58
- const num = parseInt(value);
59
- return isNaN(num) ? 0 : cleanup(num);
60
- } else if (units !== value) {
61
- let split = 0;
62
- switch (units) {
63
- case "%":
64
- split = 25;
65
- break;
66
- case "deg":
67
- split = 90;
68
- }
69
- if (split) {
70
- let num = parseFloat(value.slice(0, value.length - units.length));
71
- if (isNaN(num)) {
72
- return 0;
73
- }
74
- num = num / split;
75
- return num % 1 === 0 ? cleanup(num) : 0;
76
- }
77
- }
78
- return defaultValue;
79
- }
80
-
81
- const separator = /[\s,]+/;
82
- function flipFromString(custom, flip) {
83
- flip.split(separator).forEach((str) => {
84
- const value = str.trim();
85
- switch (value) {
86
- case "horizontal":
87
- custom.hFlip = true;
88
- break;
89
- case "vertical":
90
- custom.vFlip = true;
91
- break;
92
- }
93
- });
94
- }
95
-
96
- const defaultCustomisations = {
97
- ...defaultIconCustomisations,
98
- preserveAspectRatio: '',
99
- };
100
- /**
101
- * Get customisations
102
- */
103
- function getCustomisations(node) {
104
- const customisations = {
105
- ...defaultCustomisations,
106
- };
107
- const attr = (key, def) => node.getAttribute(key) || def;
108
- // Dimensions
109
- customisations.width = attr('width', null);
110
- customisations.height = attr('height', null);
111
- // Rotation
112
- customisations.rotate = rotateFromString(attr('rotate', ''));
113
- // Flip
114
- flipFromString(customisations, attr('flip', ''));
115
- // SVG attributes
116
- customisations.preserveAspectRatio = attr('preserveAspectRatio', attr('preserveaspectratio', ''));
117
- return customisations;
118
- }
119
- /**
120
- * Check if customisations have been updated
121
- */
122
- function haveCustomisationsChanged(value1, value2) {
123
- for (const key in defaultCustomisations) {
124
- if (value1[key] !== value2[key]) {
125
- return true;
126
- }
127
- }
128
- return false;
129
- }
130
-
131
- const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
132
- const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
133
- const colonSeparated = value.split(":");
134
- if (value.slice(0, 1) === "@") {
135
- if (colonSeparated.length < 2 || colonSeparated.length > 3) {
136
- return null;
137
- }
138
- provider = colonSeparated.shift().slice(1);
139
- }
140
- if (colonSeparated.length > 3 || !colonSeparated.length) {
141
- return null;
142
- }
143
- if (colonSeparated.length > 1) {
144
- const name2 = colonSeparated.pop();
145
- const prefix = colonSeparated.pop();
146
- const result = {
147
- // Allow provider without '@': "provider:prefix:name"
148
- provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
149
- prefix,
150
- name: name2
151
- };
152
- return validate && !validateIconName(result) ? null : result;
153
- }
154
- const name = colonSeparated[0];
155
- const dashSeparated = name.split("-");
156
- if (dashSeparated.length > 1) {
157
- const result = {
158
- provider,
159
- prefix: dashSeparated.shift(),
160
- name: dashSeparated.join("-")
161
- };
162
- return validate && !validateIconName(result) ? null : result;
163
- }
164
- if (allowSimpleName && provider === "") {
165
- const result = {
166
- provider,
167
- prefix: "",
168
- name
169
- };
170
- return validate && !validateIconName(result, allowSimpleName) ? null : result;
171
- }
172
- return null;
173
- };
174
- const validateIconName = (icon, allowSimpleName) => {
175
- if (!icon) {
176
- return false;
177
- }
178
- return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
179
- };
180
-
181
- function mergeIconTransformations(obj1, obj2) {
182
- const result = {};
183
- if (!obj1.hFlip !== !obj2.hFlip) {
184
- result.hFlip = true;
185
- }
186
- if (!obj1.vFlip !== !obj2.vFlip) {
187
- result.vFlip = true;
188
- }
189
- const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
190
- if (rotate) {
191
- result.rotate = rotate;
192
- }
193
- return result;
194
- }
195
-
196
- function mergeIconData(parent, child) {
197
- const result = mergeIconTransformations(parent, child);
198
- for (const key in defaultExtendedIconProps) {
199
- if (key in defaultIconTransformations) {
200
- if (key in parent && !(key in result)) {
201
- result[key] = defaultIconTransformations[key];
202
- }
203
- } else if (key in child) {
204
- result[key] = child[key];
205
- } else if (key in parent) {
206
- result[key] = parent[key];
207
- }
208
- }
209
- return result;
210
- }
211
-
212
- function getIconsTree(data, names) {
213
- const icons = data.icons;
214
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
215
- const resolved = /* @__PURE__ */ Object.create(null);
216
- function resolve(name) {
217
- if (icons[name]) {
218
- return resolved[name] = [];
219
- }
220
- if (!(name in resolved)) {
221
- resolved[name] = null;
222
- const parent = aliases[name] && aliases[name].parent;
223
- const value = parent && resolve(parent);
224
- if (value) {
225
- resolved[name] = [parent].concat(value);
226
- }
227
- }
228
- return resolved[name];
229
- }
230
- (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
231
- return resolved;
232
- }
233
-
234
- function internalGetIconData(data, name, tree) {
235
- const icons = data.icons;
236
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
237
- let currentProps = {};
238
- function parse(name2) {
239
- currentProps = mergeIconData(
240
- icons[name2] || aliases[name2],
241
- currentProps
242
- );
243
- }
244
- parse(name);
245
- tree.forEach(parse);
246
- return mergeIconData(data, currentProps);
247
- }
248
-
249
- function parseIconSet(data, callback) {
250
- const names = [];
251
- if (typeof data !== "object" || typeof data.icons !== "object") {
252
- return names;
253
- }
254
- if (data.not_found instanceof Array) {
255
- data.not_found.forEach((name) => {
256
- callback(name, null);
257
- names.push(name);
258
- });
259
- }
260
- const tree = getIconsTree(data);
261
- for (const name in tree) {
262
- const item = tree[name];
263
- if (item) {
264
- callback(name, internalGetIconData(data, name, item));
265
- names.push(name);
266
- }
267
- }
268
- return names;
269
- }
270
-
271
- const optionalPropertyDefaults = {
272
- provider: "",
273
- aliases: {},
274
- not_found: {},
275
- ...defaultIconDimensions
276
- };
277
- function checkOptionalProps(item, defaults) {
278
- for (const prop in defaults) {
279
- if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
280
- return false;
281
- }
282
- }
283
- return true;
284
- }
285
- function quicklyValidateIconSet(obj) {
286
- if (typeof obj !== "object" || obj === null) {
287
- return null;
288
- }
289
- const data = obj;
290
- if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
291
- return null;
292
- }
293
- if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
294
- return null;
295
- }
296
- const icons = data.icons;
297
- for (const name in icons) {
298
- const icon = icons[name];
299
- if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
300
- icon,
301
- defaultExtendedIconProps
302
- )) {
303
- return null;
304
- }
305
- }
306
- const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
307
- for (const name in aliases) {
308
- const icon = aliases[name];
309
- const parent = icon.parent;
310
- if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
311
- icon,
312
- defaultExtendedIconProps
313
- )) {
314
- return null;
315
- }
316
- }
317
- return data;
318
- }
319
-
320
- const dataStorage = /* @__PURE__ */ Object.create(null);
321
- function newStorage(provider, prefix) {
322
- return {
323
- provider,
324
- prefix,
325
- icons: /* @__PURE__ */ Object.create(null),
326
- missing: /* @__PURE__ */ new Set()
327
- };
328
- }
329
- function getStorage(provider, prefix) {
330
- const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
331
- return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
332
- }
333
- function addIconSet(storage, data) {
334
- if (!quicklyValidateIconSet(data)) {
335
- return [];
336
- }
337
- return parseIconSet(data, (name, icon) => {
338
- if (icon) {
339
- storage.icons[name] = icon;
340
- } else {
341
- storage.missing.add(name);
342
- }
343
- });
344
- }
345
- function addIconToStorage(storage, name, icon) {
346
- try {
347
- if (typeof icon.body === "string") {
348
- storage.icons[name] = { ...icon };
349
- return true;
350
- }
351
- } catch (err) {
352
- }
353
- return false;
354
- }
355
- function listIcons$1(provider, prefix) {
356
- let allIcons = [];
357
- const providers = typeof provider === "string" ? [provider] : Object.keys(dataStorage);
358
- providers.forEach((provider2) => {
359
- const prefixes = typeof provider2 === "string" && typeof prefix === "string" ? [prefix] : Object.keys(dataStorage[provider2] || {});
360
- prefixes.forEach((prefix2) => {
361
- const storage = getStorage(provider2, prefix2);
362
- allIcons = allIcons.concat(
363
- Object.keys(storage.icons).map(
364
- (name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name
365
- )
366
- );
367
- });
368
- });
369
- return allIcons;
370
- }
371
-
372
- let simpleNames = false;
373
- function allowSimpleNames(allow) {
374
- if (typeof allow === "boolean") {
375
- simpleNames = allow;
376
- }
377
- return simpleNames;
378
- }
379
- function getIconData(name) {
380
- const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
381
- if (icon) {
382
- const storage = getStorage(icon.provider, icon.prefix);
383
- const iconName = icon.name;
384
- return storage.icons[iconName] || (storage.missing.has(iconName) ? null : void 0);
385
- }
386
- }
387
- function addIcon$1(name, data) {
388
- const icon = stringToIcon(name, true, simpleNames);
389
- if (!icon) {
390
- return false;
391
- }
392
- const storage = getStorage(icon.provider, icon.prefix);
393
- return addIconToStorage(storage, icon.name, data);
394
- }
395
- function addCollection$1(data, provider) {
396
- if (typeof data !== "object") {
397
- return false;
398
- }
399
- if (typeof provider !== "string") {
400
- provider = data.provider || "";
401
- }
402
- if (simpleNames && !provider && !data.prefix) {
403
- let added = false;
404
- if (quicklyValidateIconSet(data)) {
405
- data.prefix = "";
406
- parseIconSet(data, (name, icon) => {
407
- if (icon && addIcon$1(name, icon)) {
408
- added = true;
409
- }
410
- });
411
- }
412
- return added;
413
- }
414
- const prefix = data.prefix;
415
- if (!validateIconName({
416
- provider,
417
- prefix,
418
- name: "a"
419
- })) {
420
- return false;
421
- }
422
- const storage = getStorage(provider, prefix);
423
- return !!addIconSet(storage, data);
424
- }
425
- function iconLoaded$1(name) {
426
- return !!getIconData(name);
427
- }
428
- function getIcon$1(name) {
429
- const result = getIconData(name);
430
- return result ? {
431
- ...defaultIconProps,
432
- ...result
433
- } : null;
434
- }
435
-
436
- function sortIcons(icons) {
437
- const result = {
438
- loaded: [],
439
- missing: [],
440
- pending: []
441
- };
442
- const storage = /* @__PURE__ */ Object.create(null);
443
- icons.sort((a, b) => {
444
- if (a.provider !== b.provider) {
445
- return a.provider.localeCompare(b.provider);
446
- }
447
- if (a.prefix !== b.prefix) {
448
- return a.prefix.localeCompare(b.prefix);
449
- }
450
- return a.name.localeCompare(b.name);
451
- });
452
- let lastIcon = {
453
- provider: "",
454
- prefix: "",
455
- name: ""
456
- };
457
- icons.forEach((icon) => {
458
- if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
459
- return;
460
- }
461
- lastIcon = icon;
462
- const provider = icon.provider;
463
- const prefix = icon.prefix;
464
- const name = icon.name;
465
- const providerStorage = storage[provider] || (storage[provider] = /* @__PURE__ */ Object.create(null));
466
- const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
467
- let list;
468
- if (name in localStorage.icons) {
469
- list = result.loaded;
470
- } else if (prefix === "" || localStorage.missing.has(name)) {
471
- list = result.missing;
472
- } else {
473
- list = result.pending;
474
- }
475
- const item = {
476
- provider,
477
- prefix,
478
- name
479
- };
480
- list.push(item);
481
- });
482
- return result;
483
- }
484
-
485
- function removeCallback(storages, id) {
486
- storages.forEach((storage) => {
487
- const items = storage.loaderCallbacks;
488
- if (items) {
489
- storage.loaderCallbacks = items.filter((row) => row.id !== id);
490
- }
491
- });
492
- }
493
- function updateCallbacks(storage) {
494
- if (!storage.pendingCallbacksFlag) {
495
- storage.pendingCallbacksFlag = true;
496
- setTimeout(() => {
497
- storage.pendingCallbacksFlag = false;
498
- const items = storage.loaderCallbacks ? storage.loaderCallbacks.slice(0) : [];
499
- if (!items.length) {
500
- return;
501
- }
502
- let hasPending = false;
503
- const provider = storage.provider;
504
- const prefix = storage.prefix;
505
- items.forEach((item) => {
506
- const icons = item.icons;
507
- const oldLength = icons.pending.length;
508
- icons.pending = icons.pending.filter((icon) => {
509
- if (icon.prefix !== prefix) {
510
- return true;
511
- }
512
- const name = icon.name;
513
- if (storage.icons[name]) {
514
- icons.loaded.push({
515
- provider,
516
- prefix,
517
- name
518
- });
519
- } else if (storage.missing.has(name)) {
520
- icons.missing.push({
521
- provider,
522
- prefix,
523
- name
524
- });
525
- } else {
526
- hasPending = true;
527
- return true;
528
- }
529
- return false;
530
- });
531
- if (icons.pending.length !== oldLength) {
532
- if (!hasPending) {
533
- removeCallback([storage], item.id);
534
- }
535
- item.callback(
536
- icons.loaded.slice(0),
537
- icons.missing.slice(0),
538
- icons.pending.slice(0),
539
- item.abort
540
- );
541
- }
542
- });
543
- });
544
- }
545
- }
546
- let idCounter = 0;
547
- function storeCallback(callback, icons, pendingSources) {
548
- const id = idCounter++;
549
- const abort = removeCallback.bind(null, pendingSources, id);
550
- if (!icons.pending.length) {
551
- return abort;
552
- }
553
- const item = {
554
- id,
555
- icons,
556
- callback,
557
- abort
558
- };
559
- pendingSources.forEach((storage) => {
560
- (storage.loaderCallbacks || (storage.loaderCallbacks = [])).push(item);
561
- });
562
- return abort;
563
- }
564
-
565
- const storage = /* @__PURE__ */ Object.create(null);
566
- function setAPIModule(provider, item) {
567
- storage[provider] = item;
568
- }
569
- function getAPIModule(provider) {
570
- return storage[provider] || storage[""];
571
- }
572
-
573
- function listToIcons(list, validate = true, simpleNames = false) {
574
- const result = [];
575
- list.forEach((item) => {
576
- const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames) : item;
577
- if (icon) {
578
- result.push(icon);
579
- }
580
- });
581
- return result;
582
- }
583
-
584
- // src/config.ts
585
- var defaultConfig = {
586
- resources: [],
587
- index: 0,
588
- timeout: 2e3,
589
- rotate: 750,
590
- random: false,
591
- dataAfterTimeout: false
592
- };
593
-
594
- // src/query.ts
595
- function sendQuery(config, payload, query, done) {
596
- const resourcesCount = config.resources.length;
597
- const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
598
- let resources;
599
- if (config.random) {
600
- let list = config.resources.slice(0);
601
- resources = [];
602
- while (list.length > 1) {
603
- const nextIndex = Math.floor(Math.random() * list.length);
604
- resources.push(list[nextIndex]);
605
- list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
606
- }
607
- resources = resources.concat(list);
608
- } else {
609
- resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
610
- }
611
- const startTime = Date.now();
612
- let status = "pending";
613
- let queriesSent = 0;
614
- let lastError;
615
- let timer = null;
616
- let queue = [];
617
- let doneCallbacks = [];
618
- if (typeof done === "function") {
619
- doneCallbacks.push(done);
620
- }
621
- function resetTimer() {
622
- if (timer) {
623
- clearTimeout(timer);
624
- timer = null;
625
- }
626
- }
627
- function abort() {
628
- if (status === "pending") {
629
- status = "aborted";
630
- }
631
- resetTimer();
632
- queue.forEach((item) => {
633
- if (item.status === "pending") {
634
- item.status = "aborted";
635
- }
636
- });
637
- queue = [];
638
- }
639
- function subscribe(callback, overwrite) {
640
- if (overwrite) {
641
- doneCallbacks = [];
642
- }
643
- if (typeof callback === "function") {
644
- doneCallbacks.push(callback);
645
- }
646
- }
647
- function getQueryStatus() {
648
- return {
649
- startTime,
650
- payload,
651
- status,
652
- queriesSent,
653
- queriesPending: queue.length,
654
- subscribe,
655
- abort
656
- };
657
- }
658
- function failQuery() {
659
- status = "failed";
660
- doneCallbacks.forEach((callback) => {
661
- callback(void 0, lastError);
662
- });
663
- }
664
- function clearQueue() {
665
- queue.forEach((item) => {
666
- if (item.status === "pending") {
667
- item.status = "aborted";
668
- }
669
- });
670
- queue = [];
671
- }
672
- function moduleResponse(item, response, data) {
673
- const isError = response !== "success";
674
- queue = queue.filter((queued) => queued !== item);
675
- switch (status) {
676
- case "pending":
677
- break;
678
- case "failed":
679
- if (isError || !config.dataAfterTimeout) {
680
- return;
681
- }
682
- break;
683
- default:
684
- return;
685
- }
686
- if (response === "abort") {
687
- lastError = data;
688
- failQuery();
689
- return;
690
- }
691
- if (isError) {
692
- lastError = data;
693
- if (!queue.length) {
694
- if (!resources.length) {
695
- failQuery();
696
- } else {
697
- execNext();
698
- }
699
- }
700
- return;
701
- }
702
- resetTimer();
703
- clearQueue();
704
- if (!config.random) {
705
- const index = config.resources.indexOf(item.resource);
706
- if (index !== -1 && index !== config.index) {
707
- config.index = index;
708
- }
709
- }
710
- status = "completed";
711
- doneCallbacks.forEach((callback) => {
712
- callback(data);
713
- });
714
- }
715
- function execNext() {
716
- if (status !== "pending") {
717
- return;
718
- }
719
- resetTimer();
720
- const resource = resources.shift();
721
- if (resource === void 0) {
722
- if (queue.length) {
723
- timer = setTimeout(() => {
724
- resetTimer();
725
- if (status === "pending") {
726
- clearQueue();
727
- failQuery();
728
- }
729
- }, config.timeout);
730
- return;
731
- }
732
- failQuery();
733
- return;
734
- }
735
- const item = {
736
- status: "pending",
737
- resource,
738
- callback: (status2, data) => {
739
- moduleResponse(item, status2, data);
740
- }
741
- };
742
- queue.push(item);
743
- queriesSent++;
744
- timer = setTimeout(execNext, config.rotate);
745
- query(resource, payload, item.callback);
746
- }
747
- setTimeout(execNext);
748
- return getQueryStatus;
749
- }
750
-
751
- // src/index.ts
752
- function initRedundancy(cfg) {
753
- const config = {
754
- ...defaultConfig,
755
- ...cfg
756
- };
757
- let queries = [];
758
- function cleanup() {
759
- queries = queries.filter((item) => item().status === "pending");
760
- }
761
- function query(payload, queryCallback, doneCallback) {
762
- const query2 = sendQuery(
763
- config,
764
- payload,
765
- queryCallback,
766
- (data, error) => {
767
- cleanup();
768
- if (doneCallback) {
769
- doneCallback(data, error);
770
- }
771
- }
772
- );
773
- queries.push(query2);
774
- return query2;
775
- }
776
- function find(callback) {
777
- return queries.find((value) => {
778
- return callback(value);
779
- }) || null;
780
- }
781
- const instance = {
782
- query,
783
- find,
784
- setIndex: (index) => {
785
- config.index = index;
786
- },
787
- getIndex: () => config.index,
788
- cleanup
789
- };
790
- return instance;
791
- }
792
-
793
- function createAPIConfig(source) {
794
- let resources;
795
- if (typeof source.resources === "string") {
796
- resources = [source.resources];
797
- } else {
798
- resources = source.resources;
799
- if (!(resources instanceof Array) || !resources.length) {
800
- return null;
801
- }
802
- }
803
- const result = {
804
- // API hosts
805
- resources,
806
- // Root path
807
- path: source.path || "/",
808
- // URL length limit
809
- maxURL: source.maxURL || 500,
810
- // Timeout before next host is used.
811
- rotate: source.rotate || 750,
812
- // Timeout before failing query.
813
- timeout: source.timeout || 5e3,
814
- // Randomise default API end point.
815
- random: source.random === true,
816
- // Start index
817
- index: source.index || 0,
818
- // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
819
- dataAfterTimeout: source.dataAfterTimeout !== false
820
- };
821
- return result;
822
- }
823
- const configStorage = /* @__PURE__ */ Object.create(null);
824
- const fallBackAPISources = [
825
- "https://api.simplesvg.com",
826
- "https://api.unisvg.com"
827
- ];
828
- const fallBackAPI = [];
829
- while (fallBackAPISources.length > 0) {
830
- if (fallBackAPISources.length === 1) {
831
- fallBackAPI.push(fallBackAPISources.shift());
832
- } else {
833
- if (Math.random() > 0.5) {
834
- fallBackAPI.push(fallBackAPISources.shift());
835
- } else {
836
- fallBackAPI.push(fallBackAPISources.pop());
837
- }
838
- }
839
- }
840
- configStorage[""] = createAPIConfig({
841
- resources: ["https://api.iconify.design"].concat(fallBackAPI)
842
- });
843
- function addAPIProvider$1(provider, customConfig) {
844
- const config = createAPIConfig(customConfig);
845
- if (config === null) {
846
- return false;
847
- }
848
- configStorage[provider] = config;
849
- return true;
850
- }
851
- function getAPIConfig(provider) {
852
- return configStorage[provider];
853
- }
854
- function listAPIProviders() {
855
- return Object.keys(configStorage);
856
- }
857
-
858
- function emptyCallback$1() {
859
- }
860
- const redundancyCache = /* @__PURE__ */ Object.create(null);
861
- function getRedundancyCache(provider) {
862
- if (!redundancyCache[provider]) {
863
- const config = getAPIConfig(provider);
864
- if (!config) {
865
- return;
866
- }
867
- const redundancy = initRedundancy(config);
868
- const cachedReundancy = {
869
- config,
870
- redundancy
871
- };
872
- redundancyCache[provider] = cachedReundancy;
873
- }
874
- return redundancyCache[provider];
875
- }
876
- function sendAPIQuery(target, query, callback) {
877
- let redundancy;
878
- let send;
879
- if (typeof target === "string") {
880
- const api = getAPIModule(target);
881
- if (!api) {
882
- callback(void 0, 424);
883
- return emptyCallback$1;
884
- }
885
- send = api.send;
886
- const cached = getRedundancyCache(target);
887
- if (cached) {
888
- redundancy = cached.redundancy;
889
- }
890
- } else {
891
- const config = createAPIConfig(target);
892
- if (config) {
893
- redundancy = initRedundancy(config);
894
- const moduleKey = target.resources ? target.resources[0] : "";
895
- const api = getAPIModule(moduleKey);
896
- if (api) {
897
- send = api.send;
898
- }
899
- }
900
- }
901
- if (!redundancy || !send) {
902
- callback(void 0, 424);
903
- return emptyCallback$1;
904
- }
905
- return redundancy.query(query, send, callback)().abort;
906
- }
907
-
908
- const browserCacheVersion = "iconify2";
909
- const browserCachePrefix = "iconify";
910
- const browserCacheCountKey = browserCachePrefix + "-count";
911
- const browserCacheVersionKey = browserCachePrefix + "-version";
912
- const browserStorageHour = 36e5;
913
- const browserStorageCacheExpiration = 168;
914
- const browserStorageLimit = 50;
915
-
916
- function getStoredItem(func, key) {
917
- try {
918
- return func.getItem(key);
919
- } catch (err) {
920
- }
921
- }
922
- function setStoredItem(func, key, value) {
923
- try {
924
- func.setItem(key, value);
925
- return true;
926
- } catch (err) {
927
- }
928
- }
929
- function removeStoredItem(func, key) {
930
- try {
931
- func.removeItem(key);
932
- } catch (err) {
933
- }
934
- }
935
-
936
- function setBrowserStorageItemsCount(storage, value) {
937
- return setStoredItem(storage, browserCacheCountKey, value.toString());
938
- }
939
- function getBrowserStorageItemsCount(storage) {
940
- return parseInt(getStoredItem(storage, browserCacheCountKey)) || 0;
941
- }
942
-
943
- const browserStorageConfig = {
944
- local: true,
945
- session: true
946
- };
947
- const browserStorageEmptyItems = {
948
- local: /* @__PURE__ */ new Set(),
949
- session: /* @__PURE__ */ new Set()
950
- };
951
- let browserStorageStatus = false;
952
- function setBrowserStorageStatus(status) {
953
- browserStorageStatus = status;
954
- }
955
-
956
- let _window = typeof window === "undefined" ? {} : window;
957
- function getBrowserStorage(key) {
958
- const attr = key + "Storage";
959
- try {
960
- if (_window && _window[attr] && typeof _window[attr].length === "number") {
961
- return _window[attr];
962
- }
963
- } catch (err) {
964
- }
965
- browserStorageConfig[key] = false;
966
- }
967
-
968
- function iterateBrowserStorage(key, callback) {
969
- const func = getBrowserStorage(key);
970
- if (!func) {
971
- return;
972
- }
973
- const version = getStoredItem(func, browserCacheVersionKey);
974
- if (version !== browserCacheVersion) {
975
- if (version) {
976
- const total2 = getBrowserStorageItemsCount(func);
977
- for (let i = 0; i < total2; i++) {
978
- removeStoredItem(func, browserCachePrefix + i.toString());
979
- }
980
- }
981
- setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
982
- setBrowserStorageItemsCount(func, 0);
983
- return;
984
- }
985
- const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
986
- const parseItem = (index) => {
987
- const name = browserCachePrefix + index.toString();
988
- const item = getStoredItem(func, name);
989
- if (typeof item !== "string") {
990
- return;
991
- }
992
- try {
993
- const data = JSON.parse(item);
994
- if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && // Valid item: run callback
995
- callback(data, index)) {
996
- return true;
997
- }
998
- } catch (err) {
999
- }
1000
- removeStoredItem(func, name);
1001
- };
1002
- let total = getBrowserStorageItemsCount(func);
1003
- for (let i = total - 1; i >= 0; i--) {
1004
- if (!parseItem(i)) {
1005
- if (i === total - 1) {
1006
- total--;
1007
- setBrowserStorageItemsCount(func, total);
1008
- } else {
1009
- browserStorageEmptyItems[key].add(i);
1010
- }
1011
- }
1012
- }
1013
- }
1014
-
1015
- function initBrowserStorage() {
1016
- if (browserStorageStatus) {
1017
- return;
1018
- }
1019
- setBrowserStorageStatus(true);
1020
- for (const key in browserStorageConfig) {
1021
- iterateBrowserStorage(key, (item) => {
1022
- const iconSet = item.data;
1023
- const provider = item.provider;
1024
- const prefix = iconSet.prefix;
1025
- const storage = getStorage(
1026
- provider,
1027
- prefix
1028
- );
1029
- if (!addIconSet(storage, iconSet).length) {
1030
- return false;
1031
- }
1032
- const lastModified = iconSet.lastModified || -1;
1033
- storage.lastModifiedCached = storage.lastModifiedCached ? Math.min(storage.lastModifiedCached, lastModified) : lastModified;
1034
- return true;
1035
- });
1036
- }
1037
- }
1038
-
1039
- function updateLastModified(storage, lastModified) {
1040
- const lastValue = storage.lastModifiedCached;
1041
- if (
1042
- // Matches or newer
1043
- lastValue && lastValue >= lastModified
1044
- ) {
1045
- return lastValue === lastModified;
1046
- }
1047
- storage.lastModifiedCached = lastModified;
1048
- if (lastValue) {
1049
- for (const key in browserStorageConfig) {
1050
- iterateBrowserStorage(key, (item) => {
1051
- const iconSet = item.data;
1052
- return item.provider !== storage.provider || iconSet.prefix !== storage.prefix || iconSet.lastModified === lastModified;
1053
- });
1054
- }
1055
- }
1056
- return true;
1057
- }
1058
- function storeInBrowserStorage(storage, data) {
1059
- if (!browserStorageStatus) {
1060
- initBrowserStorage();
1061
- }
1062
- function store(key) {
1063
- let func;
1064
- if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
1065
- return;
1066
- }
1067
- const set = browserStorageEmptyItems[key];
1068
- let index;
1069
- if (set.size) {
1070
- set.delete(index = Array.from(set).shift());
1071
- } else {
1072
- index = getBrowserStorageItemsCount(func);
1073
- if (index >= browserStorageLimit || !setBrowserStorageItemsCount(func, index + 1)) {
1074
- return;
1075
- }
1076
- }
1077
- const item = {
1078
- cached: Math.floor(Date.now() / browserStorageHour),
1079
- provider: storage.provider,
1080
- data
1081
- };
1082
- return setStoredItem(
1083
- func,
1084
- browserCachePrefix + index.toString(),
1085
- JSON.stringify(item)
1086
- );
1087
- }
1088
- if (data.lastModified && !updateLastModified(storage, data.lastModified)) {
1089
- return;
1090
- }
1091
- if (!Object.keys(data.icons).length) {
1092
- return;
1093
- }
1094
- if (data.not_found) {
1095
- data = Object.assign({}, data);
1096
- delete data.not_found;
1097
- }
1098
- if (!store("local")) {
1099
- store("session");
1100
- }
1101
- }
1102
-
1103
- function emptyCallback() {
1104
- }
1105
- function loadedNewIcons(storage) {
1106
- if (!storage.iconsLoaderFlag) {
1107
- storage.iconsLoaderFlag = true;
1108
- setTimeout(() => {
1109
- storage.iconsLoaderFlag = false;
1110
- updateCallbacks(storage);
1111
- });
1112
- }
1113
- }
1114
- function loadNewIcons(storage, icons) {
1115
- if (!storage.iconsToLoad) {
1116
- storage.iconsToLoad = icons;
1117
- } else {
1118
- storage.iconsToLoad = storage.iconsToLoad.concat(icons).sort();
1119
- }
1120
- if (!storage.iconsQueueFlag) {
1121
- storage.iconsQueueFlag = true;
1122
- setTimeout(() => {
1123
- storage.iconsQueueFlag = false;
1124
- const { provider, prefix } = storage;
1125
- const icons2 = storage.iconsToLoad;
1126
- delete storage.iconsToLoad;
1127
- let api;
1128
- if (!icons2 || !(api = getAPIModule(provider))) {
1129
- return;
1130
- }
1131
- const params = api.prepare(provider, prefix, icons2);
1132
- params.forEach((item) => {
1133
- sendAPIQuery(provider, item, (data) => {
1134
- if (typeof data !== "object") {
1135
- item.icons.forEach((name) => {
1136
- storage.missing.add(name);
1137
- });
1138
- } else {
1139
- try {
1140
- const parsed = addIconSet(
1141
- storage,
1142
- data
1143
- );
1144
- if (!parsed.length) {
1145
- return;
1146
- }
1147
- const pending = storage.pendingIcons;
1148
- if (pending) {
1149
- parsed.forEach((name) => {
1150
- pending.delete(name);
1151
- });
1152
- }
1153
- storeInBrowserStorage(storage, data);
1154
- } catch (err) {
1155
- console.error(err);
1156
- }
1157
- }
1158
- loadedNewIcons(storage);
1159
- });
1160
- });
1161
- });
1162
- }
1163
- }
1164
- const loadIcons$1 = (icons, callback) => {
1165
- const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
1166
- const sortedIcons = sortIcons(cleanedIcons);
1167
- if (!sortedIcons.pending.length) {
1168
- let callCallback = true;
1169
- if (callback) {
1170
- setTimeout(() => {
1171
- if (callCallback) {
1172
- callback(
1173
- sortedIcons.loaded,
1174
- sortedIcons.missing,
1175
- sortedIcons.pending,
1176
- emptyCallback
1177
- );
1178
- }
1179
- });
1180
- }
1181
- return () => {
1182
- callCallback = false;
1183
- };
1184
- }
1185
- const newIcons = /* @__PURE__ */ Object.create(null);
1186
- const sources = [];
1187
- let lastProvider, lastPrefix;
1188
- sortedIcons.pending.forEach((icon) => {
1189
- const { provider, prefix } = icon;
1190
- if (prefix === lastPrefix && provider === lastProvider) {
1191
- return;
1192
- }
1193
- lastProvider = provider;
1194
- lastPrefix = prefix;
1195
- sources.push(getStorage(provider, prefix));
1196
- const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
1197
- if (!providerNewIcons[prefix]) {
1198
- providerNewIcons[prefix] = [];
1199
- }
1200
- });
1201
- sortedIcons.pending.forEach((icon) => {
1202
- const { provider, prefix, name } = icon;
1203
- const storage = getStorage(provider, prefix);
1204
- const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set());
1205
- if (!pendingQueue.has(name)) {
1206
- pendingQueue.add(name);
1207
- newIcons[provider][prefix].push(name);
1208
- }
1209
- });
1210
- sources.forEach((storage) => {
1211
- const { provider, prefix } = storage;
1212
- if (newIcons[provider][prefix].length) {
1213
- loadNewIcons(storage, newIcons[provider][prefix]);
1214
- }
1215
- });
1216
- return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
1217
- };
1218
- const loadIcon$1 = (icon) => {
1219
- return new Promise((fulfill, reject) => {
1220
- const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
1221
- if (!iconObj) {
1222
- reject(icon);
1223
- return;
1224
- }
1225
- loadIcons$1([iconObj || icon], (loaded) => {
1226
- if (loaded.length && iconObj) {
1227
- const data = getIconData(iconObj);
1228
- if (data) {
1229
- fulfill({
1230
- ...defaultIconProps,
1231
- ...data
1232
- });
1233
- return;
1234
- }
1235
- }
1236
- reject(icon);
1237
- });
1238
- });
1239
- };
1240
-
1241
- /**
1242
- * Test icon string
1243
- */
1244
- function testIconObject(value) {
1245
- try {
1246
- const obj = typeof value === 'string' ? JSON.parse(value) : value;
1247
- if (typeof obj.body === 'string') {
1248
- return {
1249
- ...obj,
1250
- };
1251
- }
1252
- }
1253
- catch (err) {
1254
- //
1255
- }
1256
- }
1257
-
1258
- /**
1259
- * Parse icon value, load if needed
1260
- */
1261
- function parseIconValue(value, onload) {
1262
- // Check if icon name is valid
1263
- const name = typeof value === 'string' ? stringToIcon(value, true, true) : null;
1264
- if (!name) {
1265
- // Test for serialised object
1266
- const data = testIconObject(value);
1267
- return {
1268
- value,
1269
- data,
1270
- };
1271
- }
1272
- // Valid icon name: check if data is available
1273
- const data = getIconData(name);
1274
- // Icon data exists or icon has no prefix. Do not load icon from API if icon has no prefix
1275
- if (data !== void 0 || !name.prefix) {
1276
- return {
1277
- value,
1278
- name,
1279
- data, // could be 'null' -> icon is missing
1280
- };
1281
- }
1282
- // Load icon
1283
- const loading = loadIcons$1([name], () => onload(value, name, getIconData(name)));
1284
- return {
1285
- value,
1286
- name,
1287
- loading,
1288
- };
1289
- }
1290
-
1291
- // Check for Safari
1292
- let isBuggedSafari = false;
1293
- try {
1294
- isBuggedSafari = navigator.vendor.indexOf('Apple') === 0;
1295
- }
1296
- catch (err) {
1297
- //
1298
- }
1299
- /**
1300
- * Get render mode
1301
- */
1302
- function getRenderMode(body, mode) {
1303
- switch (mode) {
1304
- // Force mode
1305
- case 'svg':
1306
- case 'bg':
1307
- case 'mask':
1308
- return mode;
1309
- }
1310
- // Check for animation, use 'style' for animated icons, unless browser is Safari
1311
- // (only <a>, which should be ignored or animations start with '<a')
1312
- if (mode !== 'style' &&
1313
- (isBuggedSafari || body.indexOf('<a') === -1)) {
1314
- // Render <svg>
1315
- return 'svg';
1316
- }
1317
- // Use background or mask
1318
- return body.indexOf('currentColor') === -1 ? 'bg' : 'mask';
1319
- }
1320
-
1321
- const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
1322
- const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
1323
- function calculateSize$1(size, ratio, precision) {
1324
- if (ratio === 1) {
1325
- return size;
1326
- }
1327
- precision = precision || 100;
1328
- if (typeof size === "number") {
1329
- return Math.ceil(size * ratio * precision) / precision;
1330
- }
1331
- if (typeof size !== "string") {
1332
- return size;
1333
- }
1334
- const oldParts = size.split(unitsSplit);
1335
- if (oldParts === null || !oldParts.length) {
1336
- return size;
1337
- }
1338
- const newParts = [];
1339
- let code = oldParts.shift();
1340
- let isNumber = unitsTest.test(code);
1341
- while (true) {
1342
- if (isNumber) {
1343
- const num = parseFloat(code);
1344
- if (isNaN(num)) {
1345
- newParts.push(code);
1346
- } else {
1347
- newParts.push(Math.ceil(num * ratio * precision) / precision);
1348
- }
1349
- } else {
1350
- newParts.push(code);
1351
- }
1352
- code = oldParts.shift();
1353
- if (code === void 0) {
1354
- return newParts.join("");
1355
- }
1356
- isNumber = !isNumber;
1357
- }
1358
- }
1359
-
1360
- function splitSVGDefs(content, tag = "defs") {
1361
- let defs = "";
1362
- const index = content.indexOf("<" + tag);
1363
- while (index >= 0) {
1364
- const start = content.indexOf(">", index);
1365
- const end = content.indexOf("</" + tag);
1366
- if (start === -1 || end === -1) {
1367
- break;
1368
- }
1369
- const endEnd = content.indexOf(">", end);
1370
- if (endEnd === -1) {
1371
- break;
1372
- }
1373
- defs += content.slice(start + 1, end).trim();
1374
- content = content.slice(0, index).trim() + content.slice(endEnd + 1);
1375
- }
1376
- return {
1377
- defs,
1378
- content
1379
- };
1380
- }
1381
- function mergeDefsAndContent(defs, content) {
1382
- return defs ? "<defs>" + defs + "</defs>" + content : content;
1383
- }
1384
- function wrapSVGContent(body, start, end) {
1385
- const split = splitSVGDefs(body);
1386
- return mergeDefsAndContent(split.defs, start + split.content + end);
1387
- }
1388
-
1389
- const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
1390
- function iconToSVG(icon, customisations) {
1391
- const fullIcon = {
1392
- ...defaultIconProps,
1393
- ...icon
1394
- };
1395
- const fullCustomisations = {
1396
- ...defaultIconCustomisations,
1397
- ...customisations
1398
- };
1399
- const box = {
1400
- left: fullIcon.left,
1401
- top: fullIcon.top,
1402
- width: fullIcon.width,
1403
- height: fullIcon.height
1404
- };
1405
- let body = fullIcon.body;
1406
- [fullIcon, fullCustomisations].forEach((props) => {
1407
- const transformations = [];
1408
- const hFlip = props.hFlip;
1409
- const vFlip = props.vFlip;
1410
- let rotation = props.rotate;
1411
- if (hFlip) {
1412
- if (vFlip) {
1413
- rotation += 2;
1414
- } else {
1415
- transformations.push(
1416
- "translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
1417
- );
1418
- transformations.push("scale(-1 1)");
1419
- box.top = box.left = 0;
1420
- }
1421
- } else if (vFlip) {
1422
- transformations.push(
1423
- "translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
1424
- );
1425
- transformations.push("scale(1 -1)");
1426
- box.top = box.left = 0;
1427
- }
1428
- let tempValue;
1429
- if (rotation < 0) {
1430
- rotation -= Math.floor(rotation / 4) * 4;
1431
- }
1432
- rotation = rotation % 4;
1433
- switch (rotation) {
1434
- case 1:
1435
- tempValue = box.height / 2 + box.top;
1436
- transformations.unshift(
1437
- "rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
1438
- );
1439
- break;
1440
- case 2:
1441
- transformations.unshift(
1442
- "rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
1443
- );
1444
- break;
1445
- case 3:
1446
- tempValue = box.width / 2 + box.left;
1447
- transformations.unshift(
1448
- "rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
1449
- );
1450
- break;
1451
- }
1452
- if (rotation % 2 === 1) {
1453
- if (box.left !== box.top) {
1454
- tempValue = box.left;
1455
- box.left = box.top;
1456
- box.top = tempValue;
1457
- }
1458
- if (box.width !== box.height) {
1459
- tempValue = box.width;
1460
- box.width = box.height;
1461
- box.height = tempValue;
1462
- }
1463
- }
1464
- if (transformations.length) {
1465
- body = wrapSVGContent(
1466
- body,
1467
- '<g transform="' + transformations.join(" ") + '">',
1468
- "</g>"
1469
- );
1470
- }
1471
- });
1472
- const customisationsWidth = fullCustomisations.width;
1473
- const customisationsHeight = fullCustomisations.height;
1474
- const boxWidth = box.width;
1475
- const boxHeight = box.height;
1476
- let width;
1477
- let height;
1478
- if (customisationsWidth === null) {
1479
- height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1480
- width = calculateSize$1(height, boxWidth / boxHeight);
1481
- } else {
1482
- width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
1483
- height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
1484
- }
1485
- const attributes = {};
1486
- const setAttr = (prop, value) => {
1487
- if (!isUnsetKeyword(value)) {
1488
- attributes[prop] = value.toString();
1489
- }
1490
- };
1491
- setAttr("width", width);
1492
- setAttr("height", height);
1493
- const viewBox = [box.left, box.top, boxWidth, boxHeight];
1494
- attributes.viewBox = viewBox.join(" ");
1495
- return {
1496
- attributes,
1497
- viewBox,
1498
- body
1499
- };
1500
- }
1501
-
1502
- function iconToHTML$1(body, attributes) {
1503
- let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
1504
- for (const attr in attributes) {
1505
- renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
1506
- }
1507
- return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
1508
- }
1509
-
1510
- function encodeSVGforURL(svg) {
1511
- return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
1512
- }
1513
- function svgToData(svg) {
1514
- return "data:image/svg+xml," + encodeSVGforURL(svg);
1515
- }
1516
- function svgToURL$1(svg) {
1517
- return 'url("' + svgToData(svg) + '")';
1518
- }
1519
-
1520
- const detectFetch = () => {
1521
- let callback;
1522
- try {
1523
- callback = fetch;
1524
- if (typeof callback === "function") {
1525
- return callback;
1526
- }
1527
- } catch (err) {
1528
- }
1529
- };
1530
- let fetchModule = detectFetch();
1531
- function setFetch(fetch2) {
1532
- fetchModule = fetch2;
1533
- }
1534
- function getFetch() {
1535
- return fetchModule;
1536
- }
1537
- function calculateMaxLength(provider, prefix) {
1538
- const config = getAPIConfig(provider);
1539
- if (!config) {
1540
- return 0;
1541
- }
1542
- let result;
1543
- if (!config.maxURL) {
1544
- result = 0;
1545
- } else {
1546
- let maxHostLength = 0;
1547
- config.resources.forEach((item) => {
1548
- const host = item;
1549
- maxHostLength = Math.max(maxHostLength, host.length);
1550
- });
1551
- const url = prefix + ".json?icons=";
1552
- result = config.maxURL - maxHostLength - config.path.length - url.length;
1553
- }
1554
- return result;
1555
- }
1556
- function shouldAbort(status) {
1557
- return status === 404;
1558
- }
1559
- const prepare = (provider, prefix, icons) => {
1560
- const results = [];
1561
- const maxLength = calculateMaxLength(provider, prefix);
1562
- const type = "icons";
1563
- let item = {
1564
- type,
1565
- provider,
1566
- prefix,
1567
- icons: []
1568
- };
1569
- let length = 0;
1570
- icons.forEach((name, index) => {
1571
- length += name.length + 1;
1572
- if (length >= maxLength && index > 0) {
1573
- results.push(item);
1574
- item = {
1575
- type,
1576
- provider,
1577
- prefix,
1578
- icons: []
1579
- };
1580
- length = name.length;
1581
- }
1582
- item.icons.push(name);
1583
- });
1584
- results.push(item);
1585
- return results;
1586
- };
1587
- function getPath(provider) {
1588
- if (typeof provider === "string") {
1589
- const config = getAPIConfig(provider);
1590
- if (config) {
1591
- return config.path;
1592
- }
1593
- }
1594
- return "/";
1595
- }
1596
- const send = (host, params, callback) => {
1597
- if (!fetchModule) {
1598
- callback("abort", 424);
1599
- return;
1600
- }
1601
- let path = getPath(params.provider);
1602
- switch (params.type) {
1603
- case "icons": {
1604
- const prefix = params.prefix;
1605
- const icons = params.icons;
1606
- const iconsList = icons.join(",");
1607
- const urlParams = new URLSearchParams({
1608
- icons: iconsList
1609
- });
1610
- path += prefix + ".json?" + urlParams.toString();
1611
- break;
1612
- }
1613
- case "custom": {
1614
- const uri = params.uri;
1615
- path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
1616
- break;
1617
- }
1618
- default:
1619
- callback("abort", 400);
1620
- return;
1621
- }
1622
- let defaultError = 503;
1623
- fetchModule(host + path).then((response) => {
1624
- const status = response.status;
1625
- if (status !== 200) {
1626
- setTimeout(() => {
1627
- callback(shouldAbort(status) ? "abort" : "next", status);
1628
- });
1629
- return;
1630
- }
1631
- defaultError = 501;
1632
- return response.json();
1633
- }).then((data) => {
1634
- if (typeof data !== "object" || data === null) {
1635
- setTimeout(() => {
1636
- if (data === 404) {
1637
- callback("abort", data);
1638
- } else {
1639
- callback("next", defaultError);
1640
- }
1641
- });
1642
- return;
1643
- }
1644
- setTimeout(() => {
1645
- callback("success", data);
1646
- });
1647
- }).catch(() => {
1648
- callback("next", defaultError);
1649
- });
1650
- };
1651
- const fetchAPIModule = {
1652
- prepare,
1653
- send
1654
- };
1655
-
1656
- function toggleBrowserCache(storage, value) {
1657
- switch (storage) {
1658
- case "local":
1659
- case "session":
1660
- browserStorageConfig[storage] = value;
1661
- break;
1662
- case "all":
1663
- for (const key in browserStorageConfig) {
1664
- browserStorageConfig[key] = value;
1665
- }
1666
- break;
1667
- }
1668
- }
1669
-
1670
- /**
1671
- * Attribute to add
1672
- */
1673
- const nodeAttr = 'data-style';
1674
- /**
1675
- * Custom style to add to each node
1676
- */
1677
- let customStyle = '';
1678
- /**
1679
- * Set custom style to add to all components
1680
- *
1681
- * Affects only components rendered after function call
1682
- */
1683
- function appendCustomStyle(style) {
1684
- customStyle = style;
1685
- }
1686
- /**
1687
- * Add/update style node
1688
- */
1689
- function updateStyle(parent, inline) {
1690
- // Get node, create if needed
1691
- let styleNode = Array.from(parent.childNodes).find((node) => node.hasAttribute &&
1692
- node.hasAttribute(nodeAttr));
1693
- if (!styleNode) {
1694
- styleNode = document.createElement('style');
1695
- styleNode.setAttribute(nodeAttr, nodeAttr);
1696
- parent.appendChild(styleNode);
1697
- }
1698
- // Update content
1699
- styleNode.textContent =
1700
- ':host{display:inline-block;vertical-align:' +
1701
- (inline ? '-0.125em' : '0') +
1702
- '}span,svg{display:block}' +
1703
- customStyle;
1704
- }
1705
-
1706
- // Core
1707
- /**
1708
- * Get functions and initialise stuff
1709
- */
1710
- function exportFunctions() {
1711
- /**
1712
- * Initialise stuff
1713
- */
1714
- // Set API module
1715
- setAPIModule('', fetchAPIModule);
1716
- // Allow simple icon names
1717
- allowSimpleNames(true);
1718
- let _window;
1719
- try {
1720
- _window = window;
1721
- }
1722
- catch (err) {
1723
- //
1724
- }
1725
- if (_window) {
1726
- // Set cache and load existing cache
1727
- initBrowserStorage();
1728
- // Load icons from global "IconifyPreload"
1729
- if (_window.IconifyPreload !== void 0) {
1730
- const preload = _window.IconifyPreload;
1731
- const err = 'Invalid IconifyPreload syntax.';
1732
- if (typeof preload === 'object' && preload !== null) {
1733
- (preload instanceof Array ? preload : [preload]).forEach((item) => {
1734
- try {
1735
- if (
1736
- // Check if item is an object and not null/array
1737
- typeof item !== 'object' ||
1738
- item === null ||
1739
- item instanceof Array ||
1740
- // Check for 'icons' and 'prefix'
1741
- typeof item.icons !== 'object' ||
1742
- typeof item.prefix !== 'string' ||
1743
- // Add icon set
1744
- !addCollection$1(item)) {
1745
- console.error(err);
1746
- }
1747
- }
1748
- catch (e) {
1749
- console.error(err);
1750
- }
1751
- });
1752
- }
1753
- }
1754
- // Set API from global "IconifyProviders"
1755
- if (_window.IconifyProviders !== void 0) {
1756
- const providers = _window.IconifyProviders;
1757
- if (typeof providers === 'object' && providers !== null) {
1758
- for (const key in providers) {
1759
- const err = 'IconifyProviders[' + key + '] is invalid.';
1760
- try {
1761
- const value = providers[key];
1762
- if (typeof value !== 'object' ||
1763
- !value ||
1764
- value.resources === void 0) {
1765
- continue;
1766
- }
1767
- if (!addAPIProvider$1(key, value)) {
1768
- console.error(err);
1769
- }
1770
- }
1771
- catch (e) {
1772
- console.error(err);
1773
- }
1774
- }
1775
- }
1776
- }
1777
- }
1778
- const _api = {
1779
- getAPIConfig,
1780
- setAPIModule,
1781
- sendAPIQuery,
1782
- setFetch,
1783
- getFetch,
1784
- listAPIProviders,
1785
- };
1786
- return {
1787
- enableCache: (storage) => toggleBrowserCache(storage, true),
1788
- disableCache: (storage) => toggleBrowserCache(storage, false),
1789
- iconLoaded: iconLoaded$1,
1790
- iconExists: iconLoaded$1, // deprecated, kept to avoid breaking changes
1791
- getIcon: getIcon$1,
1792
- listIcons: listIcons$1,
1793
- addIcon: addIcon$1,
1794
- addCollection: addCollection$1,
1795
- calculateSize: calculateSize$1,
1796
- buildIcon: iconToSVG,
1797
- iconToHTML: iconToHTML$1,
1798
- svgToURL: svgToURL$1,
1799
- loadIcons: loadIcons$1,
1800
- loadIcon: loadIcon$1,
1801
- addAPIProvider: addAPIProvider$1,
1802
- appendCustomStyle,
1803
- _api,
1804
- };
1805
- }
1806
-
1807
- // List of properties to apply
1808
- const monotoneProps = {
1809
- 'background-color': 'currentColor',
1810
- };
1811
- const coloredProps = {
1812
- 'background-color': 'transparent',
1813
- };
1814
- // Dynamically add common props to variables above
1815
- const propsToAdd = {
1816
- image: 'var(--svg)',
1817
- repeat: 'no-repeat',
1818
- size: '100% 100%',
1819
- };
1820
- const propsToAddTo = {
1821
- '-webkit-mask': monotoneProps,
1822
- 'mask': monotoneProps,
1823
- 'background': coloredProps,
1824
- };
1825
- for (const prefix in propsToAddTo) {
1826
- const list = propsToAddTo[prefix];
1827
- for (const prop in propsToAdd) {
1828
- list[prefix + '-' + prop] = propsToAdd[prop];
1829
- }
1830
- }
1831
- /**
1832
- * Fix size: add 'px' to numbers
1833
- */
1834
- function fixSize(value) {
1835
- return value ? value + (value.match(/^[-0-9.]+$/) ? 'px' : '') : 'inherit';
1836
- }
1837
- /**
1838
- * Render node as <span>
1839
- */
1840
- function renderSPAN(data, icon, useMask) {
1841
- const node = document.createElement('span');
1842
- // Body
1843
- let body = data.body;
1844
- if (body.indexOf('<a') !== -1) {
1845
- // Animated SVG: add something to fix timing bug
1846
- body += '<!-- ' + Date.now() + ' -->';
1847
- }
1848
- // Generate SVG as URL
1849
- const renderAttribs = data.attributes;
1850
- const html = iconToHTML$1(body, {
1851
- ...renderAttribs,
1852
- width: icon.width + '',
1853
- height: icon.height + '',
1854
- });
1855
- const url = svgToURL$1(html);
1856
- // Generate style
1857
- const svgStyle = node.style;
1858
- const styles = {
1859
- '--svg': url,
1860
- 'width': fixSize(renderAttribs.width),
1861
- 'height': fixSize(renderAttribs.height),
1862
- ...(useMask ? monotoneProps : coloredProps),
1863
- };
1864
- // Apply style
1865
- for (const prop in styles) {
1866
- svgStyle.setProperty(prop, styles[prop]);
1867
- }
1868
- return node;
1869
- }
1870
-
1871
- let policy;
1872
- function createPolicy() {
1873
- try {
1874
- policy = window.trustedTypes.createPolicy("iconify", {
1875
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
1876
- createHTML: (s) => s
1877
- });
1878
- } catch (err) {
1879
- policy = null;
1880
- }
1881
- }
1882
- function cleanUpInnerHTML(html) {
1883
- if (policy === void 0) {
1884
- createPolicy();
1885
- }
1886
- return policy ? policy.createHTML(html) : html;
1887
- }
1888
-
1889
- /**
1890
- * Render node as <svg>
1891
- */
1892
- function renderSVG(data) {
1893
- const node = document.createElement('span');
1894
- // Add style if needed
1895
- const attr = data.attributes;
1896
- let style = '';
1897
- if (!attr.width) {
1898
- style = 'width: inherit;';
1899
- }
1900
- if (!attr.height) {
1901
- style += 'height: inherit;';
1902
- }
1903
- if (style) {
1904
- attr.style = style;
1905
- }
1906
- // Generate SVG
1907
- const html = iconToHTML$1(data.body, attr);
1908
- node.innerHTML = cleanUpInnerHTML(html);
1909
- return node.firstChild;
1910
- }
1911
-
1912
- /**
1913
- * Find icon node
1914
- */
1915
- function findIconElement(parent) {
1916
- return Array.from(parent.childNodes).find((node) => {
1917
- const tag = node.tagName &&
1918
- node.tagName.toUpperCase();
1919
- return tag === 'SPAN' || tag === 'SVG';
1920
- });
1921
- }
1922
- /**
1923
- * Render icon
1924
- */
1925
- function renderIcon(parent, state) {
1926
- const iconData = state.icon.data;
1927
- const customisations = state.customisations;
1928
- // Render icon
1929
- const renderData = iconToSVG(iconData, customisations);
1930
- if (customisations.preserveAspectRatio) {
1931
- renderData.attributes['preserveAspectRatio'] =
1932
- customisations.preserveAspectRatio;
1933
- }
1934
- const mode = state.renderedMode;
1935
- let node;
1936
- switch (mode) {
1937
- case 'svg':
1938
- node = renderSVG(renderData);
1939
- break;
1940
- default:
1941
- node = renderSPAN(renderData, {
1942
- ...defaultIconProps,
1943
- ...iconData,
1944
- }, mode === 'mask');
1945
- }
1946
- // Set element
1947
- const oldNode = findIconElement(parent);
1948
- if (oldNode) {
1949
- // Replace old element
1950
- if (node.tagName === 'SPAN' && oldNode.tagName === node.tagName) {
1951
- // Swap style instead of whole node
1952
- oldNode.setAttribute('style', node.getAttribute('style'));
1953
- }
1954
- else {
1955
- parent.replaceChild(node, oldNode);
1956
- }
1957
- }
1958
- else {
1959
- // Add new element
1960
- parent.appendChild(node);
1961
- }
1962
- }
1963
-
1964
- /**
1965
- * Set state to PendingState
1966
- */
1967
- function setPendingState(icon, inline, lastState) {
1968
- const lastRender = lastState &&
1969
- (lastState.rendered
1970
- ? lastState
1971
- : lastState.lastRender);
1972
- return {
1973
- rendered: false,
1974
- inline,
1975
- icon,
1976
- lastRender,
1977
- };
1978
- }
1979
-
1980
- /**
1981
- * Register 'iconify-icon' component, if it does not exist
1982
- */
1983
- function defineIconifyIcon(name = 'iconify-icon') {
1984
- // Check for custom elements registry and HTMLElement
1985
- let customElements;
1986
- let ParentClass;
1987
- try {
1988
- customElements = window.customElements;
1989
- ParentClass = window.HTMLElement;
1990
- }
1991
- catch (err) {
1992
- return;
1993
- }
1994
- // Make sure registry and HTMLElement exist
1995
- if (!customElements || !ParentClass) {
1996
- return;
1997
- }
1998
- // Check for duplicate
1999
- const ConflictingClass = customElements.get(name);
2000
- if (ConflictingClass) {
2001
- return ConflictingClass;
2002
- }
2003
- // All attributes
2004
- const attributes = [
2005
- // Icon
2006
- 'icon',
2007
- // Mode
2008
- 'mode',
2009
- 'inline',
2010
- 'noobserver',
2011
- // Customisations
2012
- 'width',
2013
- 'height',
2014
- 'rotate',
2015
- 'flip',
2016
- ];
2017
- /**
2018
- * Component class
2019
- */
2020
- const IconifyIcon = class extends ParentClass {
2021
- // Root
2022
- _shadowRoot;
2023
- // Initialised
2024
- _initialised = false;
2025
- // Icon state
2026
- _state;
2027
- // Attributes check queued
2028
- _checkQueued = false;
2029
- // Connected
2030
- _connected = false;
2031
- // Observer
2032
- _observer = null;
2033
- _visible = true;
2034
- /**
2035
- * Constructor
2036
- */
2037
- constructor() {
2038
- super();
2039
- // Attach shadow DOM
2040
- const root = (this._shadowRoot = this.attachShadow({
2041
- mode: 'open',
2042
- }));
2043
- // Add style
2044
- const inline = this.hasAttribute('inline');
2045
- updateStyle(root, inline);
2046
- // Create empty state
2047
- this._state = setPendingState({
2048
- value: '',
2049
- }, inline);
2050
- // Queue icon render
2051
- this._queueCheck();
2052
- }
2053
- /**
2054
- * Connected to DOM
2055
- */
2056
- connectedCallback() {
2057
- this._connected = true;
2058
- this.startObserver();
2059
- }
2060
- /**
2061
- * Disconnected from DOM
2062
- */
2063
- disconnectedCallback() {
2064
- this._connected = false;
2065
- this.stopObserver();
2066
- }
2067
- /**
2068
- * Observed attributes
2069
- */
2070
- static get observedAttributes() {
2071
- return attributes.slice(0);
2072
- }
2073
- /**
2074
- * Observed properties that are different from attributes
2075
- *
2076
- * Experimental! Need to test with various frameworks that support it
2077
- */
2078
- /*
2079
- static get properties() {
2080
- return {
2081
- inline: {
2082
- type: Boolean,
2083
- reflect: true,
2084
- },
2085
- // Not listing other attributes because they are strings or combination
2086
- // of string and another type. Cannot have multiple types
2087
- };
2088
- }
2089
- */
2090
- /**
2091
- * Attribute has changed
2092
- */
2093
- attributeChangedCallback(name) {
2094
- switch (name) {
2095
- case 'inline': {
2096
- // Update immediately: not affected by other attributes
2097
- const newInline = this.hasAttribute('inline');
2098
- const state = this._state;
2099
- if (newInline !== state.inline) {
2100
- // Update style if inline mode changed
2101
- state.inline = newInline;
2102
- updateStyle(this._shadowRoot, newInline);
2103
- }
2104
- break;
2105
- }
2106
- case 'noobserver': {
2107
- const value = this.hasAttribute('noobserver');
2108
- if (value) {
2109
- this.startObserver();
2110
- }
2111
- else {
2112
- this.stopObserver();
2113
- }
2114
- break;
2115
- }
2116
- default:
2117
- // Queue check for other attributes
2118
- this._queueCheck();
2119
- }
2120
- }
2121
- /**
2122
- * Get/set icon
2123
- */
2124
- get icon() {
2125
- const value = this.getAttribute('icon');
2126
- if (value && value.slice(0, 1) === '{') {
2127
- try {
2128
- return JSON.parse(value);
2129
- }
2130
- catch (err) {
2131
- //
2132
- }
2133
- }
2134
- return value;
2135
- }
2136
- set icon(value) {
2137
- if (typeof value === 'object') {
2138
- value = JSON.stringify(value);
2139
- }
2140
- this.setAttribute('icon', value);
2141
- }
2142
- /**
2143
- * Get/set inline
2144
- */
2145
- get inline() {
2146
- return this.hasAttribute('inline');
2147
- }
2148
- set inline(value) {
2149
- if (value) {
2150
- this.setAttribute('inline', 'true');
2151
- }
2152
- else {
2153
- this.removeAttribute('inline');
2154
- }
2155
- }
2156
- /**
2157
- * Get/set observer
2158
- */
2159
- get observer() {
2160
- return this.hasAttribute('observer');
2161
- }
2162
- set observer(value) {
2163
- if (value) {
2164
- this.setAttribute('observer', 'true');
2165
- }
2166
- else {
2167
- this.removeAttribute('observer');
2168
- }
2169
- }
2170
- /**
2171
- * Restart animation
2172
- */
2173
- restartAnimation() {
2174
- const state = this._state;
2175
- if (state.rendered) {
2176
- const root = this._shadowRoot;
2177
- if (state.renderedMode === 'svg') {
2178
- // Update root node
2179
- try {
2180
- root.lastChild.setCurrentTime(0);
2181
- return;
2182
- }
2183
- catch (err) {
2184
- // Failed: setCurrentTime() is not supported
2185
- }
2186
- }
2187
- renderIcon(root, state);
2188
- }
2189
- }
2190
- /**
2191
- * Get status
2192
- */
2193
- get status() {
2194
- const state = this._state;
2195
- return state.rendered
2196
- ? 'rendered'
2197
- : state.icon.data === null
2198
- ? 'failed'
2199
- : 'loading';
2200
- }
2201
- /**
2202
- * Queue attributes re-check
2203
- */
2204
- _queueCheck() {
2205
- if (!this._checkQueued) {
2206
- this._checkQueued = true;
2207
- setTimeout(() => {
2208
- this._check();
2209
- });
2210
- }
2211
- }
2212
- /**
2213
- * Check for changes
2214
- */
2215
- _check() {
2216
- if (!this._checkQueued) {
2217
- return;
2218
- }
2219
- this._checkQueued = false;
2220
- const state = this._state;
2221
- // Get icon
2222
- const newIcon = this.getAttribute('icon');
2223
- if (newIcon !== state.icon.value) {
2224
- this._iconChanged(newIcon);
2225
- return;
2226
- }
2227
- // Ignore other attributes if icon is not rendered
2228
- if (!state.rendered || !this._visible) {
2229
- return;
2230
- }
2231
- // Check for mode and attribute changes
2232
- const mode = this.getAttribute('mode');
2233
- const customisations = getCustomisations(this);
2234
- if (state.attrMode !== mode ||
2235
- haveCustomisationsChanged(state.customisations, customisations) ||
2236
- !findIconElement(this._shadowRoot)) {
2237
- this._renderIcon(state.icon, customisations, mode);
2238
- }
2239
- }
2240
- /**
2241
- * Icon value has changed
2242
- */
2243
- _iconChanged(newValue) {
2244
- const icon = parseIconValue(newValue, (value, name, data) => {
2245
- // Asynchronous callback: re-check values to make sure stuff wasn't changed
2246
- const state = this._state;
2247
- if (state.rendered || this.getAttribute('icon') !== value) {
2248
- // Icon data is already available or icon attribute was changed
2249
- return;
2250
- }
2251
- // Change icon
2252
- const icon = {
2253
- value,
2254
- name,
2255
- data,
2256
- };
2257
- if (icon.data) {
2258
- // Render icon
2259
- this._gotIconData(icon);
2260
- }
2261
- else {
2262
- // Nothing to render: update icon in state
2263
- state.icon = icon;
2264
- }
2265
- });
2266
- if (icon.data) {
2267
- // Icon is ready to render
2268
- this._gotIconData(icon);
2269
- }
2270
- else {
2271
- // Pending icon
2272
- this._state = setPendingState(icon, this._state.inline, this._state);
2273
- }
2274
- }
2275
- /**
2276
- * Force render icon on state change
2277
- */
2278
- _forceRender() {
2279
- if (!this._visible) {
2280
- // Remove icon
2281
- const node = findIconElement(this._shadowRoot);
2282
- if (node) {
2283
- this._shadowRoot.removeChild(node);
2284
- }
2285
- return;
2286
- }
2287
- // Re-render icon
2288
- this._queueCheck();
2289
- }
2290
- /**
2291
- * Got new icon data, icon is ready to (re)render
2292
- */
2293
- _gotIconData(icon) {
2294
- this._checkQueued = false;
2295
- this._renderIcon(icon, getCustomisations(this), this.getAttribute('mode'));
2296
- }
2297
- /**
2298
- * Re-render based on icon data
2299
- */
2300
- _renderIcon(icon, customisations, attrMode) {
2301
- // Get mode
2302
- const renderedMode = getRenderMode(icon.data.body, attrMode);
2303
- // Inline was not changed
2304
- const inline = this._state.inline;
2305
- // Set state and render
2306
- renderIcon(this._shadowRoot, (this._state = {
2307
- rendered: true,
2308
- icon,
2309
- inline,
2310
- customisations,
2311
- attrMode,
2312
- renderedMode,
2313
- }));
2314
- }
2315
- /**
2316
- * Start observer
2317
- */
2318
- startObserver() {
2319
- if (!this._observer && !this.hasAttribute('noobserver')) {
2320
- try {
2321
- this._observer = new IntersectionObserver((entries) => {
2322
- const intersecting = entries.some((entry) => entry.isIntersecting);
2323
- if (intersecting !== this._visible) {
2324
- this._visible = intersecting;
2325
- this._forceRender();
2326
- }
2327
- });
2328
- this._observer.observe(this);
2329
- }
2330
- catch (err) {
2331
- // Something went wrong, possibly observer is not supported
2332
- if (this._observer) {
2333
- try {
2334
- this._observer.disconnect();
2335
- }
2336
- catch (err) {
2337
- //
2338
- }
2339
- this._observer = null;
2340
- }
2341
- }
2342
- }
2343
- }
2344
- /**
2345
- * Stop observer
2346
- */
2347
- stopObserver() {
2348
- if (this._observer) {
2349
- this._observer.disconnect();
2350
- this._observer = null;
2351
- this._visible = true;
2352
- if (this._connected) {
2353
- // Render icon
2354
- this._forceRender();
2355
- }
2356
- }
2357
- }
2358
- };
2359
- // Add getters and setters
2360
- attributes.forEach((attr) => {
2361
- if (!(attr in IconifyIcon.prototype)) {
2362
- Object.defineProperty(IconifyIcon.prototype, attr, {
2363
- get: function () {
2364
- return this.getAttribute(attr);
2365
- },
2366
- set: function (value) {
2367
- if (value !== null) {
2368
- this.setAttribute(attr, value);
2369
- }
2370
- else {
2371
- this.removeAttribute(attr);
2372
- }
2373
- },
2374
- });
2375
- }
2376
- });
2377
- // Add exported functions: both as static and instance methods
2378
- const functions = exportFunctions();
2379
- for (const key in functions) {
2380
- IconifyIcon[key] = IconifyIcon.prototype[key] = functions[key];
2381
- }
2382
- // Define new component
2383
- customElements.define(name, IconifyIcon);
2384
- return IconifyIcon;
2385
- }
2386
-
2387
- /**
2388
- * Create exported data: either component instance or functions
2389
- */
2390
- defineIconifyIcon() || exportFunctions();
2391
-
2392
- const iconCss = "*,*::before,*::after{box-sizing:border-box}html{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}body{margin:0}a{background-color:transparent}strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;-moz-appearance:button;appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}[hidden]{display:none}.d-flex{display:flex !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter) * 0.5);padding-right:calc(var(--grid-gutter) * 0.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.container{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter) * -0.5);margin-right:calc(var(--grid-gutter) * -0.5)}@media (min-width: 576px){.container{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}}@media (min-width: 992px){.container{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}}@media (min-width: 1600px){.container{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mr-2{margin-right:var(--spacing-scale-base) !important}.mb-3{margin-bottom:var(--spacing-scale-2x) !important}.pt-half{padding-top:var(--spacing-scale-half) !important}.py-3{padding-bottom:var(--spacing-scale-2x) !important;padding-top:var(--spacing-scale-2x) !important}.py-4{padding-bottom:var(--spacing-scale-3x) !important;padding-top:var(--spacing-scale-3x) !important}body{--bg-color:var(--background);--bg-color-rgb:var(--background-rgb);--bg-color-hsl:var(--background-hsl);--font-size:var(--font-size-scale-base);--font-weight:var(--font-weight-regular);--link-color:var(--interactive);--link-color-rgb:var(--interactive-rgb);--link-color-hsl:var(--interactive-hsl);--line-height:var(--font-line-height-medium);--text-color:var(--color);--text-color-rgb:var(--color-rgb);--text-color-hsl:var(--color-hsl);background:var(--bg-color);color:var(--text-color);font-family:var(--font-family-base);font-size:var(--font-size);font-weight:var(--font-weight);line-height:var(--line-height)}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half);color:var(--interactive);text-decoration:none}a:focus{outline:none}a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}button{cursor:pointer}img{max-width:100%;vertical-align:middle}ul{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}::-moz-placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}.text-pure-0{color:var(--pure-0) !important}.bg-support-01{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark);background:var(--color-support-01) !important}.text-nowrap{white-space:nowrap !important}.text-base{font-size:var(--font-size-scale-base) !important}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}:host{margin:0 var(--spacing-scale-base)}";
2393
- const BrIconStyle0 = iconCss;
2394
-
2395
- const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends H {
2396
- constructor() {
2397
- super();
2398
- this.__registerHost();
2399
- this.__attachShadow();
2400
- this.brDidConnect = createEvent(this, "brDidConnect", 7);
2401
- this.brWillLoad = createEvent(this, "brWillLoad", 7);
2402
- this.brDidLoad = createEvent(this, "brDidLoad", 7);
2403
- this.brWillRender = createEvent(this, "brWillRender", 7);
2404
- this.brDidRender = createEvent(this, "brDidRender", 7);
2405
- this.brShouldUpdate = createEvent(this, "brShouldUpdate", 7);
2406
- this.brWillUpdate = createEvent(this, "brWillUpdate", 7);
2407
- this.brDidUpdate = createEvent(this, "brDidUpdate", 7);
2408
- this.brDidDisconnect = createEvent(this, "brDidDisconnect", 7);
2409
- this.inheritedAttributes = {};
2410
- this.IconName = undefined;
2411
- this.height = '16';
2412
- this.width = '24';
2413
- this.CssClasses = undefined;
2414
- this.isInline = false;
2415
- this.rotate = undefined;
2416
- this.flip = undefined;
2417
- }
2418
- connectedCallback() {
2419
- this.brDidConnect.emit();
2420
- }
2421
- componentWillLoad() {
2422
- this.brWillLoad.emit();
2423
- this.inheritedAttributes = inheritAriaAttributes(this.el);
2424
- }
2425
- componentDidLoad() {
2426
- this.brDidLoad.emit();
2427
- }
2428
- componentWillRender() {
2429
- this.brWillRender.emit();
2430
- }
2431
- componentDidRender() {
2432
- this.brDidRender.emit();
2433
- }
2434
- componentShouldUpdate() {
2435
- this.brShouldUpdate.emit();
2436
- }
2437
- componentWillUpdate() {
2438
- this.brWillUpdate.emit();
2439
- }
2440
- componentDidUpdate() {
2441
- this.brDidUpdate.emit();
2442
- }
2443
- disconnectedCallback() {
2444
- this.brDidDisconnect.emit();
2445
- }
2446
- render() {
2447
- return (h(Host, { key: 'cd30e2c534c440372a5f42f60dc76f13c97e1be4' }, h("iconify-icon", Object.assign({ key: '2d479f72952402f5189754b79872a6ac583789da', flip: this.flip, width: this.width, class: this.CssClasses, icon: this.IconName, inline: this.isInline, height: this.height, rotate: this.rotate }, this.inheritedAttributes))));
2448
- }
2449
- get el() { return this; }
2450
- static get style() { return BrIconStyle0; }
2451
- }, [1, "br-icon", {
2452
- "IconName": [513, "icon-name"],
2453
- "height": [513],
2454
- "width": [513],
2455
- "CssClasses": [513, "css-classes"],
2456
- "isInline": [516, "is-inline"],
2457
- "rotate": [513],
2458
- "flip": [513]
2459
- }]);
2460
- function defineCustomElement() {
2461
- if (typeof customElements === "undefined") {
2462
- return;
2463
- }
2464
- const components = ["br-icon"];
2465
- components.forEach(tagName => { switch (tagName) {
2466
- case "br-icon":
2467
- if (!customElements.get(tagName)) {
2468
- customElements.define(tagName, Icon);
2469
- }
2470
- break;
2471
- } });
2472
- }
2473
-
2474
- export { Icon as I, defineCustomElement as d };
2475
-
2476
- //# sourceMappingURL=p-215ac56c.js.map