@govbr-ds/webcomponents 2.1.0 → 2.1.2
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/README.md +0 -11
- package/cem/custom-elements.json +272 -71
- package/dist/cjs/app-globals-DcqHuMBv.js +9 -0
- package/dist/cjs/br-avatar.cjs.entry.js +248 -0
- package/dist/cjs/br-breadcrumb-item.cjs.entry.js +45 -0
- package/dist/cjs/br-breadcrumb.cjs.entry.js +443 -0
- package/dist/cjs/br-button_2.cjs.entry.js +280 -0
- package/dist/cjs/br-card.cjs.entry.js +111 -0
- package/dist/cjs/br-carousel-page.cjs.entry.js +80 -0
- package/dist/cjs/br-carousel.cjs.entry.js +565 -0
- package/dist/cjs/br-checkbox-group.cjs.entry.js +118 -0
- package/dist/cjs/br-checkbox.cjs.entry.js +288 -0
- package/dist/cjs/br-checkgroup.cjs.entry.js +20 -0
- package/dist/cjs/br-collapse_2.cjs.entry.js +683 -0
- package/dist/cjs/br-cookiebar-cookie.cjs.entry.js +83 -0
- package/dist/cjs/br-cookiebar-group.cjs.entry.js +309 -0
- package/dist/cjs/br-cookiebar-header.cjs.entry.js +39 -0
- package/dist/cjs/br-cookiebar-link.cjs.entry.js +55 -0
- package/dist/cjs/br-cookiebar-note-group.cjs.entry.js +70 -0
- package/dist/cjs/br-cookiebar-note.cjs.entry.js +25 -0
- package/dist/cjs/br-cookiebar.cjs.entry.js +758 -0
- package/dist/cjs/br-crumb.cjs.entry.js +51 -0
- package/dist/cjs/br-date-picker_3.cjs.entry.js +2447 -0
- package/dist/cjs/br-datetime-picker.cjs.entry.js +1886 -0
- package/dist/cjs/br-divider.cjs.entry.js +225 -0
- package/dist/cjs/br-dropdown_2.cjs.entry.js +2000 -0
- package/dist/cjs/br-footer-category.cjs.entry.js +102 -0
- package/dist/cjs/br-footer-item.cjs.entry.js +52 -0
- package/dist/cjs/br-footer-legal.cjs.entry.js +41 -0
- package/dist/cjs/br-footer-logo.cjs.entry.js +104 -0
- package/dist/cjs/br-footer-social.cjs.entry.js +71 -0
- package/dist/cjs/br-footer.cjs.entry.js +92 -0
- package/dist/cjs/br-header-function.cjs.entry.js +142 -0
- package/dist/cjs/br-header-link.cjs.entry.js +60 -0
- package/dist/cjs/br-header-list.cjs.entry.js +279 -0
- package/dist/cjs/br-header-logo.cjs.entry.js +178 -0
- package/dist/cjs/br-header.cjs.entry.js +642 -0
- package/dist/cjs/br-icon.cjs.entry.js +485 -0
- package/dist/cjs/br-input.cjs.entry.js +599 -0
- package/dist/cjs/br-item.cjs.entry.js +367 -0
- package/dist/cjs/br-link.cjs.entry.js +133 -0
- package/dist/cjs/br-loading.cjs.entry.js +505 -0
- package/dist/cjs/br-magic-button.cjs.entry.js +93 -0
- package/dist/cjs/br-menu-group.cjs.entry.js +23 -0
- package/dist/cjs/br-menu-header.cjs.entry.js +47 -0
- package/dist/cjs/br-menu-info.cjs.entry.js +38 -0
- package/dist/cjs/br-menu-item.cjs.entry.js +79 -0
- package/dist/cjs/br-menu-link.cjs.entry.js +56 -0
- package/dist/cjs/br-menu-list.cjs.entry.js +149 -0
- package/dist/cjs/br-menu-logo.cjs.entry.js +75 -0
- package/dist/cjs/br-menu-social.cjs.entry.js +65 -0
- package/dist/cjs/br-menu.cjs.entry.js +993 -0
- package/dist/cjs/br-modal.cjs.entry.js +496 -0
- package/dist/cjs/br-notification-body.cjs.entry.js +71 -0
- package/dist/cjs/br-notification-header.cjs.entry.js +48 -0
- package/dist/cjs/br-notification-item.cjs.entry.js +110 -0
- package/dist/cjs/br-notification.cjs.entry.js +334 -0
- package/dist/cjs/br-pagination.cjs.entry.js +884 -0
- package/dist/cjs/br-radio-group.cjs.entry.js +428 -0
- package/dist/cjs/br-radio.cjs.entry.js +357 -0
- package/dist/cjs/br-scrim.cjs.entry.js +1336 -0
- package/dist/cjs/br-select-input_3.cjs.entry.js +988 -0
- package/dist/cjs/br-sign-in.cjs.entry.js +126 -0
- package/dist/cjs/br-skip-link-item.cjs.entry.js +20 -0
- package/dist/cjs/br-skip-link.cjs.entry.js +362 -0
- package/dist/cjs/br-skiplink-item.cjs.entry.js +192 -0
- package/dist/cjs/br-slider.cjs.entry.js +687 -0
- package/dist/cjs/br-step_2.cjs.entry.js +628 -0
- package/dist/cjs/br-switch.cjs.entry.js +245 -0
- package/dist/cjs/br-tab-item.cjs.entry.js +185 -0
- package/dist/cjs/br-tab.cjs.entry.js +397 -0
- package/dist/cjs/br-table-body.cjs.entry.js +37 -0
- package/dist/cjs/br-table-cell.cjs.entry.js +184 -0
- package/dist/cjs/br-table-header-cell.cjs.entry.js +173 -0
- package/dist/cjs/br-table-header.cjs.entry.js +37 -0
- package/dist/cjs/br-table-row.cjs.entry.js +81 -0
- package/dist/cjs/br-table.cjs.entry.js +680 -0
- package/dist/cjs/br-tag.cjs.entry.js +493 -0
- package/dist/cjs/br-textarea.cjs.entry.js +306 -0
- package/dist/cjs/br-tooltip.cjs.entry.js +627 -0
- package/dist/cjs/br-upload.cjs.entry.js +581 -0
- package/dist/cjs/br-wizard-panel.cjs.entry.js +54 -0
- package/dist/cjs/br-wizard.cjs.entry.js +708 -0
- package/dist/cjs/breakpoint-observer-P8veqXg7.js +144 -0
- package/dist/cjs/clamp-Co_hWptd.js +25 -0
- package/dist/cjs/cookiebar.utils-CB1gQwZ4.js +18 -0
- package/dist/cjs/datetime-picker-constants-B5pWeOn1.js +3827 -0
- package/dist/cjs/event-CmVdNHxl.js +56 -0
- package/dist/cjs/floating-surface-dismiss-ccdiD0KF.js +63 -0
- package/dist/cjs/floating-ui-MBI1osio.js +136 -0
- package/dist/cjs/floating-ui.dom-BUSTaaxR.js +1715 -0
- package/dist/cjs/focus-DuywwJPR.js +30 -0
- package/dist/cjs/getNextElement-R9l3JtM9.js +31 -0
- package/dist/cjs/iconify-icon-DfODV9bf.js +2307 -0
- package/dist/cjs/id-CjRFMzf6.js +20 -0
- package/dist/cjs/index-C92n55ch.js +678 -0
- package/dist/cjs/index-CRdcutym.js +3287 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/isNil-DO5zWc3l.js +19 -0
- package/dist/cjs/isValid-Fu3kaWNn.js +3694 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/native-dialog--Ewqm4w0.js +49 -0
- package/dist/cjs/navigation-AbzwcRCU.js +25 -0
- package/dist/cjs/parts-D5K3ae2C.js +19 -0
- package/dist/cjs/props-CScmBvKd.js +24 -0
- package/dist/cjs/raf-batcher-yc87a4dS.js +55 -0
- package/dist/cjs/slot-DAllytTj.js +48 -0
- package/dist/cjs/swipe-BU8_XE9f.js +345 -0
- package/dist/cjs/table-constants-BOPSay0B.js +183 -0
- package/dist/cjs/validator-CTCajtT9.js +123 -0
- package/dist/cjs/webcomponents.cjs.js +50 -0
- package/dist/collection/assets/icon-search.svg +6 -0
- package/dist/collection/assets/logo-negative.svg +1 -0
- package/dist/collection/assets/logo-positive.svg +1 -0
- package/dist/collection/assets/wc.svg +1 -0
- package/dist/collection/collection-manifest.json +113 -0
- package/dist/collection/components/avatar/avatar.css +1 -0
- package/dist/collection/components/avatar/avatar.js +589 -0
- package/dist/collection/components/avatar/avatar.types.js +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.js +166 -0
- package/dist/collection/components/breadcrumb/breadcrumb.css +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb.js +619 -0
- package/dist/collection/components/breadcrumb/breadcrumb.types.js +1 -0
- package/dist/collection/components/breadcrumb/crumb/crumb.js +175 -0
- package/dist/collection/components/button/button.css +1 -0
- package/dist/collection/components/button/button.js +546 -0
- package/dist/collection/components/button/button.types.js +1 -0
- package/dist/collection/components/card/card.css +1 -0
- package/dist/collection/components/card/card.js +225 -0
- package/dist/collection/components/carousel/carousel-page/carousel-page.css +1 -0
- package/dist/collection/components/carousel/carousel-page/carousel-page.js +195 -0
- package/dist/collection/components/carousel/carousel.css +1 -0
- package/dist/collection/components/carousel/carousel.js +1217 -0
- package/dist/collection/components/carousel/carousel.types.js +1 -0
- package/dist/collection/components/checkbox/checkbox.css +1 -0
- package/dist/collection/components/checkbox/checkbox.js +823 -0
- package/dist/collection/components/checkbox/checkbox.types.js +1 -0
- package/dist/collection/components/checkbox-group/checkbox-group.css +1 -0
- package/dist/collection/components/checkbox-group/checkbox-group.js +268 -0
- package/dist/collection/components/checkgroup/checkgroup.js +166 -0
- package/dist/collection/components/collapse/collapse.css +1 -0
- package/dist/collection/components/collapse/collapse.js +642 -0
- package/dist/collection/components/collapse/collapse.types.js +1 -0
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.js +529 -0
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.js +628 -0
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.js +165 -0
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.js +201 -0
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.js +100 -0
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.js +172 -0
- package/dist/collection/components/cookiebar/cookiebar.css +1 -0
- package/dist/collection/components/cookiebar/cookiebar.js +1419 -0
- package/dist/collection/components/cookiebar/cookiebar.types.js +1 -0
- package/dist/collection/components/cookiebar/cookiebar.utils.js +14 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker-locale.js +94 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker-props-validation.js +57 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker.css +1 -0
- package/dist/collection/components/datetime-picker/date-picker/date-picker.js +913 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-props-validation.js +65 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.css +1 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +826 -0
- package/dist/collection/components/datetime-picker/datetime-picker-constants.js +36 -0
- package/dist/collection/components/datetime-picker/datetime-picker-form-associated.js +112 -0
- package/dist/collection/components/datetime-picker/datetime-picker-props-validation.js +202 -0
- package/dist/collection/components/datetime-picker/datetime-picker.css +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker.js +1924 -0
- package/dist/collection/components/datetime-picker/datetime-picker.types.js +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker.utils.js +250 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker-constants.js +13 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker.css +1 -0
- package/dist/collection/components/datetime-picker/time-picker/time-picker.js +456 -0
- package/dist/collection/components/divider/divider.css +1 -0
- package/dist/collection/components/divider/divider.js +537 -0
- package/dist/collection/components/divider/divider.types.js +1 -0
- package/dist/collection/components/dropdown/dropdown.css +1 -0
- package/dist/collection/components/dropdown/dropdown.js +939 -0
- package/dist/collection/components/dropdown/dropdown.types.js +1 -0
- package/dist/collection/components/footer/footer-category/footer-category.css +1 -0
- package/dist/collection/components/footer/footer-category/footer-category.js +160 -0
- package/dist/collection/components/footer/footer-item/footer-item.css +1 -0
- package/dist/collection/components/footer/footer-item/footer-item.js +154 -0
- package/dist/collection/components/footer/footer-legal/footer-legal.css +1 -0
- package/dist/collection/components/footer/footer-legal/footer-legal.js +75 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.css +1 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.js +342 -0
- package/dist/collection/components/footer/footer-logo/footer-logo.types.js +1 -0
- package/dist/collection/components/footer/footer-social/footer-social.css +1 -0
- package/dist/collection/components/footer/footer-social/footer-social.js +239 -0
- package/dist/collection/components/footer/footer.css +1 -0
- package/dist/collection/components/footer/footer.js +245 -0
- package/dist/collection/components/footer/footer.types.js +1 -0
- package/dist/collection/components/global.types.js +1 -0
- package/dist/collection/components/header/header-function/header-function.css +1 -0
- package/dist/collection/components/header/header-function/header-function.js +311 -0
- package/dist/collection/components/header/header-link/header-link.css +1 -0
- package/dist/collection/components/header/header-link/header-link.js +189 -0
- package/dist/collection/components/header/header-list/header-list.css +1 -0
- package/dist/collection/components/header/header-list/header-list.js +452 -0
- package/dist/collection/components/header/header-logo/header-logo.css +1 -0
- package/dist/collection/components/header/header-logo/header-logo.js +421 -0
- package/dist/collection/components/header/header.css +1 -0
- package/dist/collection/components/header/header.js +1131 -0
- package/dist/collection/components/header/header.types.js +1 -0
- package/dist/collection/components/icon/default-icons-cache.js +233 -0
- package/dist/collection/components/icon/icon.css +1 -0
- package/dist/collection/components/icon/icon.js +598 -0
- package/dist/collection/components/icon/icon.types.js +1 -0
- package/dist/collection/components/icon/icon.utils.js +33 -0
- package/dist/collection/components/input/input.css +1 -0
- package/dist/collection/components/input/input.js +1642 -0
- package/dist/collection/components/input/input.types.js +1 -0
- package/dist/collection/components/item/item.css +1 -0
- package/dist/collection/components/item/item.js +917 -0
- package/dist/collection/components/item/item.types.js +1 -0
- package/dist/collection/components/link/link.css +1 -0
- package/dist/collection/components/link/link.js +699 -0
- package/dist/collection/components/list/list.css +1 -0
- package/dist/collection/components/list/list.js +728 -0
- package/dist/collection/components/loading/loading.css +1 -0
- package/dist/collection/components/loading/loading.js +1169 -0
- package/dist/collection/components/loading/loading.types.js +1 -0
- package/dist/collection/components/magic-button/magic-button.css +1 -0
- package/dist/collection/components/magic-button/magic-button.js +238 -0
- package/dist/collection/components/menu/menu-group/menu-group.css +1 -0
- package/dist/collection/components/menu/menu-group/menu-group.js +77 -0
- package/dist/collection/components/menu/menu-header/menu-header.css +1 -0
- package/dist/collection/components/menu/menu-header/menu-header.js +161 -0
- package/dist/collection/components/menu/menu-info/menu-info.css +1 -0
- package/dist/collection/components/menu/menu-info/menu-info.js +94 -0
- package/dist/collection/components/menu/menu-item/menu-item.css +1 -0
- package/dist/collection/components/menu/menu-item/menu-item.js +306 -0
- package/dist/collection/components/menu/menu-item/menu-item.types.js +1 -0
- package/dist/collection/components/menu/menu-link/menu-link.css +1 -0
- package/dist/collection/components/menu/menu-link/menu-link.js +260 -0
- package/dist/collection/components/menu/menu-list/menu-list.css +1 -0
- package/dist/collection/components/menu/menu-list/menu-list.js +311 -0
- package/dist/collection/components/menu/menu-logo/menu-logo.css +1 -0
- package/dist/collection/components/menu/menu-logo/menu-logo.js +230 -0
- package/dist/collection/components/menu/menu-social/menu-social.css +1 -0
- package/dist/collection/components/menu/menu-social/menu-social.js +263 -0
- package/dist/collection/components/menu/menu.css +1 -0
- package/dist/collection/components/menu/menu.js +1372 -0
- package/dist/collection/components/menu/menu.types.js +1 -0
- package/dist/collection/components/menu/menu.utils.js +279 -0
- package/dist/collection/components/message/message.css +1 -0
- package/dist/collection/components/message/message.js +508 -0
- package/dist/collection/components/modal/modal.css +1 -0
- package/dist/collection/components/modal/modal.js +842 -0
- package/dist/collection/components/modal/modal.types.js +1 -0
- package/dist/collection/components/notification/notification-body/notification-body.css +1 -0
- package/dist/collection/components/notification/notification-body/notification-body.js +153 -0
- package/dist/collection/components/notification/notification-header/notification-header.css +1 -0
- package/dist/collection/components/notification/notification-header/notification-header.js +181 -0
- package/dist/collection/components/notification/notification-item/notification-item.css +1 -0
- package/dist/collection/components/notification/notification-item/notification-item.js +351 -0
- package/dist/collection/components/notification/notification-item/notification-item.types.js +1 -0
- package/dist/collection/components/notification/notification.css +1 -0
- package/dist/collection/components/notification/notification.js +838 -0
- package/dist/collection/components/notification/notification.types.js +1 -0
- package/dist/collection/components/pagination/pagination.css +1 -0
- package/dist/collection/components/pagination/pagination.js +1470 -0
- package/dist/collection/components/pagination/pagination.types.js +1 -0
- package/dist/collection/components/radio/radio.css +1 -0
- package/dist/collection/components/radio/radio.js +847 -0
- package/dist/collection/components/radio/radio.types.js +1 -0
- package/dist/collection/components/radio-group/radio-group.css +1 -0
- package/dist/collection/components/radio-group/radio-group.js +862 -0
- package/dist/collection/components/radio-group/radio-group.types.js +1 -0
- package/dist/collection/components/scrim/scrim.css +1 -0
- package/dist/collection/components/scrim/scrim.js +1825 -0
- package/dist/collection/components/scrim/scrim.types.js +1 -0
- package/dist/collection/components/scrim/scrim.utils.js +132 -0
- package/dist/collection/components/select/select-input/select-input.css +1 -0
- package/dist/collection/components/select/select-input/select-input.js +586 -0
- package/dist/collection/components/select/select-list/select-list.css +1 -0
- package/dist/collection/components/select/select-list/select-list.js +1159 -0
- package/dist/collection/components/select/select-option/select-option.css +1 -0
- package/dist/collection/components/select/select-option/select-option.js +564 -0
- package/dist/collection/components/select/select.constants.js +6 -0
- package/dist/collection/components/select/select.css +1 -0
- package/dist/collection/components/select/select.js +2692 -0
- package/dist/collection/components/select/select.types.js +1 -0
- package/dist/collection/components/select/select.utils.js +34 -0
- package/dist/collection/components/sign-in/sign-in.css +1 -0
- package/dist/collection/components/sign-in/sign-in.js +401 -0
- package/dist/collection/components/sign-in/sign-in.types.js +1 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item-alias.js +103 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.css +1 -0
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.js +450 -0
- package/dist/collection/components/skip-link/skip-link.css +1 -0
- package/dist/collection/components/skip-link/skip-link.js +699 -0
- package/dist/collection/components/skip-link/skip-link.types.js +1 -0
- package/dist/collection/components/slider/slider.css +1 -0
- package/dist/collection/components/slider/slider.js +1324 -0
- package/dist/collection/components/slider/slider.types.js +1 -0
- package/dist/collection/components/step/step-item/step-item.css +1 -0
- package/dist/collection/components/step/step-item/step-item.js +604 -0
- package/dist/collection/components/step/step-item/step-item.types.js +1 -0
- package/dist/collection/components/step/step.css +1 -0
- package/dist/collection/components/step/step.js +896 -0
- package/dist/collection/components/step/step.types.js +1 -0
- package/dist/collection/components/switch/switch.css +1 -0
- package/dist/collection/components/switch/switch.js +715 -0
- package/dist/collection/components/switch/switch.types.js +1 -0
- package/dist/collection/components/tab/tab-item/tab-item.css +1 -0
- package/dist/collection/components/tab/tab-item/tab-item.js +425 -0
- package/dist/collection/components/tab/tab.css +1 -0
- package/dist/collection/components/tab/tab.js +724 -0
- package/dist/collection/components/tab/tab.types.js +1 -0
- package/dist/collection/components/table/table-body/table-body.css +1 -0
- package/dist/collection/components/table/table-body/table-body.js +51 -0
- package/dist/collection/components/table/table-cell/table-cell.css +1 -0
- package/dist/collection/components/table/table-cell/table-cell.js +373 -0
- package/dist/collection/components/table/table-constants.js +171 -0
- package/dist/collection/components/table/table-header/table-header.css +1 -0
- package/dist/collection/components/table/table-header/table-header.js +51 -0
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -0
- package/dist/collection/components/table/table-header-cell/table-header-cell.js +402 -0
- package/dist/collection/components/table/table-row/table-row.css +1 -0
- package/dist/collection/components/table/table-row/table-row.js +261 -0
- package/dist/collection/components/table/table-tokens.js +50 -0
- package/dist/collection/components/table/table-types.js +1 -0
- package/dist/collection/components/table/table-utils.js +44 -0
- package/dist/collection/components/table/table.css +1 -0
- package/dist/collection/components/table/table.js +1030 -0
- package/dist/collection/components/tag/tag.css +1 -0
- package/dist/collection/components/tag/tag.js +1152 -0
- package/dist/collection/components/tag/tag.types.js +1 -0
- package/dist/collection/components/textarea/textarea.css +1 -0
- package/dist/collection/components/textarea/textarea.js +985 -0
- package/dist/collection/components/textarea/textarea.types.js +1 -0
- package/dist/collection/components/tooltip/tooltip.css +1 -0
- package/dist/collection/components/tooltip/tooltip.js +1024 -0
- package/dist/collection/components/tooltip/tooltip.types.js +1 -0
- package/dist/collection/components/upload/upload.css +1 -0
- package/dist/collection/components/upload/upload.js +1314 -0
- package/dist/collection/components/upload/upload.types.js +1 -0
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.css +1 -0
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.js +167 -0
- package/dist/collection/components/wizard/wizard.css +1 -0
- package/dist/collection/components/wizard/wizard.js +1228 -0
- package/dist/collection/index.js +14 -0
- package/dist/collection/pages/components/cookiebar/index.js +26 -0
- package/dist/collection/pages/components/link/index.js +29 -0
- package/dist/collection/pages/components/pagination/index.js +12 -0
- package/dist/collection/pages/components/slider/index.js +18 -0
- package/dist/collection/pages/scripts/code-editor.js +101 -0
- package/dist/collection/pages/scripts/component-controls.js +600 -0
- package/dist/collection/pages/scripts/dev-event-console.js +47 -0
- package/dist/collection/pages/scripts/menu.js +192 -0
- package/dist/collection/pages/scripts/pageLoader.js +1422 -0
- package/dist/collection/shared/utils/assetsPath.js +75 -0
- package/dist/collection/shared/utils/breakpoint-observer.js +139 -0
- package/dist/collection/shared/utils/clamp.js +21 -0
- package/dist/collection/shared/utils/css-variables.js +12 -0
- package/dist/collection/shared/utils/cssVariables.js +37 -0
- package/dist/collection/shared/utils/date.js +405 -0
- package/dist/collection/shared/utils/debounce.js +39 -0
- package/dist/collection/shared/utils/event.js +55 -0
- package/dist/collection/shared/utils/floating-surface-dismiss.js +59 -0
- package/dist/collection/shared/utils/floating-ui.js +131 -0
- package/dist/collection/shared/utils/focus.js +24 -0
- package/dist/collection/shared/utils/form.js +82 -0
- package/dist/collection/shared/utils/format-bytes.js +20 -0
- package/dist/collection/shared/utils/getNextElement.js +30 -0
- package/dist/collection/shared/utils/getRandom.js +27 -0
- package/dist/collection/shared/utils/helpers.js +31 -0
- package/dist/collection/shared/utils/id.js +16 -0
- package/dist/collection/shared/utils/index.js +60 -0
- package/dist/collection/shared/utils/interfaces.js +1 -0
- package/dist/collection/shared/utils/isClient.js +14 -0
- package/dist/collection/shared/utils/isDefined.js +19 -0
- package/dist/collection/shared/utils/isEmpty.js +30 -0
- package/dist/collection/shared/utils/isHTMLElement.js +16 -0
- package/dist/collection/shared/utils/isNil.js +15 -0
- package/dist/collection/shared/utils/isString.js +20 -0
- package/dist/collection/shared/utils/native-dialog.js +44 -0
- package/dist/collection/shared/utils/navigation.js +21 -0
- package/dist/collection/shared/utils/parts.js +15 -0
- package/dist/collection/shared/utils/prop-warning.js +7 -0
- package/dist/collection/shared/utils/props.js +37 -0
- package/dist/collection/shared/utils/raf-batcher.js +51 -0
- package/dist/collection/shared/utils/scrollLock.js +141 -0
- package/dist/collection/shared/utils/setRafTimeout.js +38 -0
- package/dist/collection/shared/utils/slot.js +113 -0
- package/dist/collection/shared/utils/ssr-date.js +33 -0
- package/dist/collection/shared/utils/stringToArray.js +29 -0
- package/dist/collection/shared/utils/swipe.js +342 -0
- package/dist/collection/shared/utils/transition.js +127 -0
- package/dist/collection/shared/utils/types.js +1 -0
- package/dist/collection/shared/utils/validator.js +51 -0
- package/dist/collection/value-accessors/angular-value-accessor-config.js +41 -0
- package/dist/collection/value-accessors/index.js +6 -0
- package/dist/collection/value-accessors/vue-model-config.js +43 -0
- package/dist/components/br-avatar.d.ts +11 -0
- package/dist/components/br-avatar.js +5 -0
- package/dist/components/br-breadcrumb-item.d.ts +11 -0
- package/dist/components/br-breadcrumb-item.js +5 -0
- package/dist/components/br-breadcrumb.d.ts +11 -0
- package/dist/components/br-breadcrumb.js +5 -0
- package/dist/components/br-button.d.ts +11 -0
- package/dist/components/br-button.js +5 -0
- package/dist/components/br-card.d.ts +11 -0
- package/dist/components/br-card.js +5 -0
- package/dist/components/br-carousel-page.d.ts +11 -0
- package/dist/components/br-carousel-page.js +5 -0
- package/dist/components/br-carousel.d.ts +11 -0
- package/dist/components/br-carousel.js +5 -0
- package/dist/components/br-checkbox-group.d.ts +11 -0
- package/dist/components/br-checkbox-group.js +5 -0
- package/dist/components/br-checkbox.d.ts +11 -0
- package/dist/components/br-checkbox.js +5 -0
- package/dist/components/br-checkgroup.d.ts +11 -0
- package/dist/components/br-checkgroup.js +5 -0
- package/dist/components/br-collapse.d.ts +11 -0
- package/dist/components/br-collapse.js +5 -0
- package/dist/components/br-cookiebar-cookie.d.ts +11 -0
- package/dist/components/br-cookiebar-cookie.js +5 -0
- package/dist/components/br-cookiebar-group.d.ts +11 -0
- package/dist/components/br-cookiebar-group.js +5 -0
- package/dist/components/br-cookiebar-header.d.ts +11 -0
- package/dist/components/br-cookiebar-header.js +5 -0
- package/dist/components/br-cookiebar-link.d.ts +11 -0
- package/dist/components/br-cookiebar-link.js +5 -0
- package/dist/components/br-cookiebar-note-group.d.ts +11 -0
- package/dist/components/br-cookiebar-note-group.js +5 -0
- package/dist/components/br-cookiebar-note.d.ts +11 -0
- package/dist/components/br-cookiebar-note.js +5 -0
- package/dist/components/br-cookiebar.d.ts +11 -0
- package/dist/components/br-cookiebar.js +5 -0
- package/dist/components/br-crumb.d.ts +11 -0
- package/dist/components/br-crumb.js +5 -0
- package/dist/components/br-date-picker.d.ts +11 -0
- package/dist/components/br-date-picker.js +5 -0
- package/dist/components/br-datetime-input.d.ts +11 -0
- package/dist/components/br-datetime-input.js +5 -0
- package/dist/components/br-datetime-picker.d.ts +11 -0
- package/dist/components/br-datetime-picker.js +5 -0
- package/dist/components/br-divider.d.ts +11 -0
- package/dist/components/br-divider.js +5 -0
- package/dist/components/br-dropdown.d.ts +11 -0
- package/dist/components/br-dropdown.js +5 -0
- package/dist/components/br-footer-category.d.ts +11 -0
- package/dist/components/br-footer-category.js +5 -0
- package/dist/components/br-footer-item.d.ts +11 -0
- package/dist/components/br-footer-item.js +5 -0
- package/dist/components/br-footer-legal.d.ts +11 -0
- package/dist/components/br-footer-legal.js +5 -0
- package/dist/components/br-footer-logo.d.ts +11 -0
- package/dist/components/br-footer-logo.js +5 -0
- package/dist/components/br-footer-social.d.ts +11 -0
- package/dist/components/br-footer-social.js +5 -0
- package/dist/components/br-footer.d.ts +11 -0
- package/dist/components/br-footer.js +5 -0
- package/dist/components/br-header-function.d.ts +11 -0
- package/dist/components/br-header-function.js +5 -0
- package/dist/components/br-header-link.d.ts +11 -0
- package/dist/components/br-header-link.js +5 -0
- package/dist/components/br-header-list.d.ts +11 -0
- package/dist/components/br-header-list.js +5 -0
- package/dist/components/br-header-logo.d.ts +11 -0
- package/dist/components/br-header-logo.js +5 -0
- package/dist/components/br-header.d.ts +11 -0
- package/dist/components/br-header.js +5 -0
- package/dist/components/br-icon.d.ts +11 -0
- package/dist/components/br-icon.js +5 -0
- package/dist/components/br-input.d.ts +11 -0
- package/dist/components/br-input.js +5 -0
- package/dist/components/br-item.d.ts +11 -0
- package/dist/components/br-item.js +5 -0
- package/dist/components/br-link.d.ts +11 -0
- package/dist/components/br-link.js +5 -0
- package/dist/components/br-list.d.ts +11 -0
- package/dist/components/br-list.js +5 -0
- package/dist/components/br-loading.d.ts +11 -0
- package/dist/components/br-loading.js +5 -0
- package/dist/components/br-magic-button.d.ts +11 -0
- package/dist/components/br-magic-button.js +5 -0
- package/dist/components/br-menu-group.d.ts +11 -0
- package/dist/components/br-menu-group.js +5 -0
- package/dist/components/br-menu-header.d.ts +11 -0
- package/dist/components/br-menu-header.js +5 -0
- package/dist/components/br-menu-info.d.ts +11 -0
- package/dist/components/br-menu-info.js +5 -0
- package/dist/components/br-menu-item.d.ts +11 -0
- package/dist/components/br-menu-item.js +5 -0
- package/dist/components/br-menu-link.d.ts +11 -0
- package/dist/components/br-menu-link.js +5 -0
- package/dist/components/br-menu-list.d.ts +11 -0
- package/dist/components/br-menu-list.js +5 -0
- package/dist/components/br-menu-logo.d.ts +11 -0
- package/dist/components/br-menu-logo.js +5 -0
- package/dist/components/br-menu-social.d.ts +11 -0
- package/dist/components/br-menu-social.js +5 -0
- package/dist/components/br-menu.d.ts +11 -0
- package/dist/components/br-menu.js +5 -0
- package/dist/components/br-message.d.ts +11 -0
- package/dist/components/br-message.js +5 -0
- package/dist/components/br-modal.d.ts +11 -0
- package/dist/components/br-modal.js +5 -0
- package/dist/components/br-notification-body.d.ts +11 -0
- package/dist/components/br-notification-body.js +5 -0
- package/dist/components/br-notification-header.d.ts +11 -0
- package/dist/components/br-notification-header.js +5 -0
- package/dist/components/br-notification-item.d.ts +11 -0
- package/dist/components/br-notification-item.js +5 -0
- package/dist/components/br-notification.d.ts +11 -0
- package/dist/components/br-notification.js +5 -0
- package/dist/components/br-pagination.d.ts +11 -0
- package/dist/components/br-pagination.js +5 -0
- package/dist/components/br-radio-group.d.ts +11 -0
- package/dist/components/br-radio-group.js +5 -0
- package/dist/components/br-radio.d.ts +11 -0
- package/dist/components/br-radio.js +5 -0
- package/dist/components/br-scrim.d.ts +11 -0
- package/dist/components/br-scrim.js +5 -0
- package/dist/components/br-select-input.d.ts +11 -0
- package/dist/components/br-select-input.js +5 -0
- package/dist/components/br-select-list.d.ts +11 -0
- package/dist/components/br-select-list.js +5 -0
- package/dist/components/br-select-option.d.ts +11 -0
- package/dist/components/br-select-option.js +5 -0
- package/dist/components/br-select.d.ts +11 -0
- package/dist/components/br-select.js +5 -0
- package/dist/components/br-sign-in.d.ts +11 -0
- package/dist/components/br-sign-in.js +5 -0
- package/dist/components/br-skip-link-item.d.ts +11 -0
- package/dist/components/br-skip-link-item.js +5 -0
- package/dist/components/br-skip-link.d.ts +11 -0
- package/dist/components/br-skip-link.js +5 -0
- package/dist/components/br-skiplink-item.d.ts +11 -0
- package/dist/components/br-skiplink-item.js +5 -0
- package/dist/components/br-slider.d.ts +11 -0
- package/dist/components/br-slider.js +5 -0
- package/dist/components/br-step-item.d.ts +11 -0
- package/dist/components/br-step-item.js +5 -0
- package/dist/components/br-step.d.ts +11 -0
- package/dist/components/br-step.js +5 -0
- package/dist/components/br-switch.d.ts +11 -0
- package/dist/components/br-switch.js +5 -0
- package/dist/components/br-tab-item.d.ts +11 -0
- package/dist/components/br-tab-item.js +5 -0
- package/dist/components/br-tab.d.ts +11 -0
- package/dist/components/br-tab.js +5 -0
- package/dist/components/br-table-body.d.ts +11 -0
- package/dist/components/br-table-body.js +5 -0
- package/dist/components/br-table-cell.d.ts +11 -0
- package/dist/components/br-table-cell.js +5 -0
- package/dist/components/br-table-header-cell.d.ts +11 -0
- package/dist/components/br-table-header-cell.js +5 -0
- package/dist/components/br-table-header.d.ts +11 -0
- package/dist/components/br-table-header.js +5 -0
- package/dist/components/br-table-row.d.ts +11 -0
- package/dist/components/br-table-row.js +5 -0
- package/dist/components/br-table.d.ts +11 -0
- package/dist/components/br-table.js +5 -0
- package/dist/components/br-tag.d.ts +11 -0
- package/dist/components/br-tag.js +5 -0
- package/dist/components/br-textarea.d.ts +11 -0
- package/dist/components/br-textarea.js +5 -0
- package/dist/components/br-time-picker.d.ts +11 -0
- package/dist/components/br-time-picker.js +5 -0
- package/dist/components/br-tooltip.d.ts +11 -0
- package/dist/components/br-tooltip.js +5 -0
- package/dist/components/br-upload.d.ts +11 -0
- package/dist/components/br-upload.js +5 -0
- package/dist/components/br-wizard-panel.d.ts +11 -0
- package/dist/components/br-wizard-panel.js +5 -0
- package/dist/components/br-wizard.d.ts +11 -0
- package/dist/components/br-wizard.js +5 -0
- package/dist/components/index.d.ts +213 -0
- package/dist/components/index.js +5 -0
- package/dist/components/p-34Jfn-U-.js +5 -0
- package/dist/components/p-5z6jgH1D.js +5 -0
- package/dist/components/p-6OdfnwnK.js +5 -0
- package/dist/components/p-9S9bgUT0.js +5 -0
- package/dist/components/p-B-qLmYZC.js +5 -0
- package/dist/components/p-B55qsau4.js +5 -0
- package/dist/components/p-B7Amgxkp.js +5 -0
- package/dist/components/p-BC7f6MK8.js +5 -0
- package/dist/components/p-BKuMQJrQ.js +5 -0
- package/dist/components/p-BPJpHGOW.js +5 -0
- package/dist/components/p-BWXfdbQH.js +5 -0
- package/dist/components/p-Bb-nLtTG.js +5 -0
- package/dist/components/p-BeE7R9nu.js +5 -0
- package/dist/components/p-BkS6ujyf.js +5 -0
- package/dist/components/p-Bo0QYHJO.js +5 -0
- package/dist/components/p-C1yRmdso.js +5 -0
- package/dist/components/p-C2i2c_io.js +5 -0
- package/dist/components/p-C7v0lVlX.js +5 -0
- package/dist/components/p-CMBsvswx.js +5 -0
- package/dist/components/p-CRrimdz6.js +5 -0
- package/dist/components/p-CWORw84-.js +5 -0
- package/dist/components/p-CXMwM9m4.js +5 -0
- package/dist/components/p-CdDwqbBv.js +5 -0
- package/dist/components/p-CvUMXJCl.js +5 -0
- package/dist/components/p-D3usVJE2.js +16 -0
- package/dist/components/p-D6zroLx5.js +5 -0
- package/dist/components/p-DA5GS53D.js +5 -0
- package/dist/components/p-DBP6K_aq.js +5 -0
- package/dist/components/p-DBmwzG9E.js +5 -0
- package/dist/components/p-DCrVo-8T.js +5 -0
- package/dist/components/p-DFUKDNck.js +5 -0
- package/dist/components/p-DHicj0By.js +5 -0
- package/dist/components/p-DIK54tTj.js +5 -0
- package/dist/components/p-DQRSHR-D.js +5 -0
- package/dist/components/p-DRVMm1Py.js +5 -0
- package/dist/components/p-DWPmUV72.js +5 -0
- package/dist/components/p-DXjQyH6s.js +5 -0
- package/dist/components/p-DYA74R1r.js +5 -0
- package/dist/components/p-DmCxdB9P.js +5 -0
- package/dist/components/p-Dmfk7eEe.js +5 -0
- package/dist/components/p-Dp0xy_3n.js +5 -0
- package/dist/components/p-DxZJrIyL.js +5 -0
- package/dist/components/p-JAkkThgf.js +5 -0
- package/dist/components/p-Ud-WB0hx.js +5 -0
- package/dist/components/p-bhULC15U.js +5 -0
- package/dist/components/p-cF3ia5e9.js +5 -0
- package/dist/components/p-fpMNttbg.js +5 -0
- package/dist/components/p-gvnfuTjd.js +5 -0
- package/dist/components/p-qYONSNcf.js +5 -0
- package/dist/components/p-qhhHGJY1.js +5 -0
- package/dist/components/p-ttI0nvv_.js +5 -0
- package/dist/components/p-ukNmfGNP.js +5 -0
- package/dist/components/p-xa8e1kSW.js +5 -0
- package/dist/esm/app-globals-DVjNHTTs.js +7 -0
- package/dist/esm/br-avatar.entry.js +246 -0
- package/dist/esm/br-breadcrumb-item.entry.js +43 -0
- package/dist/esm/br-breadcrumb.entry.js +441 -0
- package/dist/esm/br-button_2.entry.js +277 -0
- package/dist/esm/br-card.entry.js +109 -0
- package/dist/esm/br-carousel-page.entry.js +78 -0
- package/dist/esm/br-carousel.entry.js +563 -0
- package/dist/esm/br-checkbox-group.entry.js +116 -0
- package/dist/esm/br-checkbox.entry.js +286 -0
- package/dist/esm/br-checkgroup.entry.js +18 -0
- package/dist/esm/br-collapse_2.entry.js +680 -0
- package/dist/esm/br-cookiebar-cookie.entry.js +81 -0
- package/dist/esm/br-cookiebar-group.entry.js +307 -0
- package/dist/esm/br-cookiebar-header.entry.js +37 -0
- package/dist/esm/br-cookiebar-link.entry.js +53 -0
- package/dist/esm/br-cookiebar-note-group.entry.js +68 -0
- package/dist/esm/br-cookiebar-note.entry.js +23 -0
- package/dist/esm/br-cookiebar.entry.js +756 -0
- package/dist/esm/br-crumb.entry.js +49 -0
- package/dist/esm/br-date-picker_3.entry.js +2443 -0
- package/dist/esm/br-datetime-picker.entry.js +1884 -0
- package/dist/esm/br-divider.entry.js +223 -0
- package/dist/esm/br-dropdown_2.entry.js +1997 -0
- package/dist/esm/br-footer-category.entry.js +100 -0
- package/dist/esm/br-footer-item.entry.js +50 -0
- package/dist/esm/br-footer-legal.entry.js +39 -0
- package/dist/esm/br-footer-logo.entry.js +102 -0
- package/dist/esm/br-footer-social.entry.js +69 -0
- package/dist/esm/br-footer.entry.js +90 -0
- package/dist/esm/br-header-function.entry.js +140 -0
- package/dist/esm/br-header-link.entry.js +58 -0
- package/dist/esm/br-header-list.entry.js +277 -0
- package/dist/esm/br-header-logo.entry.js +176 -0
- package/dist/esm/br-header.entry.js +640 -0
- package/dist/esm/br-icon.entry.js +483 -0
- package/dist/esm/br-input.entry.js +597 -0
- package/dist/esm/br-item.entry.js +365 -0
- package/dist/esm/br-link.entry.js +131 -0
- package/dist/esm/br-loading.entry.js +503 -0
- package/dist/esm/br-magic-button.entry.js +91 -0
- package/dist/esm/br-menu-group.entry.js +21 -0
- package/dist/esm/br-menu-header.entry.js +45 -0
- package/dist/esm/br-menu-info.entry.js +36 -0
- package/dist/esm/br-menu-item.entry.js +77 -0
- package/dist/esm/br-menu-link.entry.js +54 -0
- package/dist/esm/br-menu-list.entry.js +147 -0
- package/dist/esm/br-menu-logo.entry.js +73 -0
- package/dist/esm/br-menu-social.entry.js +63 -0
- package/dist/esm/br-menu.entry.js +991 -0
- package/dist/esm/br-modal.entry.js +494 -0
- package/dist/esm/br-notification-body.entry.js +69 -0
- package/dist/esm/br-notification-header.entry.js +46 -0
- package/dist/esm/br-notification-item.entry.js +108 -0
- package/dist/esm/br-notification.entry.js +332 -0
- package/dist/esm/br-pagination.entry.js +882 -0
- package/dist/esm/br-radio-group.entry.js +426 -0
- package/dist/esm/br-radio.entry.js +355 -0
- package/dist/esm/br-scrim.entry.js +1334 -0
- package/dist/esm/br-select-input_3.entry.js +984 -0
- package/dist/esm/br-sign-in.entry.js +124 -0
- package/dist/esm/br-skip-link-item.entry.js +18 -0
- package/dist/esm/br-skip-link.entry.js +360 -0
- package/dist/esm/br-skiplink-item.entry.js +190 -0
- package/dist/esm/br-slider.entry.js +685 -0
- package/dist/esm/br-step_2.entry.js +625 -0
- package/dist/esm/br-switch.entry.js +243 -0
- package/dist/esm/br-tab-item.entry.js +183 -0
- package/dist/esm/br-tab.entry.js +395 -0
- package/dist/esm/br-table-body.entry.js +35 -0
- package/dist/esm/br-table-cell.entry.js +182 -0
- package/dist/esm/br-table-header-cell.entry.js +171 -0
- package/dist/esm/br-table-header.entry.js +35 -0
- package/dist/esm/br-table-row.entry.js +79 -0
- package/dist/esm/br-table.entry.js +678 -0
- package/dist/esm/br-tag.entry.js +491 -0
- package/dist/esm/br-textarea.entry.js +304 -0
- package/dist/esm/br-tooltip.entry.js +625 -0
- package/dist/esm/br-upload.entry.js +579 -0
- package/dist/esm/br-wizard-panel.entry.js +52 -0
- package/dist/esm/br-wizard.entry.js +706 -0
- package/dist/esm/breakpoint-observer-DBmwzG9E.js +141 -0
- package/dist/esm/clamp-gvnfuTjd.js +23 -0
- package/dist/esm/cookiebar.utils-DYA74R1r.js +16 -0
- package/dist/esm/datetime-picker-constants-Bfm58jO6.js +3798 -0
- package/dist/esm/event-DFN_so7I.js +48 -0
- package/dist/esm/floating-surface-dismiss-BWXfdbQH.js +61 -0
- package/dist/esm/floating-ui-BavFwMnx.js +134 -0
- package/dist/esm/floating-ui.dom-DIK54tTj.js +1707 -0
- package/dist/esm/focus-DxZJrIyL.js +26 -0
- package/dist/esm/getNextElement-9S9bgUT0.js +28 -0
- package/dist/esm/iconify-icon-D3usVJE2.js +2303 -0
- package/dist/esm/id-BkS6ujyf.js +18 -0
- package/dist/esm/index-Bo-2igoO.js +671 -0
- package/dist/esm/index-C2RBydfd.js +3258 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/isNil-B-qLmYZC.js +17 -0
- package/dist/esm/isValid-DIUZX1qS.js +3684 -0
- package/dist/esm/loader.js +15 -0
- package/dist/esm/native-dialog-B55qsau4.js +46 -0
- package/dist/esm/navigation-bhULC15U.js +23 -0
- package/dist/esm/parts-Bb5vVlCC.js +17 -0
- package/dist/esm/props-DRVMm1Py.js +22 -0
- package/dist/esm/raf-batcher-cF3ia5e9.js +53 -0
- package/dist/esm/slot-BIG-yees.js +44 -0
- package/dist/esm/swipe-Dmfk7eEe.js +343 -0
- package/dist/esm/table-constants-CXMwM9m4.js +170 -0
- package/dist/esm/validator-D3tVP32U.js +113 -0
- package/dist/esm/webcomponents.js +46 -0
- package/dist/hydrate/index.d.ts +287 -0
- package/dist/hydrate/index.js +67516 -0
- package/dist/hydrate/index.mjs +67506 -0
- package/dist/hydrate/package.json +12 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +5 -0
- package/dist/loader/index.cjs.js +5 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +5 -0
- package/dist/loader/index.js +6 -0
- package/dist/types/components/item/item.d.ts +1 -0
- package/dist/types/components/select/select-list/select-list.d.ts +1 -0
- package/dist/types/components/select/select-option/select-option.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +14 -0
- package/dist/types/components/select/select.types.d.ts +2 -0
- package/dist/types/components/select/select.utils.d.ts +13 -0
- package/dist/webcomponents/index.esm.js +5 -0
- package/dist/webcomponents/p-0196804a.entry.js +5 -0
- package/dist/webcomponents/p-0410186a.entry.js +5 -0
- package/dist/webcomponents/p-0415ef22.entry.js +5 -0
- package/dist/webcomponents/p-0777c7b1.entry.js +5 -0
- package/dist/webcomponents/p-0caa4d12.entry.js +5 -0
- package/dist/webcomponents/p-0d4f718d.entry.js +5 -0
- package/dist/webcomponents/p-0e84c9e8.entry.js +5 -0
- package/dist/webcomponents/p-12286e73.entry.js +5 -0
- package/dist/webcomponents/p-147ac8d3.entry.js +5 -0
- package/dist/webcomponents/p-1580beee.entry.js +5 -0
- package/dist/webcomponents/p-18ee6175.entry.js +5 -0
- package/dist/webcomponents/p-1bca4499.entry.js +5 -0
- package/dist/webcomponents/p-1c303a4e.entry.js +5 -0
- package/dist/webcomponents/p-1d6b0b6f.entry.js +5 -0
- package/dist/webcomponents/p-1d8cb8fd.entry.js +5 -0
- package/dist/webcomponents/p-224daaac.entry.js +5 -0
- package/dist/webcomponents/p-28426d2a.entry.js +5 -0
- package/dist/webcomponents/p-2abd2da0.entry.js +5 -0
- package/dist/webcomponents/p-2fdc51ae.entry.js +5 -0
- package/dist/webcomponents/p-30c428b6.entry.js +5 -0
- package/dist/webcomponents/p-36bbea4e.entry.js +5 -0
- package/dist/webcomponents/p-3907ebfa.entry.js +5 -0
- package/dist/webcomponents/p-39a16f9d.entry.js +5 -0
- package/dist/webcomponents/p-3ebbd2f5.entry.js +5 -0
- package/dist/webcomponents/p-3ef7eac8.entry.js +5 -0
- package/dist/webcomponents/p-45356e9a.entry.js +5 -0
- package/dist/webcomponents/p-46513db4.entry.js +5 -0
- package/dist/webcomponents/p-4c13221a.entry.js +5 -0
- package/dist/webcomponents/p-51ce2c31.entry.js +5 -0
- package/dist/webcomponents/p-52df61cb.entry.js +5 -0
- package/dist/webcomponents/p-569134cf.entry.js +5 -0
- package/dist/webcomponents/p-5ce7db4a.entry.js +5 -0
- package/dist/webcomponents/p-5f373708.entry.js +5 -0
- package/dist/webcomponents/p-5f6afb79.entry.js +5 -0
- package/dist/webcomponents/p-5fc7ba4c.entry.js +5 -0
- package/dist/webcomponents/p-66006312.entry.js +5 -0
- package/dist/webcomponents/p-66b13fd9.entry.js +5 -0
- package/dist/webcomponents/p-6OdfnwnK.js +5 -0
- package/dist/webcomponents/p-750799b7.entry.js +5 -0
- package/dist/webcomponents/p-756ff2ad.entry.js +5 -0
- package/dist/webcomponents/p-765bfe27.entry.js +5 -0
- package/dist/webcomponents/p-7ab96c11.entry.js +5 -0
- package/dist/webcomponents/p-7c2ff8b4.entry.js +5 -0
- package/dist/webcomponents/p-7f7506f0.entry.js +5 -0
- package/dist/webcomponents/p-7fb03a49.entry.js +5 -0
- package/dist/webcomponents/p-82200563.entry.js +5 -0
- package/dist/webcomponents/p-83ff4579.entry.js +5 -0
- package/dist/webcomponents/p-85f8063b.entry.js +5 -0
- package/dist/webcomponents/p-8b558233.entry.js +5 -0
- package/dist/webcomponents/p-8e6c2767.entry.js +5 -0
- package/dist/webcomponents/p-8e819355.entry.js +5 -0
- package/dist/webcomponents/p-92a9b9c4.entry.js +5 -0
- package/dist/webcomponents/p-966ad32f.entry.js +5 -0
- package/dist/webcomponents/p-9679d230.entry.js +5 -0
- package/dist/webcomponents/p-96dd663b.entry.js +5 -0
- package/dist/webcomponents/p-98843fa3.entry.js +5 -0
- package/dist/webcomponents/p-9S9bgUT0.js +5 -0
- package/dist/webcomponents/p-9a375eff.entry.js +5 -0
- package/dist/webcomponents/p-9b358cff.entry.js +5 -0
- package/dist/webcomponents/p-9f7558c7.entry.js +5 -0
- package/dist/webcomponents/p-B-qLmYZC.js +5 -0
- package/dist/webcomponents/p-B55qsau4.js +5 -0
- package/dist/webcomponents/p-BIG-yees.js +5 -0
- package/dist/webcomponents/p-BWXfdbQH.js +5 -0
- package/dist/webcomponents/p-Bb5vVlCC.js +5 -0
- package/dist/webcomponents/p-Bfm58jO6.js +5 -0
- package/dist/webcomponents/p-BhMVJQ4-.js +5 -0
- package/dist/webcomponents/p-BkS6ujyf.js +5 -0
- package/dist/webcomponents/p-C2RBydfd.js +6 -0
- package/dist/webcomponents/p-CO5cOQQU.js +5 -0
- package/dist/webcomponents/p-CXMwM9m4.js +5 -0
- package/dist/webcomponents/p-D3tVP32U.js +5 -0
- package/dist/webcomponents/p-D3usVJE2.js +16 -0
- package/dist/webcomponents/p-DBmwzG9E.js +5 -0
- package/dist/webcomponents/p-DFN_so7I.js +5 -0
- package/dist/webcomponents/p-DIK54tTj.js +5 -0
- package/dist/webcomponents/p-DRVMm1Py.js +5 -0
- package/dist/webcomponents/p-DVjNHTTs.js +5 -0
- package/dist/webcomponents/p-DYA74R1r.js +5 -0
- package/dist/webcomponents/p-Dmfk7eEe.js +5 -0
- package/dist/webcomponents/p-DxZJrIyL.js +5 -0
- package/dist/webcomponents/p-a382e115.entry.js +5 -0
- package/dist/webcomponents/p-a4ae72e3.entry.js +5 -0
- package/dist/webcomponents/p-a994c190.entry.js +5 -0
- package/dist/webcomponents/p-a9ff7c25.entry.js +5 -0
- package/dist/webcomponents/p-bhULC15U.js +5 -0
- package/dist/webcomponents/p-c0b0f531.entry.js +5 -0
- package/dist/webcomponents/p-c211af17.entry.js +5 -0
- package/dist/webcomponents/p-c492d926.entry.js +5 -0
- package/dist/webcomponents/p-c4cfe599.entry.js +5 -0
- package/dist/webcomponents/p-c846e784.entry.js +5 -0
- package/dist/webcomponents/p-c949d993.entry.js +5 -0
- package/dist/webcomponents/p-cF3ia5e9.js +5 -0
- package/dist/webcomponents/p-d1e899cd.entry.js +5 -0
- package/dist/webcomponents/p-d38d82cc.entry.js +5 -0
- package/dist/webcomponents/p-e0ce536a.entry.js +5 -0
- package/dist/webcomponents/p-e1331288.entry.js +5 -0
- package/dist/webcomponents/p-e360a463.entry.js +5 -0
- package/dist/webcomponents/p-f078f972.entry.js +5 -0
- package/dist/webcomponents/p-f26038e2.entry.js +5 -0
- package/dist/webcomponents/p-f303f6b3.entry.js +5 -0
- package/dist/webcomponents/p-f6318e94.entry.js +5 -0
- package/dist/webcomponents/p-f85ee01c.entry.js +5 -0
- package/dist/webcomponents/p-fcd4ae48.entry.js +5 -0
- package/dist/webcomponents/p-ffe0241e.entry.js +5 -0
- package/dist/webcomponents/p-gvnfuTjd.js +5 -0
- package/dist/webcomponents/webcomponents.esm.js +5 -0
- package/package.json +3 -7
- package/cem/.gitkeep +0 -0
|
@@ -0,0 +1,1422 @@
|
|
|
1
|
+
const CONTENT_ELEMENT = document.getElementById('content');
|
|
2
|
+
const COMPONENTS_FILTER = document.getElementById('components-filter');
|
|
3
|
+
const CLEAR_COMPONENTS_FILTER = document.getElementById('clear-components-filter');
|
|
4
|
+
|
|
5
|
+
let renderedFilesContent = {};
|
|
6
|
+
let currentLoadedPath = null;
|
|
7
|
+
const markdownParser = window.marked;
|
|
8
|
+
const DEV_SERVER_CONNECTOR_IFRAME_RE =
|
|
9
|
+
/<iframe\b[^>]*title=["']Stencil Dev Server Connector[^"']*["'][\s\S]*?<\/iframe>/gi;
|
|
10
|
+
let lzStringPromise;
|
|
11
|
+
|
|
12
|
+
function loadLzString() {
|
|
13
|
+
if (window.LZString) return Promise.resolve(window.LZString);
|
|
14
|
+
if (!lzStringPromise) {
|
|
15
|
+
lzStringPromise = new Promise((resolve, reject) => {
|
|
16
|
+
const script = document.createElement('script');
|
|
17
|
+
script.src = `${getBaseUrl()}/assets/lz-string.min.js`;
|
|
18
|
+
script.onload = () => resolve(window.LZString);
|
|
19
|
+
script.onerror = reject;
|
|
20
|
+
document.head.appendChild(script);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return lzStringPromise;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Decode shared state from URL parameters on initialization
|
|
27
|
+
(() => {
|
|
28
|
+
const params = new URLSearchParams(window.location.search);
|
|
29
|
+
const stateParam = params.get('pg_state');
|
|
30
|
+
if (stateParam) {
|
|
31
|
+
const decode = () => {
|
|
32
|
+
try {
|
|
33
|
+
const decompressed = window.LZString?.decompressFromEncodedURIComponent(stateParam);
|
|
34
|
+
if (decompressed) window.SHARED_STATE = JSON.parse(decompressed);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error('Error decoding shared state:', e);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
if (window.LZString) decode();
|
|
40
|
+
else
|
|
41
|
+
loadLzString()
|
|
42
|
+
.then(decode)
|
|
43
|
+
.catch(() => console.error('Error loading shared state decoder.'));
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
|
|
47
|
+
function getBaseUrl() {
|
|
48
|
+
// Se o Pages injetou um prefixo conhecido, usa-o (terminado com /)
|
|
49
|
+
if (typeof window.WWW_PREFIX === 'string' && window.WWW_PREFIX.length > 0) {
|
|
50
|
+
return window.WWW_PREFIX.replace(/\/+$/, '');
|
|
51
|
+
}
|
|
52
|
+
const baseUrl = window.location.pathname.split('/').slice(0, -1).join('/');
|
|
53
|
+
return baseUrl === '' ? '' : baseUrl;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function renderExamplePreview(previewElement, source, edgeToEdge = false) {
|
|
57
|
+
const frame = previewElement.querySelector('iframe');
|
|
58
|
+
if (!frame) return;
|
|
59
|
+
|
|
60
|
+
const baseUrl = getBaseUrl();
|
|
61
|
+
const componentBundleUrl = new URL(`${baseUrl}/build/webcomponents.esm.js`, window.location.href);
|
|
62
|
+
componentBundleUrl.searchParams.set('preview-version', String(Date.now()));
|
|
63
|
+
const componentBundle = componentBundleUrl.href;
|
|
64
|
+
const frameSource = stripDevServerConnector(source);
|
|
65
|
+
|
|
66
|
+
frame.srcdoc = `<!doctype html>
|
|
67
|
+
<html lang="pt-BR">
|
|
68
|
+
<head>
|
|
69
|
+
<meta charset="UTF-8">
|
|
70
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
71
|
+
<base href="${window.location.href}">
|
|
72
|
+
<link rel="stylesheet" href="${new URL(`${baseUrl}/assets/core.min.css`, window.location.href).href}">
|
|
73
|
+
<link rel="stylesheet" href="${new URL(`${baseUrl}/assets/fonts/rawline/400.css`, window.location.href).href}">
|
|
74
|
+
<link rel="stylesheet" href="${new URL(`${baseUrl}/assets/fonts/raleway/wght.css`, window.location.href).href}">
|
|
75
|
+
<link rel="stylesheet" href="${new URL(`${baseUrl}/assets/fonts/fontawesome/css/all.min.css`, window.location.href).href}">
|
|
76
|
+
<style>
|
|
77
|
+
* { font-family: Rawline, Raleway, sans-serif; }
|
|
78
|
+
html, body { margin: 0; min-height: 1px; overflow: visible; }
|
|
79
|
+
body { box-sizing: border-box; padding: 24px 16px; }
|
|
80
|
+
body.wbc-preview-edge-to-edge { padding: 0; }
|
|
81
|
+
br-cookiebar, br-scrim { inset: 0; position: absolute; pointer-events: none; z-index: 1000; }
|
|
82
|
+
br-scrim { --scrim-display-mode: parent; }
|
|
83
|
+
</style>
|
|
84
|
+
</head>
|
|
85
|
+
<body${edgeToEdge ? ' class="wbc-preview-edge-to-edge"' : ''}><main data-wbc-preview-content>${frameSource}</main>
|
|
86
|
+
<script type="module" src="${componentBundle}"></script>
|
|
87
|
+
<script>
|
|
88
|
+
(() => {
|
|
89
|
+
const overlayContentSelector =
|
|
90
|
+
'[part="open-panel"], [part="default-panel"], [part="body"], .cookiebar-body, .content, .br-modal';
|
|
91
|
+
const getOverlayHeight = (overlay) => {
|
|
92
|
+
const measuredHeight = Array.from(overlay.shadowRoot?.querySelectorAll(overlayContentSelector) || []).reduce(
|
|
93
|
+
(height, element) =>
|
|
94
|
+
Math.max(height, element.scrollHeight, element.clientHeight, element.getBoundingClientRect().height),
|
|
95
|
+
0,
|
|
96
|
+
);
|
|
97
|
+
if (measuredHeight > 0) return measuredHeight;
|
|
98
|
+
|
|
99
|
+
const modal = overlay.matches('br-scrim') ? overlay.querySelector('br-modal') : overlay;
|
|
100
|
+
return modal?.shadowRoot?.querySelector('.br-modal')?.getBoundingClientRect().height || 0;
|
|
101
|
+
};
|
|
102
|
+
const getElementsIncludingShadowRoots = (root = document) => {
|
|
103
|
+
const elements = [];
|
|
104
|
+
const visit = (tree) => {
|
|
105
|
+
tree.querySelectorAll('*').forEach((element) => {
|
|
106
|
+
elements.push(element);
|
|
107
|
+
if (element.shadowRoot) visit(element.shadowRoot);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
visit(root);
|
|
111
|
+
return elements;
|
|
112
|
+
};
|
|
113
|
+
const getFloatingHeight = () => {
|
|
114
|
+
const bodyStyle = getComputedStyle(document.body);
|
|
115
|
+
const bottomPadding = parseFloat(bodyStyle.paddingBottom) || 0;
|
|
116
|
+
return getElementsIncludingShadowRoots().reduce((height, element) => {
|
|
117
|
+
if (element.matches('br-cookiebar, br-scrim, br-modal')) return height;
|
|
118
|
+
const style = getComputedStyle(element);
|
|
119
|
+
if (style.position !== 'absolute' && style.position !== 'fixed') return height;
|
|
120
|
+
if (style.display === 'none' || style.visibility === 'hidden') return height;
|
|
121
|
+
return Math.max(height, element.getBoundingClientRect().bottom + bottomPadding);
|
|
122
|
+
}, 0);
|
|
123
|
+
};
|
|
124
|
+
const sendHeight = () => {
|
|
125
|
+
const body = document.body;
|
|
126
|
+
const bodyStyle = getComputedStyle(body);
|
|
127
|
+
const overlayHeight = Array.from(document.querySelectorAll('br-cookiebar, br-scrim, br-modal')).reduce(
|
|
128
|
+
(height, overlay) => Math.max(height, getOverlayHeight(overlay)),
|
|
129
|
+
0,
|
|
130
|
+
);
|
|
131
|
+
const verticalPadding = parseFloat(bodyStyle.paddingTop) + parseFloat(bodyStyle.paddingBottom);
|
|
132
|
+
const height = Math.ceil(
|
|
133
|
+
Math.max(
|
|
134
|
+
body.scrollHeight,
|
|
135
|
+
body.offsetHeight,
|
|
136
|
+
body.getBoundingClientRect().height,
|
|
137
|
+
overlayHeight + verticalPadding,
|
|
138
|
+
getFloatingHeight(),
|
|
139
|
+
),
|
|
140
|
+
);
|
|
141
|
+
parent.postMessage({ type: 'wbc-preview-height', height }, '*');
|
|
142
|
+
};
|
|
143
|
+
document.querySelectorAll('br-cookiebar, br-scrim').forEach((overlay) => {
|
|
144
|
+
overlay.setAttribute('data-wbc-preview-contained', '');
|
|
145
|
+
if (overlay.matches('br-scrim')) overlay.setAttribute('display-mode', 'parent');
|
|
146
|
+
});
|
|
147
|
+
const serialize = (value, seen = new WeakSet()) => {
|
|
148
|
+
if (value instanceof Element) return '<' + value.localName + '>';
|
|
149
|
+
if (value instanceof Event) return { type: value.type };
|
|
150
|
+
if (value && typeof value === 'object') {
|
|
151
|
+
if (seen.has(value)) return '[Circular]';
|
|
152
|
+
seen.add(value);
|
|
153
|
+
if (Array.isArray(value)) return value.map((item) => serialize(item, seen));
|
|
154
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, serialize(item, seen)]));
|
|
155
|
+
}
|
|
156
|
+
return value;
|
|
157
|
+
};
|
|
158
|
+
const sendEvent = (event, dispatchedBy = event.target) => {
|
|
159
|
+
const target = dispatchedBy instanceof Element ? dispatchedBy : dispatchedBy?.host instanceof Element ? dispatchedBy.host : null;
|
|
160
|
+
parent.postMessage({
|
|
161
|
+
type: 'wbc-preview-event',
|
|
162
|
+
eventType: event.type,
|
|
163
|
+
custom: event instanceof CustomEvent,
|
|
164
|
+
detail: event instanceof CustomEvent ? serialize(event.detail) : undefined,
|
|
165
|
+
target: target ? target.localName + (target.id ? '#' + target.id : '') : 'window',
|
|
166
|
+
}, '*');
|
|
167
|
+
};
|
|
168
|
+
['change', 'click', 'input', 'submit'].forEach((name) => document.addEventListener(name, sendEvent, true));
|
|
169
|
+
document.addEventListener('brInternalEvent', sendEvent, true);
|
|
170
|
+
const originalDispatchEvent = EventTarget.prototype.dispatchEvent;
|
|
171
|
+
EventTarget.prototype.dispatchEvent = function dispatchEvent(event) {
|
|
172
|
+
if (event instanceof CustomEvent) sendEvent(event, this);
|
|
173
|
+
return originalDispatchEvent.call(this, event);
|
|
174
|
+
};
|
|
175
|
+
let heightFrame = 0;
|
|
176
|
+
const scheduleHeight = () => {
|
|
177
|
+
cancelAnimationFrame(heightFrame);
|
|
178
|
+
heightFrame = requestAnimationFrame(sendHeight);
|
|
179
|
+
};
|
|
180
|
+
const resizeObserver = new ResizeObserver(scheduleHeight);
|
|
181
|
+
const observeOverlayContent = () => {
|
|
182
|
+
document.querySelectorAll('br-cookiebar, br-scrim, br-modal').forEach((overlay) => {
|
|
183
|
+
overlay.shadowRoot?.querySelectorAll(overlayContentSelector).forEach((element) => {
|
|
184
|
+
resizeObserver.observe(element);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
getElementsIncludingShadowRoots().forEach((element) => {
|
|
188
|
+
const position = getComputedStyle(element).position;
|
|
189
|
+
if (position === 'absolute' || position === 'fixed') resizeObserver.observe(element);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
resizeObserver.observe(document.documentElement);
|
|
193
|
+
resizeObserver.observe(document.body);
|
|
194
|
+
new MutationObserver(() =>
|
|
195
|
+
requestAnimationFrame(() => {
|
|
196
|
+
observeOverlayContent();
|
|
197
|
+
scheduleHeight();
|
|
198
|
+
}),
|
|
199
|
+
).observe(document.body, { attributes: true, childList: true, subtree: true });
|
|
200
|
+
Promise.all(
|
|
201
|
+
[...document.querySelectorAll('*')]
|
|
202
|
+
.map((element) => element.localName)
|
|
203
|
+
.filter((tag, index, tags) => tag.includes('-') && tags.indexOf(tag) === index)
|
|
204
|
+
.map((tag) => customElements.whenDefined(tag)),
|
|
205
|
+
).then(() =>
|
|
206
|
+
requestAnimationFrame(() =>
|
|
207
|
+
requestAnimationFrame(() => {
|
|
208
|
+
observeOverlayContent();
|
|
209
|
+
scheduleHeight();
|
|
210
|
+
}),
|
|
211
|
+
),
|
|
212
|
+
);
|
|
213
|
+
addEventListener('load', scheduleHeight);
|
|
214
|
+
scheduleHeight();
|
|
215
|
+
})();
|
|
216
|
+
</script>
|
|
217
|
+
</body>
|
|
218
|
+
</html>`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function stripDevServerConnector(source) {
|
|
222
|
+
return String(source || '')
|
|
223
|
+
.replace(DEV_SERVER_CONNECTOR_IFRAME_RE, '')
|
|
224
|
+
.trim();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function getFrameworkCode(source, framework) {
|
|
228
|
+
const html = String(source || '').trim();
|
|
229
|
+
const components = Array.from(html.matchAll(/<\/?(br-[a-z0-9-]+)/gi), (match) => match[1]);
|
|
230
|
+
const imports = [...new Set(components)].map((tag) =>
|
|
231
|
+
tag
|
|
232
|
+
.split('-')
|
|
233
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
234
|
+
.join(''),
|
|
235
|
+
);
|
|
236
|
+
const importList = imports.length > 0 ? imports.join(', ') : 'BrButton';
|
|
237
|
+
const pascalMarkup = html.replace(/(<\/?)(br-[a-z0-9-]+)/gi, (_match, prefix, tag) => {
|
|
238
|
+
return `${prefix}${tag
|
|
239
|
+
.split('-')
|
|
240
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
241
|
+
.join('')}`;
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
if (framework === 'javascript') {
|
|
245
|
+
return `import { ${importList} } from '@govbr-ds/webcomponents';\n\nconst example = document.querySelector('${components[0] || 'br-button'}');\n\n// Use o exemplo renderizado para adicionar comportamento com JavaScript.\nconsole.log(example);`;
|
|
246
|
+
}
|
|
247
|
+
if (framework === 'css') {
|
|
248
|
+
return `/* Customize os componentes usando CSS Parts */
|
|
249
|
+
/* Exemplo:
|
|
250
|
+
br-${String(location.pathname).split('/').filter(Boolean).pop() || 'component'}::part(container) {
|
|
251
|
+
background-color: #f8f9fa;
|
|
252
|
+
}
|
|
253
|
+
*/`;
|
|
254
|
+
}
|
|
255
|
+
if (framework === 'angular') {
|
|
256
|
+
return `import { Component } from '@angular/core';\nimport { ${importList} } from '@govbr-ds/webcomponents-angular/standalone';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [${importList}],\n template: \`${html.replace(/`/g, '\\`')}\`,\n})\nexport class AppComponent {}`;
|
|
257
|
+
}
|
|
258
|
+
if (framework === 'react') {
|
|
259
|
+
return `import { ${importList} } from '@govbr-ds/webcomponents-react';\n\nexport default function App() {\n return (\n <>\n ${pascalMarkup.replace(/\n/g, '\n ')}\n </>\n );\n}`;
|
|
260
|
+
}
|
|
261
|
+
return `<script setup lang="ts">\nimport { ${importList} } from '@govbr-ds/webcomponents-vue';\n</script>\n\n<template>\n ${pascalMarkup.replace(/\n/g, '\n ')}\n</template>`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function getFrameworkFiles(source, framework) {
|
|
265
|
+
if (framework !== 'angular') return null;
|
|
266
|
+
|
|
267
|
+
const html = String(source || '').trim();
|
|
268
|
+
const components = Array.from(html.matchAll(/<\/?(br-[a-z0-9-]+)/gi), (match) => match[1]);
|
|
269
|
+
const imports = [...new Set(components)].map((tag) =>
|
|
270
|
+
tag
|
|
271
|
+
.split('-')
|
|
272
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
273
|
+
.join(''),
|
|
274
|
+
);
|
|
275
|
+
const importList = imports.length > 0 ? imports.join(', ') : 'BrButton';
|
|
276
|
+
|
|
277
|
+
return [
|
|
278
|
+
{
|
|
279
|
+
filename: 'app.component.ts',
|
|
280
|
+
language: 'typescript',
|
|
281
|
+
code: `import { Component } from '@angular/core'\nimport { ${importList} } from '@govbr-ds/webcomponents-angular/standalone'\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [${importList}],\n templateUrl: './app.component.html',\n})\nexport class AppComponent {}`,
|
|
282
|
+
},
|
|
283
|
+
{ filename: 'app.component.html', language: 'html', code: html },
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function createReadOnlyFrameworkTab(label, icon, tabId, source, framework) {
|
|
288
|
+
const tab = document.createElement('br-tab-item');
|
|
289
|
+
tab.setAttribute('label', label);
|
|
290
|
+
tab.setAttribute('icon', icon);
|
|
291
|
+
tab.setAttribute('icon-only', 'true');
|
|
292
|
+
tab.setAttribute('title', label);
|
|
293
|
+
tab.setAttribute('tab-item-id', tabId);
|
|
294
|
+
tab.dataset.framework = framework;
|
|
295
|
+
|
|
296
|
+
const files = getFrameworkFiles(source, framework);
|
|
297
|
+
tab._frameworkFiles = files;
|
|
298
|
+
|
|
299
|
+
if (files?.length > 1) {
|
|
300
|
+
const fileTabs = document.createElement('div');
|
|
301
|
+
fileTabs.className = 'wbc-framework-file-tabs';
|
|
302
|
+
fileTabs.setAttribute('role', 'tablist');
|
|
303
|
+
files.forEach((file, index) => {
|
|
304
|
+
const fileTab = document.createElement('button');
|
|
305
|
+
fileTab.className = `wbc-framework-file-tab${index === 0 ? ' is-active' : ''}`;
|
|
306
|
+
fileTab.type = 'button';
|
|
307
|
+
fileTab.dataset.filename = file.filename;
|
|
308
|
+
fileTab.setAttribute('aria-selected', String(index === 0));
|
|
309
|
+
fileTab.setAttribute('role', 'tab');
|
|
310
|
+
fileTab.textContent = file.filename;
|
|
311
|
+
fileTabs.appendChild(fileTab);
|
|
312
|
+
});
|
|
313
|
+
tab.appendChild(fileTabs);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const code = document.createElement('pre');
|
|
317
|
+
code.className = 'wbc-framework-code';
|
|
318
|
+
code.dataset.framework = framework;
|
|
319
|
+
code.dataset.filename = files?.[0]?.filename || '';
|
|
320
|
+
code.textContent = files?.[0]?.code || getFrameworkCode(source, framework);
|
|
321
|
+
tab.appendChild(code);
|
|
322
|
+
return tab;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
async function getPreviewAxeContext(previewFrame) {
|
|
326
|
+
const previewDocument = previewFrame.contentDocument;
|
|
327
|
+
const previewWindow = previewFrame.contentWindow;
|
|
328
|
+
if (!previewDocument?.body || !previewWindow) {
|
|
329
|
+
throw new Error('O conteúdo do preview ainda não está disponível.');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (!previewWindow.axe) {
|
|
333
|
+
const axeScriptUrl = new URL(`${getBaseUrl()}/assets/axe-core.min.js`, window.location.href).href;
|
|
334
|
+
|
|
335
|
+
const response = await fetch(axeScriptUrl);
|
|
336
|
+
if (!response.ok) throw new Error('Não foi possível carregar o Axe-Core no preview.');
|
|
337
|
+
|
|
338
|
+
const axeScript = previewDocument.createElement('script');
|
|
339
|
+
axeScript.textContent = await response.text();
|
|
340
|
+
previewDocument.head.appendChild(axeScript);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const previewContent = previewDocument.querySelector('[data-wbc-preview-content]');
|
|
344
|
+
if (!previewContent) throw new Error('Não foi possível localizar o conteúdo do exemplo.');
|
|
345
|
+
|
|
346
|
+
return { axe: previewWindow.axe, previewContent };
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function getExampleHash(file) {
|
|
350
|
+
return `#${encodeURIComponent(file)}`;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function getRequestedExampleFile() {
|
|
354
|
+
if (!window.location.hash) return null;
|
|
355
|
+
try {
|
|
356
|
+
return decodeURIComponent(window.location.hash.slice(1));
|
|
357
|
+
} catch {
|
|
358
|
+
return window.location.hash.slice(1);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function createExampleElement(path, file, text, isExpanded = false, onOpen) {
|
|
363
|
+
text = stripDevServerConnector(text);
|
|
364
|
+
const contentDiv = document.createElement('br-item');
|
|
365
|
+
contentDiv.classList.add('file', 'wbc-example');
|
|
366
|
+
contentDiv.setAttribute('data-no-selection', '');
|
|
367
|
+
contentDiv.dataset.exampleFile = file;
|
|
368
|
+
const controlsScope = `wbc-example-${path}-${file}`.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
369
|
+
contentDiv.dataset.controlsScope = controlsScope;
|
|
370
|
+
|
|
371
|
+
const dropdown = document.createElement('br-dropdown');
|
|
372
|
+
dropdown.className = 'wbc-example-dropdown';
|
|
373
|
+
if (isExpanded) dropdown.setAttribute('is-open', '');
|
|
374
|
+
let initializeExample;
|
|
375
|
+
let isInitialized = false;
|
|
376
|
+
|
|
377
|
+
const preview = document.createElement('div');
|
|
378
|
+
preview.className = 'wbc-example-preview';
|
|
379
|
+
let previewFrame;
|
|
380
|
+
|
|
381
|
+
// --- EDITOR CONTAINER ---
|
|
382
|
+
const editorContainer = document.createElement('div');
|
|
383
|
+
editorContainer.className = 'wbc-example-editor-container';
|
|
384
|
+
|
|
385
|
+
const tabComponent = document.createElement('br-tab');
|
|
386
|
+
tabComponent.setAttribute('density', 'small');
|
|
387
|
+
tabComponent.setAttribute('active-tab-id', 'code-tab');
|
|
388
|
+
|
|
389
|
+
const codeTabItem = document.createElement('br-tab-item');
|
|
390
|
+
codeTabItem.setAttribute('label', 'HTML');
|
|
391
|
+
codeTabItem.setAttribute('icon', 'fab fa-html5');
|
|
392
|
+
codeTabItem.setAttribute('icon-only', 'true');
|
|
393
|
+
codeTabItem.setAttribute('title', 'HTML');
|
|
394
|
+
codeTabItem.setAttribute('tab-item-id', 'code-tab');
|
|
395
|
+
codeTabItem.setAttribute('active', 'true');
|
|
396
|
+
codeTabItem.setAttribute('is-active', 'true');
|
|
397
|
+
|
|
398
|
+
const eventsTabItem = document.createElement('br-tab-item');
|
|
399
|
+
eventsTabItem.setAttribute('label', 'Console');
|
|
400
|
+
eventsTabItem.setAttribute('icon', 'fas fa-terminal');
|
|
401
|
+
eventsTabItem.setAttribute('icon-only', 'true');
|
|
402
|
+
eventsTabItem.setAttribute('title', 'Console');
|
|
403
|
+
eventsTabItem.setAttribute('tab-item-id', 'events-tab');
|
|
404
|
+
|
|
405
|
+
const controlsTabItem = document.createElement('br-tab-item');
|
|
406
|
+
controlsTabItem.setAttribute('label', 'Controles');
|
|
407
|
+
controlsTabItem.setAttribute('icon', 'fas fa-sliders-h');
|
|
408
|
+
controlsTabItem.setAttribute('icon-only', 'true');
|
|
409
|
+
controlsTabItem.setAttribute('title', 'Controles');
|
|
410
|
+
controlsTabItem.setAttribute('tab-item-id', 'controls-tab');
|
|
411
|
+
|
|
412
|
+
const javascriptTabItem = createReadOnlyFrameworkTab('JS', 'fab fa-js', 'javascript-tab', text, 'javascript');
|
|
413
|
+
const cssTabItem = createReadOnlyFrameworkTab('CSS', 'fab fa-css3-alt', 'css-tab', text, 'css');
|
|
414
|
+
const angularTabItem = createReadOnlyFrameworkTab('Angular', 'fab fa-angular', 'angular-tab', text, 'angular');
|
|
415
|
+
const reactTabItem = createReadOnlyFrameworkTab('React', 'fab fa-react', 'react-tab', text, 'react');
|
|
416
|
+
const vueTabItem = createReadOnlyFrameworkTab('Vue', 'fab fa-vuejs', 'vue-tab', text, 'vue');
|
|
417
|
+
const frameworkTabItems = [javascriptTabItem, cssTabItem, angularTabItem, reactTabItem, vueTabItem];
|
|
418
|
+
const frameworkEditors = new Map();
|
|
419
|
+
const refreshFrameworkEditors = () => {
|
|
420
|
+
requestAnimationFrame(() => {
|
|
421
|
+
frameworkEditors.forEach((editor) => {
|
|
422
|
+
editor.refresh?.();
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
const getFrameworkEditorLanguage = (framework) => {
|
|
427
|
+
if (framework === 'css') return 'css';
|
|
428
|
+
if (framework === 'angular') return 'typescript';
|
|
429
|
+
if (framework === 'react') return 'tsx';
|
|
430
|
+
return 'html';
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const selectFrameworkFile = (tab, filename, editor = frameworkEditors.get(tab)) => {
|
|
434
|
+
const files = tab._frameworkFiles || [];
|
|
435
|
+
const file = files.find((item) => item.filename === filename) || files[0];
|
|
436
|
+
if (!file) return;
|
|
437
|
+
|
|
438
|
+
tab.dataset.activeFilename = file.filename;
|
|
439
|
+
tab.querySelectorAll('.wbc-framework-file-tab').forEach((fileTab) => {
|
|
440
|
+
const isActive = fileTab.dataset.filename === file.filename;
|
|
441
|
+
fileTab.classList.toggle('is-active', isActive);
|
|
442
|
+
fileTab.setAttribute('aria-selected', String(isActive));
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
const code = tab.querySelector('.wbc-framework-code');
|
|
446
|
+
if (editor) {
|
|
447
|
+
editor.setLanguage?.(file.language);
|
|
448
|
+
editor.setValue(file.code);
|
|
449
|
+
} else if (code) {
|
|
450
|
+
code.dataset.filename = file.filename;
|
|
451
|
+
code.textContent = file.code;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const updateFrameworkCode = (source) => {
|
|
456
|
+
frameworkTabItems.forEach((tab) => {
|
|
457
|
+
const framework = tab.dataset.framework;
|
|
458
|
+
const files = getFrameworkFiles(source, framework);
|
|
459
|
+
tab._frameworkFiles = files;
|
|
460
|
+
const editor = frameworkEditors.get(tab);
|
|
461
|
+
if (files) {
|
|
462
|
+
selectFrameworkFile(tab, tab.dataset.activeFilename, editor);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const value = getFrameworkCode(source, framework);
|
|
467
|
+
if (editor) editor.setValue(value);
|
|
468
|
+
else {
|
|
469
|
+
const code = tab.querySelector('.wbc-framework-code');
|
|
470
|
+
if (code) code.textContent = value;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
const createActionButton = (iconClass, tooltipText, ariaLabel, onClick) => {
|
|
476
|
+
const tooltip = document.createElement('br-tooltip');
|
|
477
|
+
tooltip.setAttribute('position', 'bottom');
|
|
478
|
+
|
|
479
|
+
const button = document.createElement('br-button');
|
|
480
|
+
button.setAttribute('slot', 'trigger');
|
|
481
|
+
button.setAttribute('shape', 'circle');
|
|
482
|
+
button.setAttribute('density', 'small');
|
|
483
|
+
button.setAttribute('emphasis', 'secondary');
|
|
484
|
+
button.setAttribute('aria-label', ariaLabel);
|
|
485
|
+
|
|
486
|
+
const icon = document.createElement('i');
|
|
487
|
+
icon.className = iconClass;
|
|
488
|
+
button.appendChild(icon);
|
|
489
|
+
|
|
490
|
+
const tooltipContent = document.createElement('div');
|
|
491
|
+
tooltipContent.setAttribute('slot', 'content');
|
|
492
|
+
tooltipContent.textContent = tooltipText;
|
|
493
|
+
|
|
494
|
+
tooltip.appendChild(button);
|
|
495
|
+
tooltip.appendChild(tooltipContent);
|
|
496
|
+
|
|
497
|
+
button.addEventListener('click', onClick);
|
|
498
|
+
|
|
499
|
+
return { tooltip, button, icon, tooltipContent };
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const editorState = { value: text };
|
|
503
|
+
let editorApi = null;
|
|
504
|
+
const getEditorValue = () => editorApi?.getValue() ?? editorState.value;
|
|
505
|
+
const refreshEditor = () => {
|
|
506
|
+
requestAnimationFrame(() => requestAnimationFrame(() => editorApi?.refresh?.()));
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// 1. Copy Action
|
|
510
|
+
const copyAction = createActionButton('fas fa-copy', 'Copiar código', 'Copiar código', async () => {
|
|
511
|
+
try {
|
|
512
|
+
if (navigator.clipboard?.writeText) {
|
|
513
|
+
await navigator.clipboard.writeText(getEditorValue());
|
|
514
|
+
} else {
|
|
515
|
+
const fallback = document.createElement('textarea');
|
|
516
|
+
fallback.value = getEditorValue();
|
|
517
|
+
fallback.setAttribute('readonly', '');
|
|
518
|
+
fallback.style.position = 'fixed';
|
|
519
|
+
fallback.style.opacity = '0';
|
|
520
|
+
document.body.appendChild(fallback);
|
|
521
|
+
fallback.select();
|
|
522
|
+
document.execCommand('copy');
|
|
523
|
+
fallback.remove();
|
|
524
|
+
}
|
|
525
|
+
copyAction.icon.className = 'fas fa-check text-success';
|
|
526
|
+
copyAction.tooltipContent.textContent = 'Copiado!';
|
|
527
|
+
} catch {
|
|
528
|
+
copyAction.tooltipContent.textContent = 'Erro ao copiar';
|
|
529
|
+
}
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
copyAction.icon.className = 'fas fa-copy';
|
|
532
|
+
copyAction.tooltipContent.textContent = 'Copiar código';
|
|
533
|
+
}, 2000);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// 2. Share Action
|
|
537
|
+
const shareAction = createActionButton(
|
|
538
|
+
'fas fa-share-alt',
|
|
539
|
+
'Compartilhar exemplo',
|
|
540
|
+
'Compartilhar exemplo',
|
|
541
|
+
async () => {
|
|
542
|
+
try {
|
|
543
|
+
await loadLzString();
|
|
544
|
+
} catch {
|
|
545
|
+
alert('Biblioteca de compartilhamento não carregada.');
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
const state = {
|
|
549
|
+
p: path,
|
|
550
|
+
f: file,
|
|
551
|
+
h: getEditorValue(),
|
|
552
|
+
};
|
|
553
|
+
try {
|
|
554
|
+
const json = JSON.stringify(state);
|
|
555
|
+
const encoded = window.LZString.compressToEncodedURIComponent(json);
|
|
556
|
+
const url = new URL(window.location.href);
|
|
557
|
+
url.searchParams.set('pg_state', encoded);
|
|
558
|
+
url.hash = getExampleHash(file);
|
|
559
|
+
|
|
560
|
+
await navigator.clipboard.writeText(url.toString());
|
|
561
|
+
|
|
562
|
+
shareAction.icon.className = 'fas fa-check text-success';
|
|
563
|
+
shareAction.tooltipContent.textContent = 'Link copiado!';
|
|
564
|
+
setTimeout(() => {
|
|
565
|
+
shareAction.icon.className = 'fas fa-share-alt';
|
|
566
|
+
shareAction.tooltipContent.textContent = 'Compartilhar exemplo';
|
|
567
|
+
}, 2000);
|
|
568
|
+
} catch (err) {
|
|
569
|
+
console.error(err);
|
|
570
|
+
shareAction.tooltipContent.textContent = 'Erro ao compartilhar';
|
|
571
|
+
setTimeout(() => {
|
|
572
|
+
shareAction.icon.className = 'fas fa-share-alt';
|
|
573
|
+
shareAction.tooltipContent.textContent = 'Compartilhar exemplo';
|
|
574
|
+
}, 2000);
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
// 3. Fullscreen Action
|
|
580
|
+
const fsAction = createActionButton('fas fa-expand-arrows-alt', 'Tela cheia', 'Tela cheia', () => {
|
|
581
|
+
const isFullscreen = contentDiv.classList.toggle('is-fullscreen');
|
|
582
|
+
if (isFullscreen) {
|
|
583
|
+
fsAction.icon.className = 'fas fa-compress-arrows-alt';
|
|
584
|
+
fsAction.tooltipContent.textContent = 'Fechar tela cheia';
|
|
585
|
+
requestAnimationFrame(() => editorApi?.refresh?.());
|
|
586
|
+
} else {
|
|
587
|
+
fsAction.icon.className = 'fas fa-expand-arrows-alt';
|
|
588
|
+
fsAction.tooltipContent.textContent = 'Tela cheia';
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
// --- EXAMPLE CARD HEADER ---
|
|
593
|
+
const header = document.createElement('div');
|
|
594
|
+
header.className = 'wbc-example-header';
|
|
595
|
+
|
|
596
|
+
const title = document.createElement('h3');
|
|
597
|
+
title.textContent = file;
|
|
598
|
+
header.appendChild(title);
|
|
599
|
+
|
|
600
|
+
// Group all actions and toggle on the right
|
|
601
|
+
const headerActions = document.createElement('div');
|
|
602
|
+
headerActions.className = 'wbc-example-header-actions';
|
|
603
|
+
|
|
604
|
+
const exampleToggleTooltip = document.createElement('br-tooltip');
|
|
605
|
+
exampleToggleTooltip.setAttribute('position', 'bottom');
|
|
606
|
+
|
|
607
|
+
const exampleToggle = document.createElement('br-button');
|
|
608
|
+
exampleToggle.className = 'wbc-example-toggle';
|
|
609
|
+
exampleToggle.setAttribute('density', 'small');
|
|
610
|
+
exampleToggle.setAttribute('emphasis', 'secondary');
|
|
611
|
+
exampleToggle.setAttribute('shape', 'circle');
|
|
612
|
+
exampleToggle.setAttribute('aria-label', isExpanded ? 'Recolher exemplo' : 'Expandir exemplo');
|
|
613
|
+
exampleToggle.setAttribute('slot', 'trigger');
|
|
614
|
+
|
|
615
|
+
const exampleIcon = document.createElement('i');
|
|
616
|
+
exampleIcon.className = `fas fa-chevron-${isExpanded ? 'up' : 'down'}`;
|
|
617
|
+
exampleToggle.appendChild(exampleIcon);
|
|
618
|
+
|
|
619
|
+
const exampleToggleTooltipContent = document.createElement('div');
|
|
620
|
+
exampleToggleTooltipContent.setAttribute('slot', 'content');
|
|
621
|
+
exampleToggleTooltipContent.setAttribute('position', 'bottom');
|
|
622
|
+
exampleToggleTooltipContent.textContent = isExpanded ? 'Recolher exemplo' : 'Expandir exemplo';
|
|
623
|
+
|
|
624
|
+
exampleToggleTooltip.append(exampleToggle, exampleToggleTooltipContent);
|
|
625
|
+
|
|
626
|
+
header.setAttribute('slot', 'trigger');
|
|
627
|
+
header.addEventListener('click', (event) => {
|
|
628
|
+
if (event.target.closest('.wbc-example-header-actions') && !event.target.closest('.wbc-example-toggle')) {
|
|
629
|
+
event.stopPropagation();
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
const updateExampleToggle = (open) => {
|
|
634
|
+
exampleIcon.className = `fas fa-chevron-${open ? 'up' : 'down'}`;
|
|
635
|
+
exampleToggle.setAttribute('aria-label', open ? 'Recolher exemplo' : 'Expandir exemplo');
|
|
636
|
+
exampleToggleTooltipContent.textContent = open ? 'Recolher exemplo' : 'Expandir exemplo';
|
|
637
|
+
if (open) requestAnimationFrame(() => editorApi?.refresh?.());
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
dropdown.addEventListener('brDropdownOpenChange', (event) => {
|
|
641
|
+
const open = event.detail.open;
|
|
642
|
+
updateExampleToggle(open);
|
|
643
|
+
if (open) {
|
|
644
|
+
if (!isInitialized) {
|
|
645
|
+
dropdown.append(preview, fullscreenBottomPanel);
|
|
646
|
+
initializeExample?.();
|
|
647
|
+
isInitialized = true;
|
|
648
|
+
}
|
|
649
|
+
onOpen?.(file, contentDiv);
|
|
650
|
+
} else if (window.location.hash === getExampleHash(file)) {
|
|
651
|
+
window.history.replaceState({}, '', `${window.location.pathname}${window.location.search}`);
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
headerActions.append(copyAction.tooltip, shareAction.tooltip, fsAction.tooltip, exampleToggleTooltip);
|
|
656
|
+
header.appendChild(headerActions);
|
|
657
|
+
|
|
658
|
+
const editorWrapper = document.createElement('div');
|
|
659
|
+
editorWrapper.className = 'wbc-example-editor-wrapper';
|
|
660
|
+
|
|
661
|
+
const eventsWrapper = document.createElement('div');
|
|
662
|
+
eventsWrapper.className = 'wbc-example-events-wrapper';
|
|
663
|
+
|
|
664
|
+
const eventsHeader = document.createElement('div');
|
|
665
|
+
eventsHeader.className = 'wbc-events-header';
|
|
666
|
+
|
|
667
|
+
const filterContainer = document.createElement('div');
|
|
668
|
+
filterContainer.className = 'wbc-events-filter-container';
|
|
669
|
+
filterContainer.style.display = 'flex';
|
|
670
|
+
filterContainer.style.gap = '8px';
|
|
671
|
+
filterContainer.style.alignItems = 'flex-end';
|
|
672
|
+
filterContainer.style.marginBottom = '8px';
|
|
673
|
+
|
|
674
|
+
const eventFilterInput = document.createElement('br-input');
|
|
675
|
+
eventFilterInput.setAttribute('placeholder', 'Filtrar eventos...');
|
|
676
|
+
eventFilterInput.setAttribute('density', 'small');
|
|
677
|
+
eventFilterInput.style.flex = '1';
|
|
678
|
+
|
|
679
|
+
const copyEventsAction = createActionButton(
|
|
680
|
+
'fas fa-copy',
|
|
681
|
+
'Copiar lista de eventos',
|
|
682
|
+
'Copiar lista de eventos',
|
|
683
|
+
async () => {
|
|
684
|
+
const visibleItems = Array.from(eventsList.querySelectorAll('li')).filter((li) => li.style.display !== 'none');
|
|
685
|
+
const textToCopy = visibleItems
|
|
686
|
+
.map((li) => {
|
|
687
|
+
const name = li.querySelector('.wbc-event-console-event-name').textContent;
|
|
688
|
+
const target = li.querySelector('.wbc-event-console-target').textContent;
|
|
689
|
+
const payload = li.querySelector('.wbc-event-console-detail')?.textContent || '';
|
|
690
|
+
return `${name}${target}${payload ? `\nPayload: ${payload}` : ''}`;
|
|
691
|
+
})
|
|
692
|
+
.join('\n---\n');
|
|
693
|
+
|
|
694
|
+
try {
|
|
695
|
+
if (navigator.clipboard?.writeText) {
|
|
696
|
+
await navigator.clipboard.writeText(textToCopy);
|
|
697
|
+
}
|
|
698
|
+
copyEventsAction.icon.className = 'fas fa-check text-success';
|
|
699
|
+
copyEventsAction.tooltipContent.textContent = 'Copiado!';
|
|
700
|
+
} catch (err) {
|
|
701
|
+
console.error('Erro ao copiar eventos:', err);
|
|
702
|
+
}
|
|
703
|
+
setTimeout(() => {
|
|
704
|
+
copyEventsAction.icon.className = 'fas fa-copy';
|
|
705
|
+
copyEventsAction.tooltipContent.textContent = 'Copiar lista de eventos';
|
|
706
|
+
}, 2000);
|
|
707
|
+
},
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
filterContainer.append(eventFilterInput, copyEventsAction.tooltip);
|
|
711
|
+
|
|
712
|
+
const eventsHelp = document.createElement('p');
|
|
713
|
+
eventsHelp.className = 'wbc-events-help';
|
|
714
|
+
eventsHelp.textContent = 'Eventos emitidos pelo componente aparecem abaixo.';
|
|
715
|
+
|
|
716
|
+
const eventsActions = document.createElement('div');
|
|
717
|
+
eventsActions.className = 'wbc-events-actions';
|
|
718
|
+
eventsActions.style.display = 'flex';
|
|
719
|
+
eventsActions.style.gap = '5px';
|
|
720
|
+
|
|
721
|
+
const pauseBtn = document.createElement('br-button');
|
|
722
|
+
pauseBtn.setAttribute('density', 'small');
|
|
723
|
+
pauseBtn.setAttribute('emphasis', 'secondary');
|
|
724
|
+
pauseBtn.textContent = 'Pausar';
|
|
725
|
+
|
|
726
|
+
const clearBtn = document.createElement('br-button');
|
|
727
|
+
clearBtn.setAttribute('density', 'small');
|
|
728
|
+
clearBtn.setAttribute('emphasis', 'secondary');
|
|
729
|
+
clearBtn.textContent = 'Limpar';
|
|
730
|
+
|
|
731
|
+
eventsActions.append(pauseBtn, clearBtn);
|
|
732
|
+
eventsHeader.append(eventsHelp, filterContainer, eventsActions);
|
|
733
|
+
|
|
734
|
+
const eventsList = document.createElement('ol');
|
|
735
|
+
eventsList.className = 'wbc-events-list';
|
|
736
|
+
|
|
737
|
+
eventsWrapper.append(eventsHeader, eventsList);
|
|
738
|
+
|
|
739
|
+
const applyFilter = () => {
|
|
740
|
+
const val = String(eventFilterInput.value ?? '').toLowerCase();
|
|
741
|
+
Array.from(eventsList.children).forEach((li) => {
|
|
742
|
+
const text = li.textContent.toLowerCase();
|
|
743
|
+
li.style.display = text.includes(val) ? '' : 'none';
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
eventFilterInput.addEventListener('input', applyFilter);
|
|
748
|
+
eventFilterInput.addEventListener('valueChange', applyFilter);
|
|
749
|
+
|
|
750
|
+
let newEventsCount = 0;
|
|
751
|
+
let isPaused = false;
|
|
752
|
+
|
|
753
|
+
pauseBtn.addEventListener('click', () => {
|
|
754
|
+
isPaused = !isPaused;
|
|
755
|
+
pauseBtn.textContent = isPaused ? 'Continuar' : 'Pausar';
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
clearBtn.addEventListener('click', () => {
|
|
759
|
+
eventsList.replaceChildren();
|
|
760
|
+
eventsTabItem.setAttribute('label', 'Console');
|
|
761
|
+
newEventsCount = 0;
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
const serialize = (value) => {
|
|
765
|
+
if (value === undefined) return '';
|
|
766
|
+
try {
|
|
767
|
+
return JSON.stringify(
|
|
768
|
+
value,
|
|
769
|
+
(_key, nestedValue) => {
|
|
770
|
+
if (nestedValue instanceof Element) {
|
|
771
|
+
return `<${nestedValue.localName}>`;
|
|
772
|
+
}
|
|
773
|
+
if (nestedValue instanceof Event) {
|
|
774
|
+
return { type: nestedValue.type };
|
|
775
|
+
}
|
|
776
|
+
return nestedValue;
|
|
777
|
+
},
|
|
778
|
+
2,
|
|
779
|
+
);
|
|
780
|
+
} catch {
|
|
781
|
+
return String(value);
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
const describeTarget = (target) => {
|
|
786
|
+
if (!(target instanceof Element)) return 'window';
|
|
787
|
+
const id = target.id ? `#${target.id}` : '';
|
|
788
|
+
const classes = target.classList.length > 0 ? `.${Array.from(target.classList).slice(0, 2).join('.')}` : '';
|
|
789
|
+
return `${target.localName}${id}${classes}`;
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const addEventEntry = (event, dispatchedBy, targetDescription) => {
|
|
793
|
+
if (isPaused) return;
|
|
794
|
+
|
|
795
|
+
const item = document.createElement('li');
|
|
796
|
+
const name = document.createElement('span');
|
|
797
|
+
const target = document.createElement('span');
|
|
798
|
+
|
|
799
|
+
name.className = 'wbc-event-console-event-name';
|
|
800
|
+
name.textContent = event.type;
|
|
801
|
+
target.className = 'wbc-event-console-target';
|
|
802
|
+
target.textContent = ` — ${targetDescription || describeTarget(event.target || dispatchedBy)}`;
|
|
803
|
+
item.append(name, target);
|
|
804
|
+
|
|
805
|
+
if (event instanceof CustomEvent && event.detail !== undefined && event.detail !== null) {
|
|
806
|
+
const detailsEl = document.createElement('details');
|
|
807
|
+
detailsEl.className = 'wbc-event-console-details-container';
|
|
808
|
+
|
|
809
|
+
const summaryEl = document.createElement('summary');
|
|
810
|
+
summaryEl.textContent = 'payload';
|
|
811
|
+
|
|
812
|
+
const preEl = document.createElement('pre');
|
|
813
|
+
preEl.className = 'wbc-event-console-detail';
|
|
814
|
+
preEl.textContent = serialize(event.detail);
|
|
815
|
+
|
|
816
|
+
detailsEl.append(summaryEl, preEl);
|
|
817
|
+
item.appendChild(detailsEl);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
eventsList.prepend(item);
|
|
821
|
+
applyFilter(); // Garante que novos eventos respeitem o filtro atual
|
|
822
|
+
|
|
823
|
+
const maxEntries = 100;
|
|
824
|
+
while (eventsList.children.length > maxEntries) {
|
|
825
|
+
eventsList.lastElementChild?.remove();
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const isActive = eventsTabItem.getAttribute('is-active') === 'true';
|
|
829
|
+
if (!isActive) {
|
|
830
|
+
newEventsCount++;
|
|
831
|
+
eventsTabItem.setAttribute('label', `Console (${newEventsCount})`);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
window.WBCActiveRecorders = window.WBCActiveRecorders || [];
|
|
836
|
+
const recorder = {
|
|
837
|
+
preview,
|
|
838
|
+
addEvent: addEventEntry,
|
|
839
|
+
};
|
|
840
|
+
window.addEventListener('message', (event) => {
|
|
841
|
+
if (!previewFrame || event.source !== previewFrame.contentWindow || !event.data?.type?.startsWith('wbc-preview-'))
|
|
842
|
+
return;
|
|
843
|
+
if (event.data.type === 'wbc-preview-height') {
|
|
844
|
+
const maxHeight = contentDiv.classList.contains('is-fullscreen') ? Infinity : window.innerHeight * 0.75;
|
|
845
|
+
previewFrame.style.height = `${Math.max(1, Math.min(event.data.height, maxHeight))}px`;
|
|
846
|
+
} else if (event.data.type === 'wbc-preview-event') {
|
|
847
|
+
const bridgedEvent = event.data.custom
|
|
848
|
+
? new CustomEvent(event.data.eventType, { detail: event.data.detail })
|
|
849
|
+
: new Event(event.data.eventType);
|
|
850
|
+
addEventEntry(bridgedEvent, previewFrame, event.data.target);
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
window.WBCActiveRecorders.push(recorder);
|
|
854
|
+
window.WBCRegisterNativeEventRecorder?.(recorder);
|
|
855
|
+
|
|
856
|
+
const setEditorValue = (value) => {
|
|
857
|
+
editorState.value = value;
|
|
858
|
+
editorApi?.setValue(value);
|
|
859
|
+
applyEditorValue(value);
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
tabComponent.addEventListener('brTabChange', (event) => {
|
|
863
|
+
const activeTabId = event.detail.tabId;
|
|
864
|
+
if (activeTabId !== 'code-tab') {
|
|
865
|
+
eventsTabItem.setAttribute('label', 'Console');
|
|
866
|
+
newEventsCount = 0;
|
|
867
|
+
}
|
|
868
|
+
if (frameworkTabItems.some((tab) => tab.getAttribute('tab-item-id') === activeTabId)) {
|
|
869
|
+
refreshFrameworkEditors();
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
codeTabItem.appendChild(editorWrapper);
|
|
874
|
+
eventsTabItem.appendChild(eventsWrapper);
|
|
875
|
+
|
|
876
|
+
// --- ACCESSIBILITY TAB ---
|
|
877
|
+
const a11yTabItem = document.createElement('br-tab-item');
|
|
878
|
+
a11yTabItem.setAttribute('label', 'Acessibilidade');
|
|
879
|
+
a11yTabItem.setAttribute('icon', 'fas fa-universal-access');
|
|
880
|
+
a11yTabItem.setAttribute('icon-only', 'true');
|
|
881
|
+
a11yTabItem.setAttribute('title', 'Acessibilidade');
|
|
882
|
+
a11yTabItem.setAttribute('tab-item-id', 'a11y-tab');
|
|
883
|
+
|
|
884
|
+
const a11yWrapper = document.createElement('div');
|
|
885
|
+
a11yWrapper.className = 'wbc-example-a11y-wrapper';
|
|
886
|
+
|
|
887
|
+
const a11yHeader = document.createElement('div');
|
|
888
|
+
a11yHeader.className = 'wbc-a11y-header';
|
|
889
|
+
|
|
890
|
+
const a11yHelp = document.createElement('p');
|
|
891
|
+
a11yHelp.className = 'wbc-a11y-help';
|
|
892
|
+
a11yHelp.textContent = 'Analisa a acessibilidade do exemplo acima usando o Axe-Core.';
|
|
893
|
+
|
|
894
|
+
a11yHeader.appendChild(a11yHelp);
|
|
895
|
+
|
|
896
|
+
const a11yResults = document.createElement('div');
|
|
897
|
+
a11yResults.className = 'wbc-a11y-results';
|
|
898
|
+
|
|
899
|
+
a11yWrapper.append(a11yHeader, a11yResults);
|
|
900
|
+
a11yTabItem.appendChild(a11yWrapper);
|
|
901
|
+
|
|
902
|
+
const runAccessibilityAudit = async () => {
|
|
903
|
+
if (!window.axe) {
|
|
904
|
+
a11yResults.innerHTML =
|
|
905
|
+
'<p class="text-danger mt-3">Axe-Core não está carregado. Verifique a conexão ou recarregue a página.</p>';
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
a11yResults.innerHTML =
|
|
910
|
+
'<p class="mt-3"><i class="fas fa-spinner fa-spin mr-2"></i>Analisando acessibilidade...</p>';
|
|
911
|
+
|
|
912
|
+
try {
|
|
913
|
+
const { axe, previewContent } = await getPreviewAxeContext(previewFrame);
|
|
914
|
+
const results = await axe.run(previewContent);
|
|
915
|
+
|
|
916
|
+
if (results.violations.length === 0) {
|
|
917
|
+
a11yResults.innerHTML =
|
|
918
|
+
'<p class="text-success mt-3"><i class="fas fa-check-circle mr-2"></i>Nenhum problema de acessibilidade detectado!</p>';
|
|
919
|
+
} else {
|
|
920
|
+
a11yResults.innerHTML = '';
|
|
921
|
+
|
|
922
|
+
const violationsList = document.createElement('ul');
|
|
923
|
+
violationsList.className = 'wbc-a11y-violations-list mt-3';
|
|
924
|
+
|
|
925
|
+
results.violations.forEach((violation) => {
|
|
926
|
+
const item = document.createElement('li');
|
|
927
|
+
item.className = 'wbc-a11y-violation-item mb-3';
|
|
928
|
+
|
|
929
|
+
const title = document.createElement('div');
|
|
930
|
+
title.className = 'wbc-a11y-violation-title';
|
|
931
|
+
|
|
932
|
+
const impactBadge = document.createElement('span');
|
|
933
|
+
impactBadge.className = `badge-impact impact-${violation.impact}`;
|
|
934
|
+
impactBadge.textContent = violation.impact;
|
|
935
|
+
|
|
936
|
+
const helpText = document.createElement('span');
|
|
937
|
+
helpText.innerHTML = `<strong>${violation.help}</strong>`;
|
|
938
|
+
|
|
939
|
+
title.append(helpText, impactBadge);
|
|
940
|
+
|
|
941
|
+
const desc = document.createElement('p');
|
|
942
|
+
desc.className = 'wbc-a11y-violation-desc';
|
|
943
|
+
desc.textContent = violation.description;
|
|
944
|
+
|
|
945
|
+
const helpUrl = document.createElement('a');
|
|
946
|
+
helpUrl.href = violation.helpUrl;
|
|
947
|
+
helpUrl.target = '_blank';
|
|
948
|
+
helpUrl.className = 'wbc-a11y-violation-link';
|
|
949
|
+
helpUrl.textContent = 'Mais informações';
|
|
950
|
+
|
|
951
|
+
item.append(title, desc, helpUrl);
|
|
952
|
+
violationsList.appendChild(item);
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
a11yResults.appendChild(violationsList);
|
|
956
|
+
}
|
|
957
|
+
} catch (err) {
|
|
958
|
+
console.error(err);
|
|
959
|
+
a11yResults.innerHTML = `<p class="text-danger mt-3">Erro ao executar a análise: ${err.message}</p>`;
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
tabComponent.addEventListener('brTabChange', (event) => {
|
|
964
|
+
if (event.detail.tabId === 'a11y-tab') runAccessibilityAudit();
|
|
965
|
+
if (event.detail.tabId === 'code-tab') refreshEditor();
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
tabComponent.append(
|
|
969
|
+
codeTabItem,
|
|
970
|
+
controlsTabItem,
|
|
971
|
+
javascriptTabItem,
|
|
972
|
+
cssTabItem,
|
|
973
|
+
eventsTabItem,
|
|
974
|
+
angularTabItem,
|
|
975
|
+
reactTabItem,
|
|
976
|
+
vueTabItem,
|
|
977
|
+
a11yTabItem,
|
|
978
|
+
);
|
|
979
|
+
editorContainer.append(tabComponent);
|
|
980
|
+
|
|
981
|
+
let controlsCssSource = '';
|
|
982
|
+
const renderCurrentPreview = (source) => {
|
|
983
|
+
const managedStyle = controlsCssSource ? `<style data-playground-controls-css>${controlsCssSource}</style>` : '';
|
|
984
|
+
renderExamplePreview(preview, `${source}${managedStyle}`, path === 'templates');
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
const applyEditorValue = (source) => {
|
|
988
|
+
editorState.value = source;
|
|
989
|
+
updateFrameworkCode(source);
|
|
990
|
+
renderCurrentPreview(source);
|
|
991
|
+
renderedFilesContent[file] = { content: source.toLowerCase(), element: contentDiv };
|
|
992
|
+
// The example script lives in the preview iframe and is recreated with it.
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
const fullscreenBottomPanel = document.createElement('div');
|
|
996
|
+
fullscreenBottomPanel.className = 'wbc-example-fullscreen-bottom-panel';
|
|
997
|
+
fullscreenBottomPanel.appendChild(editorContainer);
|
|
998
|
+
|
|
999
|
+
preview.setAttribute('slot', 'target');
|
|
1000
|
+
fullscreenBottomPanel.setAttribute('slot', 'target');
|
|
1001
|
+
dropdown.appendChild(header);
|
|
1002
|
+
contentDiv.appendChild(dropdown);
|
|
1003
|
+
|
|
1004
|
+
initializeExample = () => {
|
|
1005
|
+
previewFrame = document.createElement('iframe');
|
|
1006
|
+
previewFrame.className = 'wbc-example-preview-frame';
|
|
1007
|
+
previewFrame.title = `Preview do exemplo ${file}`;
|
|
1008
|
+
previewFrame.dataset.path = path;
|
|
1009
|
+
previewFrame.setAttribute('loading', 'eager');
|
|
1010
|
+
preview.appendChild(previewFrame);
|
|
1011
|
+
renderCurrentPreview(text);
|
|
1012
|
+
|
|
1013
|
+
const editorReady = window.WBCCodeEditorReady || Promise.resolve(window.WBCCodeEditor);
|
|
1014
|
+
editorReady.then(() => {
|
|
1015
|
+
if (!editorContainer.closest('body')) return;
|
|
1016
|
+
editorWrapper.textContent = '';
|
|
1017
|
+
editorApi = window.WBCCodeEditor.create({
|
|
1018
|
+
ariaLabel: `Código fonte do exemplo ${file}`,
|
|
1019
|
+
onChange: applyEditorValue,
|
|
1020
|
+
parent: editorWrapper,
|
|
1021
|
+
value: editorState.value,
|
|
1022
|
+
language: 'html',
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
const createFrameworkEditor = (tab) => {
|
|
1026
|
+
const code = tab.querySelector('.wbc-framework-code');
|
|
1027
|
+
if (!code) return;
|
|
1028
|
+
const editorContainer = document.createElement('div');
|
|
1029
|
+
editorContainer.className = 'wbc-framework-editor';
|
|
1030
|
+
code.replaceWith(editorContainer);
|
|
1031
|
+
const framework = code.dataset.framework;
|
|
1032
|
+
const editor = window.WBCCodeEditor.create({
|
|
1033
|
+
ariaLabel: `Código ${tab.getAttribute('label')}`,
|
|
1034
|
+
onChange: () => {},
|
|
1035
|
+
parent: editorContainer,
|
|
1036
|
+
value: code.textContent || '',
|
|
1037
|
+
language: getFrameworkEditorLanguage(framework),
|
|
1038
|
+
readOnly: true,
|
|
1039
|
+
});
|
|
1040
|
+
frameworkEditors.set(tab, editor);
|
|
1041
|
+
tab.querySelectorAll('.wbc-framework-file-tab').forEach((fileTab) => {
|
|
1042
|
+
fileTab.addEventListener('click', () => selectFrameworkFile(tab, fileTab.dataset.filename, editor));
|
|
1043
|
+
});
|
|
1044
|
+
selectFrameworkFile(tab, tab.dataset.activeFilename, editor);
|
|
1045
|
+
};
|
|
1046
|
+
frameworkTabItems.forEach(createFrameworkEditor);
|
|
1047
|
+
refreshEditor();
|
|
1048
|
+
refreshFrameworkEditors();
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
customElements.whenDefined('br-tab').then(() => {
|
|
1052
|
+
requestAnimationFrame(async () => {
|
|
1053
|
+
await tabComponent.setActiveTab?.('code-tab');
|
|
1054
|
+
refreshEditor();
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
window.WBCComponentControls?.enhance({
|
|
1059
|
+
editorContainer,
|
|
1060
|
+
controlsTabItem,
|
|
1061
|
+
getCss: () => controlsCssSource,
|
|
1062
|
+
getHtml: getEditorValue,
|
|
1063
|
+
preferredTag: `br-${path}`,
|
|
1064
|
+
scopeSelector: 'body',
|
|
1065
|
+
setCss: (value) => {
|
|
1066
|
+
controlsCssSource = value;
|
|
1067
|
+
renderCurrentPreview(getEditorValue());
|
|
1068
|
+
},
|
|
1069
|
+
setHtml: (value) => {
|
|
1070
|
+
setEditorValue(value);
|
|
1071
|
+
},
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
renderedFilesContent[file] = { content: text.toLowerCase(), element: contentDiv };
|
|
1076
|
+
|
|
1077
|
+
return contentDiv;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
function createComponentTags(metadata) {
|
|
1081
|
+
const wrapper = document.createElement('div');
|
|
1082
|
+
wrapper.className = 'wbc-component-tags';
|
|
1083
|
+
wrapper.setAttribute('aria-label', 'Classificação do componente');
|
|
1084
|
+
const colors = { stable: 'var(--success)', beta: 'var(--warning)', deprecated: 'var(--danger)' };
|
|
1085
|
+
const labels = { stable: 'Estável', beta: 'Beta', deprecated: 'Depreciado' };
|
|
1086
|
+
(metadata?.categories || []).forEach((category) => {
|
|
1087
|
+
const tag = document.createElement('br-tag');
|
|
1088
|
+
tag.setAttribute('label', category);
|
|
1089
|
+
tag.setAttribute('bg-color', 'var(--interactive)');
|
|
1090
|
+
tag.className = 'wbc-component-category';
|
|
1091
|
+
wrapper.appendChild(tag);
|
|
1092
|
+
});
|
|
1093
|
+
const status = metadata?.status || 'stable';
|
|
1094
|
+
const statusTag = document.createElement('br-tag');
|
|
1095
|
+
statusTag.setAttribute('label', labels[status] || labels.stable);
|
|
1096
|
+
statusTag.setAttribute('bg-color', colors[status] || colors.stable);
|
|
1097
|
+
statusTag.className = `wbc-component-status wbc-component-status--${status}`;
|
|
1098
|
+
wrapper.appendChild(statusTag);
|
|
1099
|
+
return wrapper;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
function getInitialExampleFile(path, files) {
|
|
1103
|
+
const requestedFile = getRequestedExampleFile();
|
|
1104
|
+
if (files.includes(requestedFile)) return { initialFile: requestedFile, requestedFile };
|
|
1105
|
+
if (window.SHARED_STATE?.p === path) return { initialFile: window.SHARED_STATE.f, requestedFile };
|
|
1106
|
+
return { initialFile: 'default', requestedFile };
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
function createExamplesList(path, results, initialFile) {
|
|
1110
|
+
let sharedElementToScroll = null;
|
|
1111
|
+
const examples = document.createElement('br-list');
|
|
1112
|
+
examples.className = 'wbc-examples-list';
|
|
1113
|
+
examples.setAttribute('list-role', 'group');
|
|
1114
|
+
examples.setAttribute('divider', '');
|
|
1115
|
+
results.sort((a, b) => Number(b.file === 'default') - Number(a.file === 'default'));
|
|
1116
|
+
results.forEach(({ file, text }, index) => {
|
|
1117
|
+
const element = createExampleElement(
|
|
1118
|
+
path,
|
|
1119
|
+
file,
|
|
1120
|
+
text,
|
|
1121
|
+
file === initialFile || (!initialFile && index === 0),
|
|
1122
|
+
(openedFile) => {
|
|
1123
|
+
const hash = getExampleHash(openedFile);
|
|
1124
|
+
if (window.location.hash !== hash) {
|
|
1125
|
+
window.history.replaceState({}, '', `${window.location.pathname}${window.location.search}${hash}`);
|
|
1126
|
+
}
|
|
1127
|
+
examples.querySelectorAll('br-dropdown').forEach((other) => {
|
|
1128
|
+
if (other !== element.querySelector('br-dropdown') && other.isOpen) other.isOpen = false;
|
|
1129
|
+
});
|
|
1130
|
+
},
|
|
1131
|
+
);
|
|
1132
|
+
examples.appendChild(element);
|
|
1133
|
+
if (window.SHARED_STATE?.p === path && window.SHARED_STATE?.f === file) sharedElementToScroll = element;
|
|
1134
|
+
});
|
|
1135
|
+
return { examples, sharedElementToScroll };
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function openInitialDropdown(examples, initialFile) {
|
|
1139
|
+
const initialDropdown = initialFile
|
|
1140
|
+
? examples.querySelector(`[data-example-file="${CSS.escape(initialFile)}"] br-dropdown`)
|
|
1141
|
+
: null;
|
|
1142
|
+
if (!initialDropdown) return;
|
|
1143
|
+
customElements.whenDefined('br-dropdown').then(() => {
|
|
1144
|
+
initialDropdown.isOpen = false;
|
|
1145
|
+
initialDropdown.open();
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function scrollToInitialExample(examples, requestedFile, sharedElementToScroll) {
|
|
1150
|
+
const hashElement = requestedFile
|
|
1151
|
+
? examples.querySelector(`[data-example-file="${CSS.escape(requestedFile)}"]`)
|
|
1152
|
+
: null;
|
|
1153
|
+
if (hashElement) setTimeout(() => hashElement.scrollIntoView({ behavior: 'smooth', block: 'center' }), 500);
|
|
1154
|
+
if (sharedElementToScroll) {
|
|
1155
|
+
setTimeout(() => {
|
|
1156
|
+
sharedElementToScroll.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
1157
|
+
sharedElementToScroll.classList.add('wbc-example-shared-highlight');
|
|
1158
|
+
}, 500);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
function renderLoadedPage(path, files, results) {
|
|
1163
|
+
const metadata = window.MENU_ITEMS?.find((item) => item.path === path);
|
|
1164
|
+
if (metadata) CONTENT_ELEMENT.appendChild(createComponentTags(metadata));
|
|
1165
|
+
const { initialFile, requestedFile } = getInitialExampleFile(path, files);
|
|
1166
|
+
const { examples, sharedElementToScroll } = createExamplesList(path, results, initialFile);
|
|
1167
|
+
CONTENT_ELEMENT.appendChild(examples);
|
|
1168
|
+
openInitialDropdown(examples, initialFile);
|
|
1169
|
+
if (initialFile && files.includes(initialFile) && window.location.hash !== getExampleHash(initialFile)) {
|
|
1170
|
+
window.history.replaceState(
|
|
1171
|
+
{},
|
|
1172
|
+
'',
|
|
1173
|
+
`${window.location.pathname}${window.location.search}${getExampleHash(initialFile)}`,
|
|
1174
|
+
);
|
|
1175
|
+
}
|
|
1176
|
+
scrollToInitialExample(examples, requestedFile, sharedElementToScroll);
|
|
1177
|
+
currentLoadedPath = path;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
function loadPage(path, files) {
|
|
1181
|
+
window.WBCActiveRecorders = [];
|
|
1182
|
+
CONTENT_ELEMENT.innerHTML = '';
|
|
1183
|
+
renderedFilesContent = {};
|
|
1184
|
+
if (COMPONENTS_FILTER) COMPONENTS_FILTER.value = ''; // Limpa o campo de busca ao trocar de página
|
|
1185
|
+
if (CLEAR_COMPONENTS_FILTER) CLEAR_COMPONENTS_FILTER.style.display = 'none'; // Esconde o botão de limpar
|
|
1186
|
+
|
|
1187
|
+
const baseUrl = getBaseUrl();
|
|
1188
|
+
const promises = files.map((file) => {
|
|
1189
|
+
if (window.SHARED_STATE && window.SHARED_STATE.p === path && window.SHARED_STATE.f === file) {
|
|
1190
|
+
return Promise.resolve({ file, text: stripDevServerConnector(window.SHARED_STATE.h) });
|
|
1191
|
+
}
|
|
1192
|
+
return fetch(`${baseUrl}/pages/components/${path}/${file}.html`).then((response) =>
|
|
1193
|
+
response.text().then((text) => ({ file, text: stripDevServerConnector(text) })),
|
|
1194
|
+
);
|
|
1195
|
+
});
|
|
1196
|
+
|
|
1197
|
+
Promise.all(promises)
|
|
1198
|
+
.then((results) => renderLoadedPage(path, files, results))
|
|
1199
|
+
.catch((error) => {
|
|
1200
|
+
console.log('Erro ao carregar a página:', error);
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
function loadMarkdown(path) {
|
|
1205
|
+
CONTENT_ELEMENT.innerHTML = '';
|
|
1206
|
+
renderedFilesContent = {};
|
|
1207
|
+
if (COMPONENTS_FILTER) COMPONENTS_FILTER.value = ''; // Limpa o campo de busca ao trocar de página
|
|
1208
|
+
if (CLEAR_COMPONENTS_FILTER) CLEAR_COMPONENTS_FILTER.style.display = 'none'; // Esconde o botão de limpar
|
|
1209
|
+
|
|
1210
|
+
const baseUrl = getBaseUrl();
|
|
1211
|
+
fetch(`${baseUrl}/assets/stencil-generated-docs/${path}.md`)
|
|
1212
|
+
.then((response) => response.text())
|
|
1213
|
+
.then((text) => {
|
|
1214
|
+
const contentDiv = document.createElement('div');
|
|
1215
|
+
contentDiv.classList.add('file', 'mt-2', 'mb-5');
|
|
1216
|
+
const parsedMarkdown = typeof markdownParser?.parse === 'function' ? markdownParser.parse(text) : text;
|
|
1217
|
+
contentDiv.innerHTML = parsedMarkdown;
|
|
1218
|
+
CONTENT_ELEMENT.appendChild(contentDiv);
|
|
1219
|
+
currentLoadedPath = path;
|
|
1220
|
+
|
|
1221
|
+
renderedFilesContent[path] = { content: contentDiv.innerHTML.toLowerCase(), element: contentDiv };
|
|
1222
|
+
})
|
|
1223
|
+
.catch((error) => {
|
|
1224
|
+
console.error('Erro ao carregar a página:', error);
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function filterContent() {
|
|
1229
|
+
const filterValue = (COMPONENTS_FILTER?.value || '').toLowerCase();
|
|
1230
|
+
const normalizedFilterValue = filterValue.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
1231
|
+
|
|
1232
|
+
Object.values(renderedFilesContent).forEach(({ content, element }) => {
|
|
1233
|
+
const titleElement = element.querySelector('h3');
|
|
1234
|
+
const titleText = titleElement ? titleElement.textContent.toLowerCase() : '';
|
|
1235
|
+
const normalizedTitleText = titleText.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
1236
|
+
|
|
1237
|
+
// Inicializa o conteúdo do shadow DOM para componentes personalizados
|
|
1238
|
+
let shadowContent = '';
|
|
1239
|
+
|
|
1240
|
+
// Função para coletar o conteúdo dos slots de um custom element
|
|
1241
|
+
const collectSlotContent = (customElement) => {
|
|
1242
|
+
if (customElement.shadowRoot) {
|
|
1243
|
+
const slots = customElement.shadowRoot.querySelectorAll('slot');
|
|
1244
|
+
slots.forEach((slot) => {
|
|
1245
|
+
const assignedNodes = slot.assignedNodes();
|
|
1246
|
+
assignedNodes.forEach((node) => {
|
|
1247
|
+
shadowContent += `${node.textContent.toLowerCase()} `;
|
|
1248
|
+
});
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
// Procura todos os custom elements dentro do elemento
|
|
1254
|
+
const customElements = element.querySelectorAll('*');
|
|
1255
|
+
customElements.forEach((customElement) => {
|
|
1256
|
+
if (customElement.tagName.includes('-')) {
|
|
1257
|
+
// Identifica se é um custom element
|
|
1258
|
+
collectSlotContent(customElement);
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
|
|
1262
|
+
// Filtra o conteúdo
|
|
1263
|
+
const combinedContent = `${content} ${shadowContent}`; // Combina conteúdo e shadow content
|
|
1264
|
+
|
|
1265
|
+
if (element.querySelector('table')) {
|
|
1266
|
+
const rows = element.querySelectorAll('table tr');
|
|
1267
|
+
rows.forEach((row, index) => {
|
|
1268
|
+
if (index === 0) {
|
|
1269
|
+
row.style.display = '';
|
|
1270
|
+
} else {
|
|
1271
|
+
const rowText = row.textContent
|
|
1272
|
+
.toLowerCase()
|
|
1273
|
+
.normalize('NFD')
|
|
1274
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
1275
|
+
row.style.display = rowText.includes(normalizedFilterValue) ? '' : 'none';
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
} else if (
|
|
1279
|
+
normalizedFilterValue &&
|
|
1280
|
+
(combinedContent.includes(normalizedFilterValue) || normalizedTitleText.includes(normalizedFilterValue))
|
|
1281
|
+
) {
|
|
1282
|
+
element.style.display = ''; // Exibe o elemento se o conteúdo combinado inclui o valor filtrado
|
|
1283
|
+
} else {
|
|
1284
|
+
element.style.display = normalizedFilterValue ? 'none' : ''; // Oculta se não houver filtro
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
if (CLEAR_COMPONENTS_FILTER) CLEAR_COMPONENTS_FILTER.style.display = filterValue ? 'block' : 'none';
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function processMenuItems(menuItems, menuBody, currentPath) {
|
|
1292
|
+
if (!Array.isArray(menuItems)) return;
|
|
1293
|
+
menuItems.forEach((page) => {
|
|
1294
|
+
if (!page?.path) return;
|
|
1295
|
+
const link = menuBody
|
|
1296
|
+
? Array.from(menuBody.children).find((item) => item.getAttribute('href') === `/${page.path}`)
|
|
1297
|
+
: null;
|
|
1298
|
+
if (page.path === currentPath) {
|
|
1299
|
+
if (link) {
|
|
1300
|
+
link.active = true;
|
|
1301
|
+
link.classList.add('active');
|
|
1302
|
+
}
|
|
1303
|
+
if (Array.isArray(page.files)) loadPage(page.path, page.files);
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function processStaticItems(staticItems, menuBody, currentPath) {
|
|
1309
|
+
if (!Array.isArray(staticItems)) return;
|
|
1310
|
+
staticItems.forEach((page) => {
|
|
1311
|
+
if (!page?.path) return;
|
|
1312
|
+
const link = menuBody
|
|
1313
|
+
? Array.from(menuBody.children).find((item) => item.getAttribute('href') === `/${page.path}`)
|
|
1314
|
+
: null;
|
|
1315
|
+
if (page.path === currentPath) {
|
|
1316
|
+
if (link) {
|
|
1317
|
+
link.active = true;
|
|
1318
|
+
link.classList.add('active');
|
|
1319
|
+
}
|
|
1320
|
+
loadMarkdown(page.path);
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// Liga eventos apenas se os elementos existirem
|
|
1326
|
+
if (COMPONENTS_FILTER) {
|
|
1327
|
+
COMPONENTS_FILTER.addEventListener('input', filterContent);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
if (CLEAR_COMPONENTS_FILTER) {
|
|
1331
|
+
CLEAR_COMPONENTS_FILTER.addEventListener('click', () => {
|
|
1332
|
+
if (COMPONENTS_FILTER) COMPONENTS_FILTER.value = '';
|
|
1333
|
+
filterContent();
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
function loadPageFromURL() {
|
|
1338
|
+
const baseUrl = getBaseUrl();
|
|
1339
|
+
const currentPath = window.location.pathname.replace(baseUrl, '').split('/').filter(Boolean)[0] || '';
|
|
1340
|
+
|
|
1341
|
+
// Evita recarregar a mesma rota em chamadas repetidas
|
|
1342
|
+
if (currentPath === currentLoadedPath) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
const menuItems = Array.isArray(window.MENU_ITEMS) ? window.MENU_ITEMS : [];
|
|
1347
|
+
const menuBody = typeof window.MENU_BODY !== 'undefined' ? window.MENU_BODY : null;
|
|
1348
|
+
|
|
1349
|
+
// Remove seleções antigas
|
|
1350
|
+
if (menuBody) {
|
|
1351
|
+
Array.from(menuBody.children).forEach((item) => {
|
|
1352
|
+
item.active = false;
|
|
1353
|
+
item.classList.remove('active');
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
processMenuItems(menuItems, menuBody, currentPath);
|
|
1358
|
+
processStaticItems(window.MENU_STATIC_ITEMS, menuBody, currentPath);
|
|
1359
|
+
|
|
1360
|
+
if (currentPath.trim().length === 0 && menuItems.length > 0) {
|
|
1361
|
+
const firstPage = menuItems.find((p) => p?.path && Array.isArray(p.files));
|
|
1362
|
+
if (firstPage) {
|
|
1363
|
+
loadPage(firstPage.path, firstPage.files);
|
|
1364
|
+
const firstLink = menuBody
|
|
1365
|
+
? Array.from(menuBody.children).find((item) => item.getAttribute('href') === `/${firstPage.path}`)
|
|
1366
|
+
: null;
|
|
1367
|
+
if (firstLink) {
|
|
1368
|
+
firstLink.active = true;
|
|
1369
|
+
firstLink.classList.add('active');
|
|
1370
|
+
}
|
|
1371
|
+
window.history.pushState({}, '', `${baseUrl}/${firstPage.path}`);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// Aguarda DOM e dados do menu antes de tentar carregar a rota atual
|
|
1377
|
+
function isMenuReady() {
|
|
1378
|
+
const hasItems =
|
|
1379
|
+
(Array.isArray(window.MENU_ITEMS) && window.MENU_ITEMS.length > 0) ||
|
|
1380
|
+
(Array.isArray(window.MENU_STATIC_ITEMS) && window.MENU_STATIC_ITEMS.length > 0);
|
|
1381
|
+
return !!CONTENT_ELEMENT && hasItems;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
function bootstrapRouting(attempt = 0) {
|
|
1385
|
+
const maxAttempts = 200; // ~10s com 50ms
|
|
1386
|
+
if (!isMenuReady()) {
|
|
1387
|
+
if (attempt < maxAttempts) {
|
|
1388
|
+
setTimeout(() => bootstrapRouting(attempt + 1), 50);
|
|
1389
|
+
} else {
|
|
1390
|
+
// Última tentativa mesmo sem menu (evita ficar em branco caso os itens não sejam necessários)
|
|
1391
|
+
try {
|
|
1392
|
+
loadPageFromURL();
|
|
1393
|
+
} catch (err) {
|
|
1394
|
+
console.warn('Falha ao carregar rota sem menu pronto:', err);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
loadPageFromURL();
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
if (document.readyState === 'loading') {
|
|
1403
|
+
document.addEventListener('DOMContentLoaded', () => bootstrapRouting());
|
|
1404
|
+
} else {
|
|
1405
|
+
bootstrapRouting();
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// Garante atualização ao navegar com back/forward
|
|
1409
|
+
window.addEventListener('popstate', () => bootstrapRouting());
|
|
1410
|
+
|
|
1411
|
+
window.addEventListener('hashchange', () => {
|
|
1412
|
+
const file = getRequestedExampleFile();
|
|
1413
|
+
const example = file ? document.querySelector(`br-item[data-example-file="${CSS.escape(file)}"]`) : null;
|
|
1414
|
+
if (!example) return;
|
|
1415
|
+
|
|
1416
|
+
const dropdown = example.querySelector('br-dropdown');
|
|
1417
|
+
if (dropdown) dropdown.isOpen = true;
|
|
1418
|
+
document.querySelectorAll('.wbc-example-dropdown').forEach((other) => {
|
|
1419
|
+
if (other !== dropdown) other.isOpen = false;
|
|
1420
|
+
});
|
|
1421
|
+
setTimeout(() => example.scrollIntoView({ behavior: 'smooth', block: 'center' }), 100);
|
|
1422
|
+
});
|