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