@pine-ds/core 4.5.0 → 4.6.0
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/components/attributes.js +1 -1
- package/components/mock-pds-modal.js +1 -1
- package/components/pds-combobox.js +1 -1
- package/components/pds-container.js +1 -1
- package/components/pds-copytext.js +1 -1
- package/components/pds-datepicker.js +1 -1
- package/components/pds-divider.js +1 -1
- package/components/pds-drawer-content.js +1 -1
- package/components/pds-drawer-footer.js +1 -1
- package/components/pds-drawer-header.js +1 -1
- package/components/pds-drawer.js +1 -1
- package/components/pds-dropdown-menu-item.js +1 -1
- package/components/pds-dropdown-menu-separator.js +1 -1
- package/components/pds-dropdown-menu.js +1 -1
- package/components/pds-filter.js +1 -1
- package/components/pds-filters.js +1 -1
- package/components/pds-icon2.js +1 -1
- package/components/pds-image.js +1 -1
- package/components/pds-input2.js +1 -1
- package/components/pds-link2.js +1 -1
- package/components/pds-loader2.js +1 -1
- package/components/pds-modal-content.js +1 -1
- package/components/pds-modal-footer.js +1 -1
- package/components/pds-modal-header.js +1 -1
- package/components/pds-modal2.js +1 -1
- package/components/pds-multiselect.js +1 -1
- package/components/pds-popover.js +1 -1
- package/components/pds-progress.js +1 -1
- package/components/pds-property.js +1 -1
- package/components/pds-radio-group.js +1 -1
- package/components/pds-radio.js +1 -1
- package/components/pds-row.js +1 -1
- package/components/pds-select.js +1 -1
- package/components/pds-sortable-item.js +1 -1
- package/components/pds-sortable.js +1 -1
- package/components/pds-switch.js +1 -1
- package/components/pds-tab.js +1 -1
- package/components/pds-table-body.js +1 -1
- package/components/pds-table-cell2.js +1 -1
- package/components/pds-table-head-cell2.js +1 -1
- package/components/pds-table-head.js +1 -1
- package/components/pds-table-row.js +1 -1
- package/components/pds-tabpanel.js +1 -1
- package/components/pds-tabs.js +1 -1
- package/components/pds-text2.js +1 -1
- package/components/pds-textarea.js +1 -1
- package/components/pds-toast.js +1 -1
- package/components/pds-tooltip.js +1 -1
- package/dist/cjs/{attributes-DXvaSETR.js → attributes-BJ7KBHql.js} +18 -11
- package/dist/cjs/{index-D-QQKB0y.js → index-5Azb8EQG.js} +1 -1
- package/dist/cjs/{index-BQjWfQXw.js → index-jl_Q819j.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/keep-hydrated-CiXgkEYd.js +196 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/mock-pds-modal.cjs.entry.js +3 -3
- package/dist/cjs/pds-accordion.cjs.entry.js +3 -3
- package/dist/cjs/pds-alert.cjs.entry.js +2 -2
- package/dist/cjs/pds-avatar.cjs.entry.js +3 -3
- package/dist/cjs/pds-box.cjs.entry.js +3 -3
- package/dist/cjs/pds-button.cjs.entry.js +3 -3
- package/dist/cjs/pds-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/pds-chip.cjs.entry.js +4 -4
- package/dist/cjs/pds-combobox.cjs.entry.js +156 -27
- package/dist/cjs/pds-container.cjs.entry.js +3 -3
- package/dist/cjs/pds-copytext.cjs.entry.js +5 -5
- package/dist/cjs/pds-datepicker.cjs.entry.js +5 -5
- package/dist/cjs/pds-divider.cjs.entry.js +3 -3
- package/dist/cjs/pds-drawer-content.cjs.entry.js +3 -3
- package/dist/cjs/pds-drawer-footer.cjs.entry.js +3 -3
- package/dist/cjs/pds-drawer-header.cjs.entry.js +3 -3
- package/dist/cjs/pds-drawer.cjs.entry.js +4 -4
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +3 -3
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +3 -3
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +16 -8
- package/dist/cjs/pds-filter.cjs.entry.js +4 -4
- package/dist/cjs/pds-filters.cjs.entry.js +3 -3
- package/dist/cjs/pds-icon.cjs.entry.js +27 -4
- package/dist/cjs/pds-image.cjs.entry.js +4 -4
- package/dist/cjs/pds-input.cjs.entry.js +6 -6
- package/dist/cjs/pds-link.cjs.entry.js +5 -5
- package/dist/cjs/pds-loader.cjs.entry.js +4 -4
- package/dist/cjs/pds-modal-content.cjs.entry.js +4 -4
- package/dist/cjs/pds-modal-footer.cjs.entry.js +3 -3
- package/dist/cjs/pds-modal-header.cjs.entry.js +3 -3
- package/dist/cjs/pds-modal.cjs.entry.js +5 -5
- package/dist/cjs/pds-multiselect.cjs.entry.js +6 -6
- package/dist/cjs/pds-popover.cjs.entry.js +58 -12
- package/dist/cjs/pds-progress.cjs.entry.js +4 -4
- package/dist/cjs/pds-property.cjs.entry.js +3 -3
- package/dist/cjs/pds-radio-group.cjs.entry.js +6 -6
- package/dist/cjs/pds-radio.cjs.entry.js +7 -7
- package/dist/cjs/pds-row.cjs.entry.js +4 -4
- package/dist/cjs/pds-select.cjs.entry.js +5 -5
- package/dist/cjs/pds-sortable-item.cjs.entry.js +5 -5
- package/dist/cjs/pds-sortable.cjs.entry.js +4 -4
- package/dist/cjs/pds-switch.cjs.entry.js +7 -7
- package/dist/cjs/pds-tab.cjs.entry.js +13 -2
- package/dist/cjs/pds-table-body.cjs.entry.js +3 -3
- package/dist/cjs/pds-table-cell.cjs.entry.js +4 -4
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +5 -5
- package/dist/cjs/pds-table-head.cjs.entry.js +3 -3
- package/dist/cjs/pds-table-row.cjs.entry.js +3 -3
- package/dist/cjs/pds-table.cjs.entry.js +2 -2
- package/dist/cjs/pds-tabpanel.cjs.entry.js +15 -3
- package/dist/cjs/pds-tabs.cjs.entry.js +111 -7
- package/dist/cjs/pds-text.cjs.entry.js +3 -3
- package/dist/cjs/pds-textarea.cjs.entry.js +8 -8
- package/dist/cjs/pds-toast.cjs.entry.js +5 -5
- package/dist/cjs/pds-tooltip.cjs.entry.js +4 -4
- package/dist/cjs/pine-core.cjs.js +3 -3
- package/dist/collection/components/pds-combobox/grouped-options-panel.js +21 -3
- package/dist/collection/components/pds-combobox/pds-combobox.css +42 -13
- package/dist/collection/components/pds-combobox/pds-combobox.js +135 -22
- package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +45 -0
- package/dist/collection/components/pds-container/pds-container.js +1 -1
- package/dist/collection/components/pds-copytext/pds-copytext.js +1 -1
- package/dist/collection/components/pds-datepicker/pds-datepicker.js +2 -2
- package/dist/collection/components/pds-divider/pds-divider.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.js +1 -1
- package/dist/collection/components/pds-drawer/pds-drawer.js +2 -2
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +1 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +1 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.css +19 -5
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +16 -5
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +1 -1
- package/dist/collection/components/pds-filters/pds-filters.js +1 -1
- package/dist/collection/components/pds-image/pds-image.js +2 -2
- package/dist/collection/components/pds-input/pds-input.js +2 -2
- package/dist/collection/components/pds-link/pds-link.js +2 -2
- package/dist/collection/components/pds-loader/pds-loader.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +2 -2
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal.js +3 -3
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +1 -1
- package/dist/collection/components/pds-multiselect/pds-multiselect.js +3 -3
- package/dist/collection/components/pds-popover/pds-popover.js +15 -9
- package/dist/collection/components/pds-progress/pds-progress.js +1 -1
- package/dist/collection/components/pds-property/pds-property.js +1 -1
- package/dist/collection/components/pds-radio/pds-radio.js +3 -3
- package/dist/collection/components/pds-radio-group/pds-radio-group.js +3 -3
- package/dist/collection/components/pds-row/pds-row.js +1 -1
- package/dist/collection/components/pds-select/pds-select.js +1 -1
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +1 -1
- package/dist/collection/components/pds-sortable/pds-sortable.js +1 -1
- package/dist/collection/components/pds-switch/pds-switch.js +3 -3
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +1 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +1 -1
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +1 -1
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js +11 -0
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.js +13 -1
- package/dist/collection/components/pds-tabs/pds-tabs.js +111 -7
- package/dist/collection/components/pds-text/pds-text.js +1 -1
- package/dist/collection/components/pds-textarea/pds-textarea.js +4 -4
- package/dist/collection/components/pds-toast/pds-toast.js +3 -3
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +2 -2
- package/dist/collection/utils/attributes.js +18 -11
- package/dist/collection/utils/css.js +41 -0
- package/dist/collection/utils/keep-hydrated.js +133 -6
- package/dist/docs.json +15 -6
- package/dist/esm/{attributes-CF5K2pxn.js → attributes-WXw_I_uJ.js} +18 -11
- package/dist/esm/{index-DxI-61GK.js → index-BJXk71tO.js} +1 -1
- package/dist/esm/{index-2HMD-zUO.js → index-Cw9J31qd.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/keep-hydrated-BLG6RDBt.js +190 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/mock-pds-modal.entry.js +3 -3
- package/dist/esm/pds-accordion.entry.js +3 -3
- package/dist/esm/pds-alert.entry.js +2 -2
- package/dist/esm/pds-avatar.entry.js +3 -3
- package/dist/esm/pds-box.entry.js +3 -3
- package/dist/esm/pds-button.entry.js +3 -3
- package/dist/esm/pds-checkbox.entry.js +4 -4
- package/dist/esm/pds-chip.entry.js +4 -4
- package/dist/esm/pds-combobox.entry.js +156 -27
- package/dist/esm/pds-container.entry.js +3 -3
- package/dist/esm/pds-copytext.entry.js +5 -5
- package/dist/esm/pds-datepicker.entry.js +5 -5
- package/dist/esm/pds-divider.entry.js +3 -3
- package/dist/esm/pds-drawer-content.entry.js +3 -3
- package/dist/esm/pds-drawer-footer.entry.js +3 -3
- package/dist/esm/pds-drawer-header.entry.js +3 -3
- package/dist/esm/pds-drawer.entry.js +4 -4
- package/dist/esm/pds-dropdown-menu-item.entry.js +3 -3
- package/dist/esm/pds-dropdown-menu-separator.entry.js +3 -3
- package/dist/esm/pds-dropdown-menu.entry.js +16 -8
- package/dist/esm/pds-filter.entry.js +4 -4
- package/dist/esm/pds-filters.entry.js +3 -3
- package/dist/esm/pds-icon.entry.js +27 -4
- package/dist/esm/pds-image.entry.js +4 -4
- package/dist/esm/pds-input.entry.js +6 -6
- package/dist/esm/pds-link.entry.js +5 -5
- package/dist/esm/pds-loader.entry.js +4 -4
- package/dist/esm/pds-modal-content.entry.js +4 -4
- package/dist/esm/pds-modal-footer.entry.js +3 -3
- package/dist/esm/pds-modal-header.entry.js +3 -3
- package/dist/esm/pds-modal.entry.js +5 -5
- package/dist/esm/pds-multiselect.entry.js +6 -6
- package/dist/esm/pds-popover.entry.js +58 -12
- package/dist/esm/pds-progress.entry.js +4 -4
- package/dist/esm/pds-property.entry.js +3 -3
- package/dist/esm/pds-radio-group.entry.js +6 -6
- package/dist/esm/pds-radio.entry.js +7 -7
- package/dist/esm/pds-row.entry.js +4 -4
- package/dist/esm/pds-select.entry.js +5 -5
- package/dist/esm/pds-sortable-item.entry.js +5 -5
- package/dist/esm/pds-sortable.entry.js +4 -4
- package/dist/esm/pds-switch.entry.js +7 -7
- package/dist/esm/pds-tab.entry.js +13 -2
- package/dist/esm/pds-table-body.entry.js +3 -3
- package/dist/esm/pds-table-cell.entry.js +4 -4
- package/dist/esm/pds-table-head-cell.entry.js +5 -5
- package/dist/esm/pds-table-head.entry.js +3 -3
- package/dist/esm/pds-table-row.entry.js +3 -3
- package/dist/esm/pds-table.entry.js +2 -2
- package/dist/esm/pds-tabpanel.entry.js +15 -3
- package/dist/esm/pds-tabs.entry.js +111 -7
- package/dist/esm/pds-text.entry.js +3 -3
- package/dist/esm/pds-textarea.entry.js +8 -8
- package/dist/esm/pds-toast.entry.js +5 -5
- package/dist/esm/pds-tooltip.entry.js +4 -4
- package/dist/esm/pine-core.js +4 -4
- package/dist/esm-es5/attributes-WXw_I_uJ.js +1 -0
- package/dist/esm-es5/{index-2HMD-zUO.js → index-Cw9J31qd.js} +2 -2
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/keep-hydrated-BLG6RDBt.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js +1 -1
- package/dist/esm-es5/pds-accordion.entry.js +1 -1
- package/dist/esm-es5/pds-alert.entry.js +1 -1
- package/dist/esm-es5/pds-avatar.entry.js +1 -1
- package/dist/esm-es5/pds-box.entry.js +1 -1
- package/dist/esm-es5/pds-button.entry.js +1 -1
- package/dist/esm-es5/pds-checkbox.entry.js +1 -1
- package/dist/esm-es5/pds-chip.entry.js +1 -1
- package/dist/esm-es5/pds-combobox.entry.js +2 -2
- package/dist/esm-es5/pds-container.entry.js +1 -1
- package/dist/esm-es5/pds-copytext.entry.js +1 -1
- package/dist/esm-es5/pds-datepicker.entry.js +1 -1
- package/dist/esm-es5/pds-divider.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-content.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-footer.entry.js +1 -1
- package/dist/esm-es5/pds-drawer-header.entry.js +1 -1
- package/dist/esm-es5/pds-drawer.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu.entry.js +1 -1
- package/dist/esm-es5/pds-filter.entry.js +1 -1
- package/dist/esm-es5/pds-filters.entry.js +1 -1
- package/dist/esm-es5/pds-icon.entry.js +1 -1
- package/dist/esm-es5/pds-image.entry.js +1 -1
- package/dist/esm-es5/pds-input.entry.js +1 -1
- package/dist/esm-es5/pds-link.entry.js +1 -1
- package/dist/esm-es5/pds-loader.entry.js +1 -1
- package/dist/esm-es5/pds-modal-content.entry.js +1 -1
- package/dist/esm-es5/pds-modal-footer.entry.js +1 -1
- package/dist/esm-es5/pds-modal-header.entry.js +1 -1
- package/dist/esm-es5/pds-modal.entry.js +1 -1
- package/dist/esm-es5/pds-multiselect.entry.js +1 -1
- package/dist/esm-es5/pds-popover.entry.js +1 -1
- package/dist/esm-es5/pds-progress.entry.js +1 -1
- package/dist/esm-es5/pds-property.entry.js +1 -1
- package/dist/esm-es5/pds-radio-group.entry.js +1 -1
- package/dist/esm-es5/pds-radio.entry.js +1 -1
- package/dist/esm-es5/pds-row.entry.js +1 -1
- package/dist/esm-es5/pds-select.entry.js +1 -1
- package/dist/esm-es5/pds-sortable-item.entry.js +1 -1
- package/dist/esm-es5/pds-sortable.entry.js +2 -2
- package/dist/esm-es5/pds-switch.entry.js +1 -1
- package/dist/esm-es5/pds-tab.entry.js +1 -1
- package/dist/esm-es5/pds-table-body.entry.js +1 -1
- package/dist/esm-es5/pds-table-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head.entry.js +1 -1
- package/dist/esm-es5/pds-table-row.entry.js +1 -1
- package/dist/esm-es5/pds-table.entry.js +1 -1
- package/dist/esm-es5/pds-tabpanel.entry.js +1 -1
- package/dist/esm-es5/pds-tabs.entry.js +1 -1
- package/dist/esm-es5/pds-text.entry.js +1 -1
- package/dist/esm-es5/pds-textarea.entry.js +1 -1
- package/dist/esm-es5/pds-toast.entry.js +1 -1
- package/dist/esm-es5/pds-tooltip.entry.js +1 -1
- package/dist/esm-es5/pine-core.js +1 -1
- package/dist/pine-core/index.esm.js +1 -1
- package/dist/pine-core/{p-9a7ee7cb.system.entry.js → p-0092444c.system.entry.js} +1 -1
- package/dist/pine-core/{p-d576e542.system.entry.js → p-01aa382c.system.entry.js} +1 -1
- package/dist/pine-core/p-01c9b8f3.entry.js +1 -0
- package/dist/pine-core/{p-d69cfaa4.entry.js → p-02088776.entry.js} +1 -1
- package/dist/pine-core/p-049f126a.entry.js +1 -0
- package/dist/pine-core/{p-8b9d8fb5.system.entry.js → p-080cb087.system.entry.js} +1 -1
- package/dist/pine-core/{p-99317375.system.entry.js → p-0913f696.system.entry.js} +1 -1
- package/dist/pine-core/{p-5737182f.entry.js → p-0a84d220.entry.js} +1 -1
- package/dist/pine-core/{p-4c9cccdb.system.entry.js → p-0b71ecb6.system.entry.js} +2 -2
- package/dist/pine-core/{p-37d73369.system.entry.js → p-1437585e.system.entry.js} +1 -1
- package/dist/pine-core/{p-22f041ee.system.entry.js → p-1ee86d87.system.entry.js} +1 -1
- package/dist/pine-core/{p-5decd81f.entry.js → p-208c7dbf.entry.js} +1 -1
- package/dist/pine-core/{p-51dff046.system.entry.js → p-258770cf.system.entry.js} +1 -1
- package/dist/pine-core/{p-1f2e5958.entry.js → p-258d5e83.entry.js} +1 -1
- package/dist/pine-core/{p-4e05a4f0.entry.js → p-26642718.entry.js} +1 -1
- package/dist/pine-core/{p-1b13f69c.system.entry.js → p-2ac2457b.system.entry.js} +1 -1
- package/dist/pine-core/p-2cb5483a.system.entry.js +1 -0
- package/dist/pine-core/{p-1f263c0b.system.entry.js → p-341c38f1.system.entry.js} +1 -1
- package/dist/pine-core/{p-bd7da23e.system.entry.js → p-3a959459.system.entry.js} +1 -1
- package/dist/pine-core/p-3c27088f.system.entry.js +1 -0
- package/dist/pine-core/{p-1e464117.entry.js → p-432d5ec7.entry.js} +1 -1
- package/dist/pine-core/{p-0de74105.entry.js → p-4849fda7.entry.js} +1 -1
- package/dist/pine-core/{p-f30d6192.system.entry.js → p-4d03d1e2.system.entry.js} +1 -1
- package/dist/pine-core/{p-2cb02706.entry.js → p-4de8f333.entry.js} +1 -1
- package/dist/pine-core/{p-152245fa.system.entry.js → p-4f94b4f1.system.entry.js} +1 -1
- package/dist/pine-core/{p-66cfef6d.system.entry.js → p-4fa63723.system.entry.js} +1 -1
- package/dist/pine-core/p-4fd454f6.entry.js +1 -0
- package/dist/pine-core/{p-70c6f0ed.system.entry.js → p-5442d983.system.entry.js} +1 -1
- package/dist/pine-core/{p-8027db25.entry.js → p-550c2fd3.entry.js} +1 -1
- package/dist/pine-core/{p-7d01e719.entry.js → p-55224683.entry.js} +1 -1
- package/dist/pine-core/{p-65e30a4c.entry.js → p-57a2f927.entry.js} +1 -1
- package/dist/pine-core/{p-721297b5.system.entry.js → p-5870b092.system.entry.js} +1 -1
- package/dist/pine-core/{p-6d83ad2d.system.entry.js → p-5c90091e.system.entry.js} +1 -1
- package/dist/pine-core/p-602c197f.entry.js +1 -0
- package/dist/pine-core/p-646afbca.system.entry.js +1 -0
- package/dist/pine-core/{p-45fcc5b7.entry.js → p-6bf853c9.entry.js} +1 -1
- package/dist/pine-core/{p-5d014059.entry.js → p-6d3610f9.entry.js} +1 -1
- package/dist/pine-core/{p-343546b1.system.entry.js → p-6eec23a7.system.entry.js} +1 -1
- package/dist/pine-core/{p-5132b8a1.entry.js → p-72865997.entry.js} +1 -1
- package/dist/pine-core/{p-9d33bb05.entry.js → p-73eb47fa.entry.js} +1 -1
- package/dist/pine-core/p-75ee0403.entry.js +1 -0
- package/dist/pine-core/p-77395d62.system.entry.js +1 -0
- package/dist/pine-core/p-7a287635.system.entry.js +1 -0
- package/dist/pine-core/p-7a5b21d2.system.entry.js +1 -0
- package/dist/pine-core/{p-a83a6618.system.entry.js → p-7bf6563a.system.entry.js} +1 -1
- package/dist/pine-core/{p-347ae53c.system.entry.js → p-7f367db4.system.entry.js} +1 -1
- package/dist/pine-core/{p-71e3a89e.system.entry.js → p-8191498f.system.entry.js} +1 -1
- package/dist/pine-core/{p-0166c620.entry.js → p-82cf4ec6.entry.js} +1 -1
- package/dist/pine-core/{p-16c2aa63.entry.js → p-84e9b7da.entry.js} +1 -1
- package/dist/pine-core/{p-bdf68e53.system.entry.js → p-86040cac.system.entry.js} +1 -1
- package/dist/pine-core/p-875b0436.system.entry.js +1 -0
- package/dist/pine-core/{p-87f91e02.system.entry.js → p-8c8cc079.system.entry.js} +1 -1
- package/dist/pine-core/{p-ba1b79c7.system.entry.js → p-8cc302aa.system.entry.js} +1 -1
- package/dist/pine-core/{p-5b7f7760.entry.js → p-8d292b48.entry.js} +1 -1
- package/dist/pine-core/{p-650ccffb.entry.js → p-8f531063.entry.js} +1 -1
- package/dist/pine-core/p-9109b90a.entry.js +1 -0
- package/dist/pine-core/p-94593f20.system.entry.js +1 -0
- package/dist/pine-core/{p-04fe5da7.system.entry.js → p-9880d251.system.entry.js} +1 -1
- package/dist/pine-core/p-99459e27.entry.js +1 -0
- package/dist/pine-core/{p-4414d442.system.entry.js → p-9a0083dd.system.entry.js} +1 -1
- package/dist/pine-core/{p-9835c74b.entry.js → p-9ab95438.entry.js} +1 -1
- package/dist/pine-core/{p-a6d09102.system.entry.js → p-9af131d6.system.entry.js} +1 -1
- package/dist/pine-core/{p-59491f98.entry.js → p-9dcd2cdb.entry.js} +1 -1
- package/dist/pine-core/{p-c00e46a5.system.entry.js → p-9e0f920a.system.entry.js} +1 -1
- package/dist/pine-core/p-BGLP3keB.js +1 -0
- package/dist/pine-core/p-BLG6RDBt.js +1 -0
- package/dist/pine-core/p-BR5nujVX.system.js +1 -0
- package/dist/pine-core/{p-BJlg6wq7.system.js → p-CGRdQc49.system.js} +2 -2
- package/dist/pine-core/{p-DeIDZHrg.js → p-CmSJytt1.js} +2 -2
- package/dist/pine-core/p-CuSNnuFu.system.js +1 -0
- package/dist/pine-core/{p-YQa3CeL9.system.js → p-Cy8cvR7I.system.js} +1 -1
- package/dist/pine-core/p-XW4H0W6i.system.js +1 -0
- package/dist/pine-core/p-a0960b3d.system.entry.js +1 -0
- package/dist/pine-core/p-a1230a74.system.entry.js +1 -0
- package/dist/pine-core/{p-fbea5703.entry.js → p-a19cd59c.entry.js} +1 -1
- package/dist/pine-core/p-a3735199.entry.js +1 -0
- package/dist/pine-core/p-a826f290.entry.js +1 -0
- package/dist/pine-core/{p-1ec4eeaf.system.entry.js → p-a85a6ab9.system.entry.js} +1 -1
- package/dist/pine-core/p-acce8eb2.entry.js +1 -0
- package/dist/pine-core/p-b1548a20.entry.js +1 -0
- package/dist/pine-core/{p-93877d4a.entry.js → p-b69f04b7.entry.js} +1 -1
- package/dist/pine-core/p-b75b0d09.system.entry.js +1 -0
- package/dist/pine-core/{p-02857936.entry.js → p-b8e8a4ce.entry.js} +1 -1
- package/dist/pine-core/{p-622e91e3.entry.js → p-b914dde8.entry.js} +2 -2
- package/dist/pine-core/{p-5bc670be.system.entry.js → p-ba1f65c2.system.entry.js} +1 -1
- package/dist/pine-core/p-bb68431a.entry.js +1 -0
- package/dist/pine-core/{p-c8e89b61.system.entry.js → p-bd67156b.system.entry.js} +1 -1
- package/dist/pine-core/{p-db4319fd.entry.js → p-beb23781.entry.js} +1 -1
- package/dist/pine-core/p-bf30dec0.entry.js +1 -0
- package/dist/pine-core/{p-91f712f4.system.entry.js → p-bf7ee3b7.system.entry.js} +1 -1
- package/dist/pine-core/{p-b5838211.system.entry.js → p-c5c9ed36.system.entry.js} +1 -1
- package/dist/pine-core/{p-21115986.system.entry.js → p-cb6a3e4c.system.entry.js} +1 -1
- package/dist/pine-core/{p-1cf1fced.entry.js → p-cde8eb81.entry.js} +1 -1
- package/dist/pine-core/{p-1d75a9b1.system.entry.js → p-cf08a6dd.system.entry.js} +1 -1
- package/dist/pine-core/p-cfd012d4.entry.js +1 -0
- package/dist/pine-core/{p-5e8d73d4.entry.js → p-d2c91e7a.entry.js} +1 -1
- package/dist/pine-core/{p-7e115d33.system.entry.js → p-da103a54.system.entry.js} +1 -1
- package/dist/pine-core/{p-7bbfb965.system.entry.js → p-db17c626.system.entry.js} +1 -1
- package/dist/pine-core/p-df539c42.system.entry.js +3 -0
- package/dist/pine-core/p-e0917a26.entry.js +1 -0
- package/dist/pine-core/p-e5420660.entry.js +1 -0
- package/dist/pine-core/{p-585832b1.entry.js → p-e800a2b1.entry.js} +1 -1
- package/dist/pine-core/{p-8b0fbeb3.entry.js → p-e836a041.entry.js} +1 -1
- package/dist/pine-core/{p-506d3e80.entry.js → p-e8cb76e8.entry.js} +1 -1
- package/dist/pine-core/p-ea4d4741.system.entry.js +1 -0
- package/dist/pine-core/{p-419f57c9.entry.js → p-eb5465ce.entry.js} +1 -1
- package/dist/pine-core/{p-63119d23.entry.js → p-ebd0bff2.entry.js} +1 -1
- package/dist/pine-core/p-ec5428fb.entry.js +1 -0
- package/dist/pine-core/{p-4e67e68e.entry.js → p-ed4b979e.entry.js} +1 -1
- package/dist/pine-core/p-f029b7da.system.entry.js +1 -0
- package/dist/pine-core/{p-e337f32c.system.entry.js → p-f0d24298.system.entry.js} +1 -1
- package/dist/pine-core/{p-9b9f66b7.entry.js → p-f1702281.entry.js} +1 -1
- package/dist/pine-core/p-f1f17940.entry.js +2 -0
- package/dist/pine-core/{p-238e5171.system.entry.js → p-f25e4731.system.entry.js} +1 -1
- package/dist/pine-core/{p-37d95be9.entry.js → p-f2c253d8.entry.js} +1 -1
- package/dist/pine-core/{p-a22091c4.system.entry.js → p-f77905aa.system.entry.js} +1 -1
- package/dist/pine-core/{p-bef04e15.system.entry.js → p-fc25b956.system.entry.js} +1 -1
- package/dist/pine-core/{p-f06ca8df.entry.js → p-ff3de72e.entry.js} +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/pine-core/pine-core.js +1 -1
- package/dist/types/components/pds-combobox/combobox-interface.d.ts +8 -1
- package/dist/types/components/pds-combobox/grouped-options-panel.d.ts +7 -1
- package/dist/types/components/pds-combobox/pds-combobox.d.ts +31 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +4 -0
- package/dist/types/components/pds-tabs/pds-tab/pds-tab.d.ts +3 -0
- package/dist/types/components/pds-tabs/pds-tabpanel/pds-tabpanel.d.ts +3 -0
- package/dist/types/components/pds-tabs/pds-tabs.d.ts +14 -2
- package/dist/types/components.d.ts +5 -5
- package/dist/types/utils/attributes.d.ts +2 -2
- package/dist/types/utils/css.d.ts +7 -0
- package/dist/types/utils/keep-hydrated.d.ts +29 -2
- package/dist/vscode.html-data.json +2 -2
- package/hydrate/index.js +604 -135
- package/hydrate/index.mjs +604 -135
- package/package.json +2 -2
- package/dist/cjs/keep-hydrated-iLS88j1Z.js +0 -67
- package/dist/esm/keep-hydrated-Dv7ssOTc.js +0 -63
- package/dist/esm-es5/attributes-CF5K2pxn.js +0 -1
- package/dist/esm-es5/keep-hydrated-Dv7ssOTc.js +0 -1
- package/dist/pine-core/p-1cd0acf0.system.entry.js +0 -1
- package/dist/pine-core/p-207c94da.entry.js +0 -1
- package/dist/pine-core/p-2357758d.system.entry.js +0 -1
- package/dist/pine-core/p-281efc69.entry.js +0 -1
- package/dist/pine-core/p-2ac9e90a.system.entry.js +0 -1
- package/dist/pine-core/p-2f539379.system.entry.js +0 -3
- package/dist/pine-core/p-34b575b6.entry.js +0 -2
- package/dist/pine-core/p-3b1d8fae.entry.js +0 -1
- package/dist/pine-core/p-539ef98c.entry.js +0 -1
- package/dist/pine-core/p-56576b6e.entry.js +0 -1
- package/dist/pine-core/p-5ac84b2f.entry.js +0 -1
- package/dist/pine-core/p-63854c10.system.entry.js +0 -1
- package/dist/pine-core/p-73bc6e9f.system.entry.js +0 -1
- package/dist/pine-core/p-798839f7.system.entry.js +0 -1
- package/dist/pine-core/p-834c678e.system.entry.js +0 -1
- package/dist/pine-core/p-912487fa.entry.js +0 -1
- package/dist/pine-core/p-969488f5.system.entry.js +0 -1
- package/dist/pine-core/p-9bcdfac2.entry.js +0 -1
- package/dist/pine-core/p-BMFBF3sJ.system.js +0 -1
- package/dist/pine-core/p-D2MUS7JO.js +0 -1
- package/dist/pine-core/p-D2yHYrxQ.system.js +0 -1
- package/dist/pine-core/p-Dv7ssOTc.js +0 -1
- package/dist/pine-core/p-TyevV8iv.system.js +0 -1
- package/dist/pine-core/p-afd5e2d7.entry.js +0 -1
- package/dist/pine-core/p-bde53290.system.entry.js +0 -1
- package/dist/pine-core/p-bf1aea9f.system.entry.js +0 -1
- package/dist/pine-core/p-c9395f43.system.entry.js +0 -1
- package/dist/pine-core/p-d5dd5599.entry.js +0 -1
- package/dist/pine-core/p-dc81ffff.entry.js +0 -1
- package/dist/pine-core/p-e46f7541.system.entry.js +0 -1
- package/dist/pine-core/p-e7ba30dd.system.entry.js +0 -1
- package/dist/pine-core/p-ed3dd3d2.entry.js +0 -1
- package/dist/pine-core/p-eee4f146.entry.js +0 -1
- package/dist/pine-core/p-f01e35e2.entry.js +0 -1
- package/dist/pine-core/p-f2e0da9a.entry.js +0 -1
- package/dist/pine-core/p-fc6ac917.entry.js +0 -1
- package/dist/pine-core/p-ffe276ef.entry.js +0 -1
- /package/dist/esm-es5/{index-DxI-61GK.js → index-BJXk71tO.js} +0 -0
- /package/dist/pine-core/{p-DxI-61GK.js → p-BJXk71tO.js} +0 -0
- /package/dist/pine-core/{p-CnO10OxH.system.js → p-n3_ytl_p.system.js} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Fragment, Host, h } from "@stencil/core";
|
|
2
|
+
import { HostStylingKeeper } from "../../../utils/attributes";
|
|
2
3
|
import { unwrapReconnectedContent } from "../../../utils/reconnected-content";
|
|
3
4
|
/**
|
|
4
5
|
* @lightDom renders-markup
|
|
5
6
|
*/
|
|
6
7
|
export class PdsTab {
|
|
7
8
|
constructor() {
|
|
9
|
+
this.hostKeeper = new HostStylingKeeper();
|
|
8
10
|
/**
|
|
9
11
|
* Determines the tab's disabled state.
|
|
10
12
|
* @defaultValue false
|
|
@@ -23,6 +25,12 @@ export class PdsTab {
|
|
|
23
25
|
/** @internal */
|
|
24
26
|
this.selected = false;
|
|
25
27
|
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
this.hostKeeper.connect(this.el);
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
this.hostKeeper.disconnect();
|
|
33
|
+
}
|
|
26
34
|
// Unwraps a nested <a>/<button> left by a page-cache (Turbo, bfcache) reconnect.
|
|
27
35
|
componentDidRender() {
|
|
28
36
|
unwrapReconnectedContent(this.el.querySelector('.pds-tab__content'), 'a.pds-tab, button.pds-tab', '.pds-tab__content');
|
|
@@ -58,6 +66,9 @@ export class PdsTab {
|
|
|
58
66
|
return classes.filter(Boolean).join(' ');
|
|
59
67
|
}
|
|
60
68
|
render() {
|
|
69
|
+
// The docs show consumers omitting `slot`, so server HTML doesn't carry it — a DOM morph
|
|
70
|
+
// that strips it leaves this tab unslotted, and pds-tabs has no default slot. Put it back.
|
|
71
|
+
this.hostKeeper.record('', {}, { slot: 'tabs' });
|
|
61
72
|
const availabilityTabEdgeInlineStart = (h("span", { class: "pds-tab-edge", role: "presentation" }));
|
|
62
73
|
const availabilityTabEdgeInlineEnd = (h("span", { class: "pds-tab-edge pds-tab-edge--end", role: "presentation" }));
|
|
63
74
|
const content = (h(Fragment, null, this.variant === "availability" && availabilityTabEdgeInlineStart, this.variant === "availability" && availabilityTabEdgeInlineEnd, h("div", { class: "pds-tab__content" }, h("slot", null))));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { HostStylingKeeper } from "../../../utils/attributes";
|
|
2
3
|
import { unwrapReconnectedContent } from "../../../utils/reconnected-content";
|
|
3
4
|
/**
|
|
4
5
|
* @lightDom renders-markup
|
|
5
6
|
*/
|
|
6
7
|
export class PdsTabpanel {
|
|
7
8
|
constructor() {
|
|
9
|
+
this.hostKeeper = new HostStylingKeeper();
|
|
8
10
|
/**
|
|
9
11
|
* Keeps track of the tabpanel selected state, this property is passed by parent component
|
|
10
12
|
*/
|
|
@@ -16,12 +18,22 @@ export class PdsTabpanel {
|
|
|
16
18
|
/** @internal */
|
|
17
19
|
this.stretch = false;
|
|
18
20
|
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.hostKeeper.connect(this.el);
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
this.hostKeeper.disconnect();
|
|
26
|
+
}
|
|
19
27
|
// Unwraps a nested .pds-tabpanel left by a page-cache (Turbo, bfcache) reconnect.
|
|
20
28
|
componentDidRender() {
|
|
21
29
|
unwrapReconnectedContent(this.el.querySelector('.pds-tabpanel'), '.pds-tabpanel');
|
|
22
30
|
}
|
|
23
31
|
render() {
|
|
24
|
-
|
|
32
|
+
const hostClass = this.stretch && this.selected ? "pds-tabpanel--stretch-active" : "";
|
|
33
|
+
// The docs show consumers omitting `slot`, so server HTML doesn't carry it — a DOM morph
|
|
34
|
+
// that strips it (and the stretch-active class) leaves this panel unslotted. Put both back.
|
|
35
|
+
this.hostKeeper.record(hostClass, {}, { slot: 'tabpanels' });
|
|
36
|
+
return (h(Host, { key: '5d867e31d0f5f14e18f1c81035991c90bb5fe529', slot: "tabpanels", class: hostClass || undefined }, h("div", { key: '255d37a73089904cfb170cd89f7b829756f6295f', role: "tabpanel", id: this.parentComponentId + "__" + this.name + '-panel', tabindex: "0", "aria-labelledby": this.parentComponentId + "__" + this.name, class: this.selected ? "pds-tabpanel is-active" : "pds-tabpanel" }, h("slot", { key: '714d3d0cf0fc6173e243a2b077d9b9918ae4acf9' }))));
|
|
25
37
|
}
|
|
26
38
|
static get is() { return "pds-tabpanel"; }
|
|
27
39
|
static get originalStyleUrls() {
|
|
@@ -8,6 +8,35 @@ import { HostStylingKeeper } from "../../utils/attributes";
|
|
|
8
8
|
export class PdsTabs {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.hostKeeper = new HostStylingKeeper();
|
|
11
|
+
this.slotChangeScheduled = false;
|
|
12
|
+
// The tab that most recently had focus, tracked continuously via `focusin` rather
|
|
13
|
+
// than sampled inside handleSlotChange: removing a focused element blurs it to
|
|
14
|
+
// <body> synchronously, but slotchange only fires later (a microtask checkpoint),
|
|
15
|
+
// by which point the sample would already read <body>.
|
|
16
|
+
this.lastFocusedTab = null;
|
|
17
|
+
this.handleFocusIn = (event) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const tab = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('pds-tab');
|
|
20
|
+
if (tab && tab.closest('pds-tabs') === this.el) {
|
|
21
|
+
this.lastFocusedTab = tab;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
// Focus that leaves a tab forgets it, so replacing the tab later doesn't pull focus back,
|
|
25
|
+
// including focus that moves into a panel. Focus moving to another tab is tracked again
|
|
26
|
+
// by focusin, which follows focusout. Removing a focused tab also fires focusout (with no
|
|
27
|
+
// relatedTarget), while the tab is still connected, so that case is checked a microtask
|
|
28
|
+
// later: a tab that's gone by then was removed, and is kept so its focus can be restored.
|
|
29
|
+
this.handleFocusOut = (event) => {
|
|
30
|
+
const tab = this.lastFocusedTab;
|
|
31
|
+
if (event.relatedTarget) {
|
|
32
|
+
this.lastFocusedTab = null;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
queueMicrotask(() => {
|
|
36
|
+
if (this.lastFocusedTab === tab && (tab === null || tab === void 0 ? void 0 : tab.isConnected))
|
|
37
|
+
this.lastFocusedTab = null;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
11
40
|
/**
|
|
12
41
|
* Adds a divider rule beneath the tab list.
|
|
13
42
|
* @defaultValue false
|
|
@@ -27,12 +56,44 @@ export class PdsTabs {
|
|
|
27
56
|
* @defaultValue false
|
|
28
57
|
*/
|
|
29
58
|
this.nav = false;
|
|
59
|
+
// The tabs and tabpanels slots fire slotchange separately, even for the same morph
|
|
60
|
+
// (both swapped together). Coalesce same-tick firings into one re-collection pass
|
|
61
|
+
// with a microtask, the way a single DOM mutation already only triggers one event.
|
|
62
|
+
this.handleSlotChange = () => {
|
|
63
|
+
if (this.slotChangeScheduled)
|
|
64
|
+
return;
|
|
65
|
+
this.slotChangeScheduled = true;
|
|
66
|
+
this.activeTabNameBeforeSlotChange = this.activeTabName;
|
|
67
|
+
queueMicrotask(() => {
|
|
68
|
+
this.slotChangeScheduled = false;
|
|
69
|
+
this.recollectAfterSlotChange();
|
|
70
|
+
});
|
|
71
|
+
};
|
|
30
72
|
}
|
|
31
73
|
connectedCallback() {
|
|
32
74
|
this.hostKeeper.connect(this.el);
|
|
75
|
+
this.el.addEventListener('focusin', this.handleFocusIn);
|
|
76
|
+
this.el.addEventListener('focusout', this.handleFocusOut);
|
|
77
|
+
// componentDidLoad only runs once, so a reconnect (the element moved in the DOM) re-attaches
|
|
78
|
+
// the slotchange listeners disconnectedCallback removed. Before the first render the slots
|
|
79
|
+
// don't exist yet, so this is a no-op and componentDidLoad attaches them.
|
|
80
|
+
const isReconnect = this.tabsSlot != null;
|
|
81
|
+
this.setupSlotChangeListeners();
|
|
82
|
+
// Content can change while detached, with no listener to see it — re-collect now
|
|
83
|
+
// instead of waiting on a slotchange that may never come if nothing changes again.
|
|
84
|
+
if (isReconnect)
|
|
85
|
+
this.handleSlotChange();
|
|
33
86
|
}
|
|
34
87
|
disconnectedCallback() {
|
|
88
|
+
var _a, _b;
|
|
35
89
|
this.hostKeeper.disconnect();
|
|
90
|
+
this.el.removeEventListener('focusin', this.handleFocusIn);
|
|
91
|
+
this.el.removeEventListener('focusout', this.handleFocusOut);
|
|
92
|
+
(_a = this.tabsSlot) === null || _a === void 0 ? void 0 : _a.removeEventListener('slotchange', this.handleSlotChange);
|
|
93
|
+
(_b = this.tabPanelsSlot) === null || _b === void 0 ? void 0 : _b.removeEventListener('slotchange', this.handleSlotChange);
|
|
94
|
+
}
|
|
95
|
+
componentDidLoad() {
|
|
96
|
+
this.setupSlotChangeListeners();
|
|
36
97
|
}
|
|
37
98
|
tabClickHandler(event) {
|
|
38
99
|
if (this.componentId === event.detail[1]) {
|
|
@@ -60,8 +121,8 @@ export class PdsTabs {
|
|
|
60
121
|
// Navigation mode is an explicit, single source of truth: `nav` drives both the
|
|
61
122
|
// container (<nav> of links vs role=tablist of buttons) and every child tab (via
|
|
62
123
|
// `navMode`), so the tabs present when the strip initializes can't mix the two.
|
|
63
|
-
//
|
|
64
|
-
//
|
|
124
|
+
// Unlike child discovery (re-run on slotchange), `nav` itself isn't watched — it's
|
|
125
|
+
// a load-time mode switch, not something a consumer is expected to toggle live.
|
|
65
126
|
get isNav() {
|
|
66
127
|
return !!this.nav;
|
|
67
128
|
}
|
|
@@ -114,9 +175,52 @@ export class PdsTabs {
|
|
|
114
175
|
this.tabs = allTabs.filter(tab => tab.closest('pds-tabs') === this.el);
|
|
115
176
|
this.tabPanels = allTabPanels.filter(panel => panel.closest('pds-tabs') === this.el);
|
|
116
177
|
}
|
|
178
|
+
// The initial collection (componentWillLoad) only sees tabs/panels present at load.
|
|
179
|
+
// A tab or panel added, removed or replaced afterwards — including by a DOM morph
|
|
180
|
+
// swapping in a fresh copy — needs to be re-collected the same way pds-dropdown-menu,
|
|
181
|
+
// pds-select and pds-multiselect already do for their own slotted content.
|
|
182
|
+
setupSlotChangeListeners() {
|
|
183
|
+
var _a, _b, _c, _d;
|
|
184
|
+
this.tabsSlot = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="tabs"]');
|
|
185
|
+
this.tabPanelsSlot = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('slot[name="tabpanels"]');
|
|
186
|
+
(_c = this.tabsSlot) === null || _c === void 0 ? void 0 : _c.addEventListener('slotchange', this.handleSlotChange);
|
|
187
|
+
(_d = this.tabPanelsSlot) === null || _d === void 0 ? void 0 : _d.addEventListener('slotchange', this.handleSlotChange);
|
|
188
|
+
}
|
|
189
|
+
recollectAfterSlotChange() {
|
|
190
|
+
const previousActiveTabName = this.activeTabNameBeforeSlotChange;
|
|
191
|
+
// A removed node stays referenced but disconnected — checked before
|
|
192
|
+
// findAllChildren() re-collects, since that doesn't affect this either way.
|
|
193
|
+
const focusedTabWasRemoved = !this.isNav && this.lastFocusedTab != null && !this.lastFocusedTab.isConnected;
|
|
194
|
+
this.findAllChildren();
|
|
195
|
+
this.warnOnNavConfig();
|
|
196
|
+
// Keep the current selection if it still exists. Otherwise clear it so
|
|
197
|
+
// passPropsToChildren() falls back to the first enabled tab, the same way
|
|
198
|
+
// it does when a consumer never set activeTabName in the first place.
|
|
199
|
+
if (previousActiveTabName != null && !this.tabs.some((tab) => tab.name === previousActiveTabName)) {
|
|
200
|
+
this.activeTabName = undefined;
|
|
201
|
+
}
|
|
202
|
+
this.passPropsToChildren();
|
|
203
|
+
// If the tab that last had focus was removed (e.g. replaced by a fresh copy),
|
|
204
|
+
// the browser already silently dropped focus to <body> — restore it to the new
|
|
205
|
+
// active tab's button so keyboard/screen-reader users don't lose their place.
|
|
206
|
+
// Deferred a frame since a freshly-created pds-tab's button doesn't exist until
|
|
207
|
+
// its own render completes; re-checked then in case focus moved on its own, to
|
|
208
|
+
// the tabs or anywhere else — only focus the removal dropped to <body> is restored.
|
|
209
|
+
if (focusedTabWasRemoved) {
|
|
210
|
+
this.lastFocusedTab = null;
|
|
211
|
+
requestAnimationFrame(() => {
|
|
212
|
+
var _a;
|
|
213
|
+
const active = document.activeElement;
|
|
214
|
+
if (active && active !== document.body)
|
|
215
|
+
return;
|
|
216
|
+
const newActiveTab = this.tabs.find((tab) => tab.name === this.activeTabName);
|
|
217
|
+
(_a = newActiveTab === null || newActiveTab === void 0 ? void 0 : newActiveTab.querySelector('button')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
117
221
|
propGeneration(child, index = 0) {
|
|
118
222
|
child.parentComponentId = this.componentId.toString();
|
|
119
|
-
child.variant = this.variant
|
|
223
|
+
child.variant = this.variant;
|
|
120
224
|
child.selected = (this.activeTabName === child.name) ? true : false;
|
|
121
225
|
child['index'] = index;
|
|
122
226
|
}
|
|
@@ -172,7 +276,7 @@ export class PdsTabs {
|
|
|
172
276
|
// Only the classes: `active-tab-name` backs the mutable activeTabName prop, so a morph that drops
|
|
173
277
|
// it is a prop change, not a strip.
|
|
174
278
|
this.hostKeeper.record(hostClass);
|
|
175
|
-
return (h(Host, { key: '
|
|
279
|
+
return (h(Host, { key: '91a9a5cf4348b73ef5ec21430db20468fb67906c', "active-tab-name": this.activeTabName, class: hostClass, id: this.componentId }, tabList, h("slot", { key: 'f0ec002e513f3e91956e905c23e35dae0e6328ad', name: "tabpanels" })));
|
|
176
280
|
}
|
|
177
281
|
static get is() { return "pds-tabs"; }
|
|
178
282
|
static get encapsulation() { return "shadow"; }
|
|
@@ -234,11 +338,11 @@ export class PdsTabs {
|
|
|
234
338
|
"resolved": "\"availability\" | \"filter\" | \"pill\" | \"primary\"",
|
|
235
339
|
"references": {}
|
|
236
340
|
},
|
|
237
|
-
"required":
|
|
238
|
-
"optional":
|
|
341
|
+
"required": false,
|
|
342
|
+
"optional": true,
|
|
239
343
|
"docs": {
|
|
240
344
|
"tags": [],
|
|
241
|
-
"text": "Sets tabs variant styles as outlined in Figma documentation"
|
|
345
|
+
"text": "Sets tabs variant styles as outlined in Figma documentation.\nApplies in both panel and nav mode; omitting it renders the primary style."
|
|
242
346
|
},
|
|
243
347
|
"getter": false,
|
|
244
348
|
"setter": false,
|
|
@@ -83,7 +83,7 @@ export class PdsText {
|
|
|
83
83
|
? `pds-text--decoration-${this.decoration}`
|
|
84
84
|
: ''}
|
|
85
85
|
`;
|
|
86
|
-
return (h(Tag, { key: '
|
|
86
|
+
return (h(Tag, { key: '6ae89af63963745cd4e8fa734a62f37bc27c59ac', ref: (el) => (this.contentEl = el), style: this.color && setColor(this.color), class: typeClasses, part: "content" }, h("slot", { key: '008f5852aeb4b43cff1a2fea9be9d8fbba9f7934' })));
|
|
87
87
|
}
|
|
88
88
|
static get is() { return "pds-text"; }
|
|
89
89
|
static get encapsulation() { return "shadow"; }
|
|
@@ -306,10 +306,10 @@ export class PdsTextarea {
|
|
|
306
306
|
}
|
|
307
307
|
render() {
|
|
308
308
|
const value = this.getValue();
|
|
309
|
-
return (h(Host, { key: '
|
|
310
|
-
h("div", { key: '
|
|
311
|
-
h("p", { key: '
|
|
312
|
-
h("p", { key: '
|
|
309
|
+
return (h(Host, { key: '5933dab0c3cd25b1cf2f6851ece8e8064bc7f3b9', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null, "has-action": this.hasAction && !this.hideLabel ? 'true' : null }, h("div", { key: '4f1752514d8e5b0f0e3439515cb9e5f043607da1', class: "pds-textarea" }, this.label &&
|
|
310
|
+
h("div", { key: 'd4e6df0b381d781b70eeae72ff2f0e9428c0d901', class: "pds-textarea__label-wrapper" }, h("label", { key: '747d82067eb571d02840cfd981865821099f288b', htmlFor: this.componentId }, h("span", { key: 'bfab6e8ede66d0169dd020b7dd97e125aba417b0', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), !this.hideLabel && this.renderAction()), h("div", { key: 'a18611c03270e7491c1af69f931419c832192c06', class: "pds-textarea__field-wrapper" }, h("textarea", Object.assign({ key: '868382c7b04a4e59c0daa9d98afcdc9048f6224f', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage, this.errorMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, maxlength: this.maxLength, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput, onKeyDown: this.onKeyDown }, this.inheritedAttributes), value), this.renderCharacterCounter()), this.helperMessage &&
|
|
311
|
+
h("p", { key: 'dcb36f21443d2a782c25b7c29c4ce6215f3b212b', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
|
|
312
|
+
h("p", { key: 'be30fb1a38453296e26b775955389c0ec569df67', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, h("pds-icon", { key: 'd93dce10d9d9db5815ac5f331848940aed735ba0', icon: danger, size: "small" }), this.errorMessage))));
|
|
313
313
|
}
|
|
314
314
|
static get is() { return "pds-textarea"; }
|
|
315
315
|
static get encapsulation() { return "shadow"; }
|
|
@@ -121,13 +121,13 @@ export class PdsToast {
|
|
|
121
121
|
return this.icon && h("pds-icon", { name: this.icon, class: "pds-toast__icon" });
|
|
122
122
|
}
|
|
123
123
|
render() {
|
|
124
|
-
return (h(Host, { key: '
|
|
124
|
+
return (h(Host, { key: '754a4583cefca47a3d3fea7dab036c06ea8aabcd', hidden: !this.isVisible }, h("div", { key: '8ac294344ca459202c0883e724e09a4218342cc4', class: {
|
|
125
125
|
'pds-toast': true,
|
|
126
126
|
[`pds-toast--${this.type}`]: this.type !== 'default',
|
|
127
127
|
'pds-toast--animating-out': this.isAnimatingOut
|
|
128
|
-
}, role: "alert", "aria-live": "polite" }, this.renderIcon(), h("span", { key: '
|
|
128
|
+
}, role: "alert", "aria-live": "polite" }, this.renderIcon(), h("span", { key: 'eaf615d41c138e2c73088d29bac9349f49a63ba7', class: "pds-toast__message" }, h("slot", { key: '33973447154d80b016f5a7954b0473db03228379' })), this.dismissible && (h("button", { key: 'e189834633e1e648282ee43633fd05e53ce38869', type: "button", part: "dismiss", class: "pds-toast__button", onClick: () => {
|
|
129
129
|
this.dismiss();
|
|
130
|
-
}, "aria-label": this.dismissLabel }, h("pds-icon", { key: '
|
|
130
|
+
}, "aria-label": this.dismissLabel }, h("pds-icon", { key: '623a0e4d56e30781fb31bcd085511c17a4777edc', name: "remove" }))))));
|
|
131
131
|
}
|
|
132
132
|
static get is() { return "pds-toast"; }
|
|
133
133
|
static get encapsulation() { return "shadow"; }
|
|
@@ -343,9 +343,9 @@ export class PdsTooltip {
|
|
|
343
343
|
}
|
|
344
344
|
render() {
|
|
345
345
|
const hostId = this.componentId || undefined;
|
|
346
|
-
return (h(Host, { key: '
|
|
346
|
+
return (h(Host, { key: '2e28dff93cd22fd3816d71b67e38883061a8b2bc', id: hostId, class: { 'pds-tooltip--is-open': this.opened } }, h("span", { key: '9e7ea50427587f61dcea1ea97e10d71f4d0c9d92', class: "pds-tooltip__trigger", onMouseEnter: this.handleShow, onMouseLeave: this.handleHide,
|
|
347
347
|
/* focusin/out bubble; ensure keyboard users see tooltips */
|
|
348
|
-
onFocusin: this.handleShow, onFocusout: this.handleHide, ref: el => this.triggerEl = el }, h("slot", { key: '
|
|
348
|
+
onFocusin: this.handleShow, onFocusout: this.handleHide, ref: el => this.triggerEl = el }, h("slot", { key: '08c1ff63c91b97b4df1362eb9b2e42b6fd556b11' })), h("div", { key: '5cfe25e21d1f096b76335570fbb930a7bc8c95f8', class: "pds-tooltip__content-slot-wrapper", hidden: true }, h("slot", { key: 'e7e8728d7c8a0c74933cef070aa38f88a1f53a32', name: "content" }))));
|
|
349
349
|
}
|
|
350
350
|
static get is() { return "pds-tooltip"; }
|
|
351
351
|
static get originalStyleUrls() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classNamesOf,
|
|
1
|
+
import { classNamesOf, HOST_RESTORE, limitRestores, stencilClassesOf } from "./keep-hydrated";
|
|
2
2
|
/**
|
|
3
3
|
* Sets each attribute whose current value differs, and leaves the rest alone. A `MutationObserver`
|
|
4
4
|
* that calls this to restore attributes sees its own writes once and then settles, so it can't loop.
|
|
@@ -6,10 +6,14 @@ import { classNamesOf, isStencilClass } from "./keep-hydrated";
|
|
|
6
6
|
* @param attributes - Attribute names and the values they should have
|
|
7
7
|
*/
|
|
8
8
|
export const setAttributesIfChanged = (el, attributes) => {
|
|
9
|
+
let wrote = false;
|
|
9
10
|
Object.entries(attributes).forEach(([name, value]) => {
|
|
10
|
-
if (el.getAttribute(name) !== value)
|
|
11
|
+
if (el.getAttribute(name) !== value) {
|
|
11
12
|
el.setAttribute(name, value);
|
|
13
|
+
wrote = true;
|
|
14
|
+
}
|
|
12
15
|
});
|
|
16
|
+
return wrote;
|
|
13
17
|
};
|
|
14
18
|
/**
|
|
15
19
|
* Puts back any of `expected`'s classes or style properties that are missing from `el`. It only
|
|
@@ -22,10 +26,9 @@ export const restoreHostStyling = (el, { classes, styles }) => {
|
|
|
22
26
|
const missing = classes.filter((name) => !el.classList.contains(name));
|
|
23
27
|
if (missing.length > 0)
|
|
24
28
|
el.classList.add(...missing);
|
|
25
|
-
Object.entries(styles).
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
+
const missingStyles = Object.entries(styles).filter(([name, value]) => value && el.style.getPropertyValue(name) === '');
|
|
30
|
+
missingStyles.forEach(([name, value]) => el.style.setProperty(name, value));
|
|
31
|
+
return missing.length > 0 || missingStyles.length > 0;
|
|
29
32
|
};
|
|
30
33
|
/**
|
|
31
34
|
* Watches a component's own host and puts back what it rendered when something strips it. A DOM
|
|
@@ -42,16 +45,18 @@ export const restoreHostStyling = (el, { classes, styles }) => {
|
|
|
42
45
|
const keepHostStyling = (el, expected) => {
|
|
43
46
|
if (typeof MutationObserver === 'undefined')
|
|
44
47
|
return null;
|
|
45
|
-
const
|
|
48
|
+
const tag = el.tagName.toLowerCase();
|
|
49
|
+
const seenStencilClasses = new Set();
|
|
50
|
+
const observer = new MutationObserver(limitRestores((records) => {
|
|
46
51
|
const styling = expected();
|
|
47
52
|
// A strip takes Stencil's own classes too: without `hydrated` Stencil hides the component, and
|
|
48
53
|
// without its scope classes a scoped component's CSS stops matching. Put back only the ones that
|
|
49
54
|
// were there, so this never runs ahead of Stencil. `keepPineHydrated` does the same for every
|
|
50
55
|
// component, but the custom-elements build only runs it if the consumer calls it, so keep this.
|
|
51
56
|
const stencilClasses = records
|
|
52
|
-
.filter((record) => record.attributeName === 'class'
|
|
53
|
-
.flatMap((record) =>
|
|
54
|
-
restoreHostStyling(el, Object.assign(Object.assign({}, styling), { classes: [...styling.classes, ...stencilClasses] }));
|
|
57
|
+
.filter((record) => record.attributeName === 'class')
|
|
58
|
+
.flatMap((record) => stencilClassesOf(seenStencilClasses, el, record.oldValue));
|
|
59
|
+
let wrote = restoreHostStyling(el, Object.assign(Object.assign({}, styling), { classes: [...styling.classes, ...stencilClasses] }));
|
|
55
60
|
// An attribute the component still renders comes back with the value it had, which is what
|
|
56
61
|
// Stencil wrote (a boolean `true` lands as an empty value). One it stopped rendering stays
|
|
57
62
|
// removed, since that was Stencil's own write.
|
|
@@ -61,8 +66,10 @@ const keepHostStyling = (el, expected) => {
|
|
|
61
66
|
if (oldValue == null || rendered == null || rendered === false || el.hasAttribute(name))
|
|
62
67
|
return;
|
|
63
68
|
el.setAttribute(name, oldValue);
|
|
69
|
+
wrote = true;
|
|
64
70
|
});
|
|
65
|
-
|
|
71
|
+
return wrote;
|
|
72
|
+
}, `${tag}: stopped restoring its host, as another script keeps changing it. Use props instead.`, el, HOST_RESTORE));
|
|
66
73
|
observer.observe(el, { attributes: true, attributeOldValue: true });
|
|
67
74
|
return observer;
|
|
68
75
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes a string so it's safe to interpolate into a CSS identifier (an id selector like `#${id}`)
|
|
3
|
+
* or into CSS text (a stylesheet rule referencing that id). Equivalent to the native `CSS.escape`,
|
|
4
|
+
* reimplemented because Stencil's unit-test DOM (`newSpecPage`'s mock-doc) doesn't provide it.
|
|
5
|
+
* @param value - The string to escape, e.g. a consumer-supplied id
|
|
6
|
+
*/
|
|
7
|
+
export const cssEscape = (value) => {
|
|
8
|
+
const string = String(value);
|
|
9
|
+
const length = string.length;
|
|
10
|
+
const firstCodeUnit = string.charCodeAt(0);
|
|
11
|
+
let result = '';
|
|
12
|
+
for (let index = 0; index < length; index++) {
|
|
13
|
+
const codeUnit = string.charCodeAt(index);
|
|
14
|
+
if (codeUnit === 0x0000) {
|
|
15
|
+
result += '�';
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if ((codeUnit >= 0x0001 && codeUnit <= 0x001f) ||
|
|
19
|
+
codeUnit === 0x007f ||
|
|
20
|
+
(index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
21
|
+
(index === 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && firstCodeUnit === 0x002d)) {
|
|
22
|
+
result += `\\${codeUnit.toString(16)} `;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (index === 0 && length === 1 && codeUnit === 0x002d) {
|
|
26
|
+
result += `\\${string.charAt(index)}`;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (codeUnit >= 0x0080 ||
|
|
30
|
+
codeUnit === 0x002d ||
|
|
31
|
+
codeUnit === 0x005f ||
|
|
32
|
+
(codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
33
|
+
(codeUnit >= 0x0041 && codeUnit <= 0x005a) ||
|
|
34
|
+
(codeUnit >= 0x0061 && codeUnit <= 0x007a)) {
|
|
35
|
+
result += string.charAt(index);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
result += `\\${string.charAt(index)}`;
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
@@ -16,6 +16,109 @@ export const isStencilClass = (el, name) => {
|
|
|
16
16
|
export const classNamesOf = (classes) => typeof classes === 'string'
|
|
17
17
|
? classes.split(/\s+/).filter(Boolean)
|
|
18
18
|
: Object.keys(classes).filter((name) => classes[name]);
|
|
19
|
+
// Each restore that writes something counts. A real strip costs one, but a script that undoes the
|
|
20
|
+
// restore as soon as it lands (from a MutationObserver) keeps both going forever, all in
|
|
21
|
+
// microtasks, so the page never renders or takes input. More writes than this before the next task
|
|
22
|
+
// means that kind of fight. A script that undoes it from a timer or animation frame gets a fresh
|
|
23
|
+
// budget each task; the page stays responsive then, so that fight isn't capped.
|
|
24
|
+
const MAX_RESTORES_PER_TASK = 5;
|
|
25
|
+
// Callbacks waiting for the next task, all run by one message. A MessageChannel message isn't slowed
|
|
26
|
+
// down like a timer is in a background tab (or frozen by test fake timers); a timer is the fallback
|
|
27
|
+
// where it's missing. One message for all of them, so a morph that strips many hosts doesn't open a
|
|
28
|
+
// channel for each.
|
|
29
|
+
const nextTaskCallbacks = new Set();
|
|
30
|
+
const runNextTaskCallbacks = () => {
|
|
31
|
+
const callbacks = Array.from(nextTaskCallbacks);
|
|
32
|
+
nextTaskCallbacks.clear();
|
|
33
|
+
callbacks.forEach((callback) => callback());
|
|
34
|
+
};
|
|
35
|
+
const onNextTask = (callback) => {
|
|
36
|
+
nextTaskCallbacks.add(callback);
|
|
37
|
+
if (nextTaskCallbacks.size > 1)
|
|
38
|
+
return;
|
|
39
|
+
if (typeof MessageChannel === 'undefined') {
|
|
40
|
+
setTimeout(runNextTaskCallbacks);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const channel = new MessageChannel();
|
|
44
|
+
channel.port1.onmessage = () => {
|
|
45
|
+
channel.port1.close();
|
|
46
|
+
runNextTaskCallbacks();
|
|
47
|
+
};
|
|
48
|
+
channel.port2.postMessage(null);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The restore kind for a host's own classes, styles and attributes, shared by a component's own
|
|
52
|
+
* host restore and `keepPineHydrated`: one fight on a host's classes stops both, and warns once.
|
|
53
|
+
*/
|
|
54
|
+
export const HOST_RESTORE = 'host';
|
|
55
|
+
/**
|
|
56
|
+
* Remembers the Stencil classes an element has had, and returns all of them. A restore can't read
|
|
57
|
+
* them from the latest mutation alone: after a script's last strip they're gone from its old value
|
|
58
|
+
* too, and the next change would restore nothing.
|
|
59
|
+
*/
|
|
60
|
+
export const stencilClassesOf = (seen, el, oldValue) => {
|
|
61
|
+
[...classNamesOf(oldValue !== null && oldValue !== void 0 ? oldValue : ''), ...Array.from(el.classList)]
|
|
62
|
+
.filter((name) => isStencilClass(el, name))
|
|
63
|
+
.forEach((name) => seen.add(name));
|
|
64
|
+
return Array.from(seen);
|
|
65
|
+
};
|
|
66
|
+
// What each element has already been warned about, by kind of restore. A host with its own restore
|
|
67
|
+
// is also watched for its Stencil classes, so one fight on its classes stops both and needs one
|
|
68
|
+
// warning; a fight over a trigger's ARIA is a different kind, and warns on its own. On the global
|
|
69
|
+
// object, like `OBSERVER` below, so two copies of Pine on a page share it.
|
|
70
|
+
const WARNED = Symbol.for('@pine-ds/core/restoreWarnings');
|
|
71
|
+
const warnedKinds = () => {
|
|
72
|
+
var _a;
|
|
73
|
+
const store = globalThis;
|
|
74
|
+
return ((_a = store[WARNED]) !== null && _a !== void 0 ? _a : (store[WARNED] = new WeakMap()));
|
|
75
|
+
};
|
|
76
|
+
/** Whether `el` was already warned about for `kind`; records it if not. */
|
|
77
|
+
const alreadyWarned = (el, kind) => {
|
|
78
|
+
var _a;
|
|
79
|
+
const kinds = (_a = warnedKinds().get(el)) !== null && _a !== void 0 ? _a : new Set();
|
|
80
|
+
warnedKinds().set(el, kinds);
|
|
81
|
+
if (kinds.has(kind))
|
|
82
|
+
return true;
|
|
83
|
+
kinds.add(kind);
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Wraps a restore callback, which returns whether it wrote anything, so that it writes at most
|
|
88
|
+
* `MAX_RESTORES_PER_TASK` times before the next task (until the message posted after its first write
|
|
89
|
+
* runs). Past that, another script is undoing every restore as soon as it lands, so it stops and
|
|
90
|
+
* lets that script win rather than hang the page. What that script left stays until something
|
|
91
|
+
* changes the element again: the count resets on the next task, so a later change is restored, but
|
|
92
|
+
* nothing is restored on its own. The first give-up warns, logging `el` so it can be found in
|
|
93
|
+
* devtools; later ones, and other restores of the same `kind` giving up on the same element, are
|
|
94
|
+
* silent.
|
|
95
|
+
* @param restore - Puts back what something removed; returns `true` if it wrote anything
|
|
96
|
+
* @param warning - What the console warning says was given up
|
|
97
|
+
* @param el - The element being restored, logged with the warning
|
|
98
|
+
* @param kind - What's being restored; one warning per element for each kind
|
|
99
|
+
*/
|
|
100
|
+
export const limitRestores = (restore, warning, el, kind = warning) => {
|
|
101
|
+
let writes = 0;
|
|
102
|
+
let warned = false;
|
|
103
|
+
return (...args) => {
|
|
104
|
+
if (writes >= MAX_RESTORES_PER_TASK) {
|
|
105
|
+
if (!warned) {
|
|
106
|
+
warned = true;
|
|
107
|
+
if (el && alreadyWarned(el, kind))
|
|
108
|
+
return;
|
|
109
|
+
// The warning as an argument, not the format string: it carries the tag name, which the HTML
|
|
110
|
+
// parser lets contain `%`.
|
|
111
|
+
console.warn('%s', warning, el);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (!restore(...args))
|
|
116
|
+
return;
|
|
117
|
+
if (writes === 0)
|
|
118
|
+
onNextTask(() => (writes = 0));
|
|
119
|
+
writes += 1;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
19
122
|
// On the global object, not in this module, so a page with two copies of Pine (the CDN build and a
|
|
20
123
|
// bundled `@pine-ds/react`) still has one observer.
|
|
21
124
|
const OBSERVER = Symbol.for('@pine-ds/core/keepPineHydrated');
|
|
@@ -26,8 +129,9 @@ const OBSERVER = Symbol.for('@pine-ds/core/keepPineHydrated');
|
|
|
26
129
|
* host restore of their own. It only restores classes the element had, so it never runs ahead of
|
|
27
130
|
* Stencil. It can't see inside shadow roots, which a morph doesn't reach either.
|
|
28
131
|
*
|
|
29
|
-
* A script that removes `hydrated` on purpose sees it come back
|
|
30
|
-
* appears
|
|
132
|
+
* A script that removes `hydrated` on purpose sees it come back. One that removes it every time it
|
|
133
|
+
* appears (from a `MutationObserver`, say) wins after a few rounds, and the component logs a console
|
|
134
|
+
* warning. The component then stays hidden, as that script left it, until its class changes again.
|
|
31
135
|
*
|
|
32
136
|
* Pine's global script calls this, so the CDN and `dist` builds get it on load. The custom-elements
|
|
33
137
|
* build (`@pine-ds/core/components/*`, `@pine-ds/react`) has no global script: call it once yourself.
|
|
@@ -40,14 +144,37 @@ export const keepPineHydrated = () => {
|
|
|
40
144
|
const store = globalThis;
|
|
41
145
|
if (store[OBSERVER])
|
|
42
146
|
return;
|
|
147
|
+
// One capped restore per element, so a script fighting one component doesn't stop the others,
|
|
148
|
+
// and the Stencil classes each one has had.
|
|
149
|
+
const restores = new WeakMap();
|
|
150
|
+
const seen = new WeakMap();
|
|
151
|
+
const restoreFor = (el) => {
|
|
152
|
+
let restore = restores.get(el);
|
|
153
|
+
if (!restore) {
|
|
154
|
+
restore = limitRestores((names) => {
|
|
155
|
+
const missing = names.filter((name) => !el.classList.contains(name));
|
|
156
|
+
if (missing.length > 0)
|
|
157
|
+
el.classList.add(...missing);
|
|
158
|
+
return missing.length > 0;
|
|
159
|
+
}, `${el.localName}: stopped putting back its hydrated and scope classes, as another script keeps removing them.`, el, HOST_RESTORE);
|
|
160
|
+
restores.set(el, restore);
|
|
161
|
+
}
|
|
162
|
+
return restore;
|
|
163
|
+
};
|
|
43
164
|
const observer = new MutationObserver((records) => {
|
|
44
165
|
records.forEach(({ target, oldValue }) => {
|
|
45
166
|
const el = target;
|
|
46
|
-
if (
|
|
167
|
+
if (!el.localName.startsWith('pds-'))
|
|
168
|
+
return;
|
|
169
|
+
// No old value is a `class` being added. Stencil's first `hydrated` arrives that way, which
|
|
170
|
+
// needs nothing; for an element already seen, it's the class coming back after a removal.
|
|
171
|
+
if (oldValue == null && !seen.has(el))
|
|
47
172
|
return;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
173
|
+
if (!seen.has(el))
|
|
174
|
+
seen.set(el, new Set());
|
|
175
|
+
const names = stencilClassesOf(seen.get(el), el, oldValue);
|
|
176
|
+
if (names.length > 0)
|
|
177
|
+
restoreFor(el)(names);
|
|
51
178
|
});
|
|
52
179
|
});
|
|
53
180
|
// The document rather than its root element, so replacing `<html>` doesn't end the watch.
|