@wordpress/components 28.11.0 → 28.13.1-next.082ed6819.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/CHANGELOG.md +68 -0
- package/build/autocomplete/autocompleter-ui.js +1 -0
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +1 -0
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control/component.js +2 -1
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +3 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/types.js.map +1 -1
- package/build/box-control/all-input-control.js +1 -0
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +1 -0
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/input-controls.js +1 -0
- package/build/box-control/input-controls.js.map +1 -1
- package/build/color-palette/index.js +2 -0
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-copy-button.js +6 -4
- package/build/color-picker/color-copy-button.js.map +1 -1
- package/build/color-picker/component.js +1 -0
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +21 -28
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +17 -12
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/hover.js +1 -1
- package/build/composite/hover.js.map +1 -1
- package/build/composite/typeahead.js +1 -1
- package/build/composite/typeahead.js.map +1 -1
- package/build/dashicon/types.js.map +1 -1
- package/build/dimension-control/index.js +7 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/disabled/index.js +8 -1
- package/build/disabled/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +2 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +7 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-file-upload/index.js +7 -1
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-token-field/token.js +1 -0
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +34 -32
- package/build/gradient-picker/index.js.map +1 -1
- package/build/gradient-picker/types.js.map +1 -1
- package/build/guide/page-control.js +1 -0
- package/build/guide/page-control.js.map +1 -1
- package/build/menu/styles.js +16 -16
- package/build/menu/styles.js.map +1 -1
- package/build/menu-item/index.js +1 -0
- package/build/menu-item/index.js.map +1 -1
- package/build/modal/index.js +2 -2
- package/build/modal/index.js.map +1 -1
- package/build/notice/index.js +2 -0
- package/build/notice/index.js.map +1 -1
- package/build/palette-edit/index.js +5 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/body.js +1 -0
- package/build/panel/body.js.map +1 -1
- package/build/popover/index.js +4 -1
- package/build/popover/index.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/radio-group/radio.js +6 -0
- package/build/radio-group/radio.js.map +1 -1
- package/build/radio-group/types.js.map +1 -1
- package/build/range-control/index.js +11 -0
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/types.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +14 -31
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +11 -9
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +1 -8
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/fill.js +7 -24
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/index.js +5 -10
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/provider.js +2 -2
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +37 -77
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/snackbar/index.js +2 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/tabs/tablist.js +13 -2
- package/build/tabs/tablist.js.map +1 -1
- package/build/text-control/index.js +7 -0
- package/build/text-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +10 -1
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +1 -0
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/toggle-group-control/types.js.map +1 -1
- package/build/utils/deprecated-36px-size.js +3 -2
- package/build/utils/deprecated-36px-size.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +1 -0
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +2 -1
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +3 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/types.js.map +1 -1
- package/build-module/box-control/all-input-control.js +1 -0
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +1 -0
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/input-controls.js +1 -0
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/color-palette/index.js +2 -0
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +6 -4
- package/build-module/color-picker/color-copy-button.js.map +1 -1
- package/build-module/color-picker/component.js +1 -0
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/styles.js +20 -27
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +18 -13
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/hover.js +1 -1
- package/build-module/composite/hover.js.map +1 -1
- package/build-module/composite/typeahead.js +1 -1
- package/build-module/composite/typeahead.js.map +1 -1
- package/build-module/dashicon/types.js.map +1 -1
- package/build-module/dimension-control/index.js +7 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/disabled/index.js +8 -1
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +2 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +7 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-file-upload/index.js +7 -1
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -0
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +34 -32
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/gradient-picker/types.js.map +1 -1
- package/build-module/guide/page-control.js +1 -0
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/menu/styles.js +16 -16
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu-item/index.js +1 -0
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/modal/index.js +2 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/notice/index.js +2 -0
- package/build-module/notice/index.js.map +1 -1
- package/build-module/palette-edit/index.js +5 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/body.js +1 -0
- package/build-module/panel/body.js.map +1 -1
- package/build-module/popover/index.js +4 -1
- package/build-module/popover/index.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/radio-group/radio.js +6 -0
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/radio-group/types.js.map +1 -1
- package/build-module/range-control/index.js +11 -0
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/types.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +15 -32
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +11 -9
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +2 -9
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +7 -24
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/index.js +5 -8
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/provider.js +2 -3
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +38 -78
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/snackbar/index.js +2 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/tabs/tablist.js +13 -2
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/text-control/index.js +7 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +10 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -0
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/toggle-group-control/types.js.map +1 -1
- package/build-module/utils/deprecated-36px-size.js +3 -2
- package/build-module/utils/deprecated-36px-size.js.map +1 -1
- package/build-style/style-rtl.css +15 -36
- package/build-style/style.css +15 -36
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +1 -0
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +10 -5
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +7 -0
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/box-control/all-input-control.d.ts.map +1 -1
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
- package/build-types/box-control/input-controls.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -1
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts +1 -0
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/typeahead.d.ts.map +1 -1
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +1 -1
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -0
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/disabled/index.d.ts +8 -1
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
- package/build-types/external-link/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/index.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/token.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +32 -32
- package/build-types/gradient-picker/index.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/types.d.ts +1 -5
- package/build-types/gradient-picker/types.d.ts.map +1 -1
- package/build-types/guide/page-control.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
- package/build-types/heading/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -2
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/index.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/panel/body.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts +4 -2
- package/build-types/radio-group/radio.d.ts.map +1 -1
- package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-group/types.d.ts +5 -1
- package/build-types/radio-group/types.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +3 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +7 -0
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts +3 -7
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +5 -12
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +15 -18
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts +1 -1
- package/build-types/slot-fill/use-slot.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
- package/build-types/spinner/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +1 -0
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tip/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -0
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -0
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +7 -0
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/truncate/stories/index.story.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
- package/build-types/utils/deprecated-36px-size.d.ts +3 -2
- package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/autocomplete/autocompleter-ui.tsx +1 -0
- package/src/base-control/stories/index.story.tsx +2 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
- package/src/border-control/border-control/component.tsx +1 -0
- package/src/border-control/border-control/hook.ts +2 -0
- package/src/border-control/border-control-dropdown/component.tsx +1 -1
- package/src/border-control/types.ts +7 -0
- package/src/box-control/all-input-control.tsx +1 -0
- package/src/box-control/axial-input-controls.tsx +1 -0
- package/src/box-control/input-controls.tsx +1 -0
- package/src/checkbox-control/stories/index.story.tsx +2 -1
- package/src/circular-option-picker/stories/index.story.tsx +2 -1
- package/src/color-indicator/stories/index.story.tsx +2 -1
- package/src/color-palette/index.tsx +5 -1
- package/src/color-palette/stories/index.story.tsx +2 -1
- package/src/color-picker/color-copy-button.tsx +8 -10
- package/src/color-picker/component.tsx +1 -0
- package/src/color-picker/stories/index.story.tsx +2 -1
- package/src/color-picker/styles.ts +0 -13
- package/src/combobox-control/README.md +1 -0
- package/src/combobox-control/index.tsx +19 -13
- package/src/combobox-control/stories/index.story.tsx +3 -1
- package/src/combobox-control/style.scss +0 -6
- package/src/combobox-control/test/index.tsx +7 -1
- package/src/composite/hover.tsx +1 -1
- package/src/composite/typeahead.tsx +3 -1
- package/src/confirm-dialog/stories/index.story.tsx +2 -1
- package/src/custom-gradient-picker/stories/index.story.tsx +2 -1
- package/src/custom-select-control/stories/index.story.tsx +2 -1
- package/src/custom-select-control-v2/stories/index.story.tsx +2 -1
- package/src/dashicon/types.ts +0 -2
- package/src/date-time/stories/date-time.story.tsx +2 -1
- package/src/date-time/stories/date.story.tsx +2 -1
- package/src/date-time/stories/time.story.tsx +2 -1
- package/src/dimension-control/README.md +1 -0
- package/src/dimension-control/index.tsx +8 -0
- package/src/dimension-control/stories/index.story.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +24 -24
- package/src/dimension-control/test/index.test.js +7 -1
- package/src/disabled/README.md +9 -7
- package/src/disabled/index.tsx +8 -1
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +2 -1
- package/src/dropdown/stories/index.story.tsx +2 -1
- package/src/dropdown-menu/stories/index.story.tsx +2 -1
- package/src/duotone-picker/duotone-picker.tsx +2 -0
- package/src/external-link/stories/index.story.tsx +2 -1
- package/src/font-size-picker/README.md +1 -0
- package/src/font-size-picker/font-size-picker-toggle-group.tsx +1 -0
- package/src/font-size-picker/index.tsx +8 -0
- package/src/font-size-picker/stories/index.story.tsx +1 -0
- package/src/font-size-picker/test/index.tsx +5 -1
- package/src/form-file-upload/index.tsx +13 -1
- package/src/form-file-upload/stories/index.story.tsx +2 -1
- package/src/form-token-field/stories/index.story.tsx +2 -1
- package/src/form-token-field/style.scss +8 -12
- package/src/form-token-field/token.tsx +1 -0
- package/src/gradient-picker/README.md +107 -69
- package/src/gradient-picker/docs-manifest.json +5 -0
- package/src/gradient-picker/index.tsx +34 -32
- package/src/gradient-picker/stories/index.story.tsx +2 -1
- package/src/gradient-picker/types.ts +3 -5
- package/src/guide/page-control.tsx +1 -0
- package/src/guide/style.scss +4 -6
- package/src/h-stack/stories/index.story.tsx +2 -1
- package/src/heading/stories/index.story.tsx +2 -1
- package/src/higher-order/with-constrained-tabbing/README.md +13 -3
- package/src/higher-order/with-focus-return/README.md +9 -2
- package/src/input-control/stories/index.story.tsx +2 -1
- package/src/menu/stories/index.story.tsx +2 -1
- package/src/menu/styles.ts +1 -1
- package/src/menu-group/stories/index.story.tsx +2 -1
- package/src/menu-item/index.tsx +1 -0
- package/src/menu-item/stories/index.story.tsx +2 -1
- package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
- package/src/menu-items-choice/stories/index.story.tsx +2 -1
- package/src/modal/index.tsx +2 -2
- package/src/modal/stories/index.story.tsx +3 -2
- package/src/navigator/stories/index.story.tsx +2 -1
- package/src/notice/index.tsx +2 -0
- package/src/notice/stories/index.story.tsx +7 -2
- package/src/notice/test/__snapshots__/index.tsx.snap +4 -4
- package/src/number-control/stories/index.story.tsx +2 -1
- package/src/palette-edit/index.tsx +5 -0
- package/src/panel/body.tsx +1 -0
- package/src/placeholder/stories/index.story.tsx +1 -0
- package/src/popover/index.tsx +3 -0
- package/src/popover/stories/index.story.tsx +2 -1
- package/src/private-apis.ts +0 -2
- package/src/progress-bar/stories/index.story.tsx +2 -1
- package/src/radio-control/stories/index.story.tsx +2 -1
- package/src/radio-group/README.md +8 -8
- package/src/radio-group/radio.tsx +7 -0
- package/src/radio-group/stories/index.story.tsx +16 -4
- package/src/radio-group/types.ts +6 -1
- package/src/range-control/README.md +4 -3
- package/src/range-control/index.tsx +11 -0
- package/src/range-control/stories/index.story.tsx +9 -1
- package/src/range-control/test/index.tsx +7 -1
- package/src/range-control/types.ts +7 -0
- package/src/responsive-wrapper/stories/index.story.tsx +2 -1
- package/src/search-control/stories/index.story.tsx +2 -1
- package/src/select-control/stories/index.story.tsx +2 -1
- package/src/slot-fill/README.md +26 -15
- package/src/slot-fill/bubbles-virtually/fill.tsx +18 -28
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +26 -16
- package/src/slot-fill/bubbles-virtually/slot.tsx +13 -9
- package/src/slot-fill/bubbles-virtually/use-slot.ts +3 -26
- package/src/slot-fill/fill.ts +7 -22
- package/src/slot-fill/index.tsx +5 -7
- package/src/slot-fill/provider.tsx +8 -17
- package/src/slot-fill/slot.tsx +48 -85
- package/src/slot-fill/types.ts +14 -51
- package/src/snackbar/index.tsx +2 -1
- package/src/snackbar/stories/index.story.tsx +2 -1
- package/src/snackbar/stories/list.story.tsx +2 -1
- package/src/snackbar/style.scss +7 -16
- package/src/spinner/stories/index.story.tsx +2 -1
- package/src/tabs/tablist.tsx +13 -2
- package/src/text/stories/index.story.tsx +2 -1
- package/src/text-control/README.md +1 -0
- package/src/text-control/index.tsx +8 -0
- package/src/text-control/stories/index.story.tsx +3 -1
- package/src/text-control/test/text-control.tsx +7 -1
- package/src/text-highlight/stories/index.story.tsx +2 -1
- package/src/textarea-control/stories/index.story.tsx +2 -1
- package/src/tip/stories/index.story.tsx +2 -1
- package/src/toggle-control/stories/index.story.tsx +2 -1
- package/src/toggle-group-control/stories/index.story.tsx +3 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -12
- package/src/toggle-group-control/test/index.tsx +7 -1
- package/src/toggle-group-control/toggle-group-control/README.md +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +11 -1
- package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -0
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
- package/src/toggle-group-control/types.ts +7 -0
- package/src/tools-panel/stories/index.story.tsx +3 -0
- package/src/tooltip/stories/index.story.tsx +2 -1
- package/src/tree-grid/stories/index.story.tsx +2 -1
- package/src/tree-select/stories/index.story.tsx +2 -1
- package/src/truncate/stories/index.story.tsx +2 -1
- package/src/unit-control/stories/index.story.tsx +2 -1
- package/src/utils/deprecated-36px-size.ts +8 -2
- package/src/v-stack/stories/index.story.tsx +2 -1
- package/src/visually-hidden/stories/index.story.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_compose","require","_element","_slotFillContext","_interopRequireDefault","_styleProvider","_jsxRuntime","Fill","name","children","_slot$fillProps","registry","useContext","SlotFillContext","slot","useObservableValue","slots","rerender","useReducer","ref","useRef","useEffect","refValue","current","registerFill","unregisterFill","wrappedChildren","jsx","default","document","ownerDocument","fillProps","createPortal"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/fill.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useObservableValue } from '@wordpress/compose';\nimport {\n\tuseContext,\n\tuseReducer,\n\tuseRef,\n\tuseEffect,\n\tcreatePortal,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport StyleProvider from '../../style-provider';\nimport type { FillComponentProps } from '../types';\n\nexport default function Fill( { name, children }: FillComponentProps ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\tconst [ , rerender ] = useReducer( () => [], [] );\n\tconst ref = useRef( { rerender } );\n\n\tuseEffect( () => {\n\t\t// We register fills so we can keep track of their existence.\n\t\t// Some Slot implementations need to know if there're already fills\n\t\t// registered so they can choose to render themselves or not.\n\t\tconst refValue = ref.current;\n\t\tregistry.registerFill( name, refValue );\n\t\treturn () => {\n\t\t\tregistry.unregisterFill( name, refValue );\n\t\t};\n\t}, [ registry, name ] );\n\n\tif ( ! slot || ! slot.ref.current ) {\n\t\treturn null;\n\t}\n\n\t// When using a `Fill`, the `children` will be rendered in the document of the\n\t// `Slot`. This means that we need to wrap the `children` in a `StyleProvider`\n\t// to make sure we're referencing the right document/iframe (instead of the\n\t// context of the `Fill`'s parent).\n\tconst wrappedChildren = (\n\t\t<StyleProvider document={ slot.ref.current.ownerDocument }>\n\t\t\t{ typeof children === 'function'\n\t\t\t\t? children( slot.fillProps ?? {} )\n\t\t\t\t: children }\n\t\t</StyleProvider>\n\t);\n\n\treturn createPortal( wrappedChildren, slot.ref.current );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAWA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,cAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAiD,IAAAK,WAAA,GAAAL,OAAA;AAhBjD;AACA;AACA;;AAUA;AACA;AACA;;AAKe,SAASM,IAAIA,CAAE;EAAEC,IAAI;EAAEC;AAA6B,CAAC,EAAG;EAAA,IAAAC,eAAA;EACtE,MAAMC,QAAQ,GAAG,IAAAC,mBAAU,EAAEC,wBAAgB,CAAC;EAC9C,MAAMC,IAAI,GAAG,IAAAC,2BAAkB,EAAEJ,QAAQ,CAACK,KAAK,EAAER,IAAK,CAAC;EACvD,MAAM,GAAIS,QAAQ,CAAE,GAAG,IAAAC,mBAAU,EAAE,MAAM,EAAE,EAAE,EAAG,CAAC;EACjD,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAE;IAAEH;EAAS,CAAE,CAAC;EAElC,IAAAI,kBAAS,EAAE,MAAM;IAChB;IACA;IACA;IACA,MAAMC,QAAQ,GAAGH,GAAG,CAACI,OAAO;IAC5BZ,QAAQ,CAACa,YAAY,CAAEhB,IAAI,EAAEc,QAAS,CAAC;IACvC,OAAO,MAAM;MACZX,QAAQ,CAACc,cAAc,CAAEjB,IAAI,EAAEc,QAAS,CAAC;IAC1C,CAAC;EACF,CAAC,EAAE,CAAEX,QAAQ,EAAEH,IAAI,CAAG,CAAC;EAEvB,IAAK,CAAEM,IAAI,IAAI,CAAEA,IAAI,CAACK,GAAG,CAACI,OAAO,EAAG;IACnC,OAAO,IAAI;EACZ;;EAEA;EACA;EACA;EACA;EACA,MAAMG,eAAe,gBACpB,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,cAAA,CAAAuB,OAAa;IAACC,QAAQ,EAAGf,IAAI,CAACK,GAAG,CAACI,OAAO,CAACO,aAAe;IAAArB,QAAA,EACvD,OAAOA,QAAQ,KAAK,UAAU,GAC7BA,QAAQ,EAAAC,eAAA,GAAEI,IAAI,CAACiB,SAAS,cAAArB,eAAA,cAAAA,eAAA,GAAI,CAAC,CAAE,CAAC,GAChCD;EAAQ,CACG,CACf;EAED,OAAO,IAAAuB,qBAAY,EAAEN,eAAe,EAAEZ,IAAI,CAACK,GAAG,CAACI,OAAQ,CAAC;AACzD","ignoreList":[]}
|
|
@@ -30,17 +30,26 @@ function createSlotRegistry() {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
const unregisterSlot = (name, ref) => {
|
|
33
|
+
const slot = slots.get(name);
|
|
34
|
+
if (!slot) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
// Make sure we're not unregistering a slot registered by another element
|
|
34
39
|
// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
|
|
35
|
-
if (
|
|
36
|
-
|
|
40
|
+
if (slot.ref !== ref) {
|
|
41
|
+
return;
|
|
37
42
|
}
|
|
43
|
+
slots.delete(name);
|
|
38
44
|
};
|
|
39
|
-
const updateSlot = (name, fillProps) => {
|
|
45
|
+
const updateSlot = (name, ref, fillProps) => {
|
|
40
46
|
const slot = slots.get(name);
|
|
41
47
|
if (!slot) {
|
|
42
48
|
return;
|
|
43
49
|
}
|
|
50
|
+
if (slot.ref !== ref) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
44
53
|
if ((0, _isShallowEqual.default)(slot.fillProps, fillProps)) {
|
|
45
54
|
return;
|
|
46
55
|
}
|
|
@@ -48,7 +57,7 @@ function createSlotRegistry() {
|
|
|
48
57
|
const slotFills = fills.get(name);
|
|
49
58
|
if (slotFills) {
|
|
50
59
|
// Force update fills.
|
|
51
|
-
slotFills.forEach(fill => fill.
|
|
60
|
+
slotFills.forEach(fill => fill.rerender());
|
|
52
61
|
}
|
|
53
62
|
};
|
|
54
63
|
const registerFill = (name, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_compose","_slotFillContext","_jsxRuntime","createSlotRegistry","slots","observableMap","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","isShallowEqual","slotFills","forEach","fill","
|
|
1
|
+
{"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_compose","_slotFillContext","_jsxRuntime","createSlotRegistry","slots","observableMap","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","isShallowEqual","slotFills","forEach","fill","rerender","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","useState","jsx","default","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\n\t\tslots.set( name, {\n\t\t\t...slot,\n\t\t\tref: ref || slot?.ref,\n\t\t\tfillProps: fillProps || slot?.fillProps || {},\n\t\t} );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\tconst slot = slots.get( name );\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot.ref !== ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tslots.delete( name );\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( slot.ref !== ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslot.fillProps = fillProps;\n\t\tconst slotFills = fills.get( name );\n\t\tif ( slotFills ) {\n\t\t\t// Force update fills.\n\t\t\tslotFills.forEach( ( fill ) => fill.rerender() );\n\t\t}\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'unregisterFill' ] =\n\t\t( name, ref ) => {\n\t\t\tconst fillsForName = fills.get( name );\n\t\t\tif ( ! fillsForName ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfills.set(\n\t\t\t\tname,\n\t\t\t\tfillsForName.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -29,7 +29,6 @@ function Slot(props, forwardedRef) {
|
|
|
29
29
|
as,
|
|
30
30
|
// `children` is not allowed. However, if it is passed,
|
|
31
31
|
// it will be displayed as is, so remove `children`.
|
|
32
|
-
// @ts-ignore
|
|
33
32
|
children,
|
|
34
33
|
...restProps
|
|
35
34
|
} = props;
|
|
@@ -39,20 +38,23 @@ function Slot(props, forwardedRef) {
|
|
|
39
38
|
...registry
|
|
40
39
|
} = (0, _element.useContext)(_slotFillContext.default);
|
|
41
40
|
const ref = (0, _element.useRef)(null);
|
|
41
|
+
|
|
42
|
+
// We don't want to unregister and register the slot whenever
|
|
43
|
+
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
44
|
+
// we can just update the slot (see hook below).
|
|
45
|
+
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
46
|
+
const fillPropsRef = (0, _element.useRef)(fillProps);
|
|
47
|
+
(0, _element.useLayoutEffect)(() => {
|
|
48
|
+
fillPropsRef.current = fillProps;
|
|
49
|
+
}, [fillProps]);
|
|
42
50
|
(0, _element.useLayoutEffect)(() => {
|
|
43
|
-
registerSlot(name, ref,
|
|
51
|
+
registerSlot(name, ref, fillPropsRef.current);
|
|
44
52
|
return () => {
|
|
45
53
|
unregisterSlot(name, ref);
|
|
46
54
|
};
|
|
47
|
-
// We don't want to unregister and register the slot whenever
|
|
48
|
-
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
49
|
-
// we can just update the slot (see hook below).
|
|
50
|
-
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
51
55
|
}, [registerSlot, unregisterSlot, name]);
|
|
52
|
-
// fillProps may be an update that interacts with the layout, so we
|
|
53
|
-
// useLayoutEffect.
|
|
54
56
|
(0, _element.useLayoutEffect)(() => {
|
|
55
|
-
registry.updateSlot(name,
|
|
57
|
+
registry.updateSlot(name, ref, fillPropsRef.current);
|
|
56
58
|
});
|
|
57
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_view.View, {
|
|
58
60
|
as: as,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_compose","_view","_slotFillContext","_interopRequireDefault","_jsxRuntime","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","useContext","SlotFillContext","ref","useRef","useLayoutEffect","updateSlot","jsx","View","useMergeRefs","_default","exports","default","forwardRef"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_view","_slotFillContext","_interopRequireDefault","_jsxRuntime","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","useContext","SlotFillContext","ref","useRef","fillPropsRef","useLayoutEffect","current","updateSlot","jsx","View","useMergeRefs","_default","exports","default","forwardRef"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\tchildren,\n\t\t...restProps\n\t} = props;\n\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\n\tconst ref = useRef< HTMLElement >( null );\n\n\t// We don't want to unregister and register the slot whenever\n\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t// we can just update the slot (see hook below).\n\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\tconst fillPropsRef = useRef( fillProps );\n\tuseLayoutEffect( () => {\n\t\tfillPropsRef.current = fillProps;\n\t}, [ fillProps ] );\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillPropsRef.current );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t}, [ registerSlot, unregisterSlot, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, ref, fillPropsRef.current );\n\t} );\n\n\treturn (\n\t\t<View\n\t\t\tas={ as }\n\t\t\tref={ useMergeRefs( [ forwardedRef, ref ] ) }\n\t\t\t{ ...restProps }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAkD,IAAAK,WAAA,GAAAL,OAAA;AApBlD;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAMA,SAASM,IAAIA,CACZC,KAGC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,IAAI;IACJC,SAAS,GAAG,CAAC,CAAC;IACdC,EAAE;IACF;IACA;IACAC,QAAQ;IACR,GAAGC;EACJ,CAAC,GAAGN,KAAK;EAET,MAAM;IAAEO,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClD,IAAAC,mBAAU,EAAEC,wBAAgB,CAAC;EAE9B,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAiB,IAAK,CAAC;;EAEzC;EACA;EACA;EACA;EACA,MAAMC,YAAY,GAAG,IAAAD,eAAM,EAAEV,SAAU,CAAC;EACxC,IAAAY,wBAAe,EAAE,MAAM;IACtBD,YAAY,CAACE,OAAO,GAAGb,SAAS;EACjC,CAAC,EAAE,CAAEA,SAAS,CAAG,CAAC;EAElB,IAAAY,wBAAe,EAAE,MAAM;IACtBR,YAAY,CAAEL,IAAI,EAAEU,GAAG,EAAEE,YAAY,CAACE,OAAQ,CAAC;IAC/C,OAAO,MAAM;MACZR,cAAc,CAAEN,IAAI,EAAEU,GAAI,CAAC;IAC5B,CAAC;EACF,CAAC,EAAE,CAAEL,YAAY,EAAEC,cAAc,EAAEN,IAAI,CAAG,CAAC;EAE3C,IAAAa,wBAAe,EAAE,MAAM;IACtBN,QAAQ,CAACQ,UAAU,CAAEf,IAAI,EAAEU,GAAG,EAAEE,YAAY,CAACE,OAAQ,CAAC;EACvD,CAAE,CAAC;EAEH,oBACC,IAAAlB,WAAA,CAAAoB,GAAA,EAACvB,KAAA,CAAAwB,IAAI;IACJf,EAAE,EAAGA,EAAI;IACTQ,GAAG,EAAG,IAAAQ,qBAAY,EAAE,CAAEnB,YAAY,EAAEW,GAAG,CAAG,CAAG;IAAA,GACxCN;EAAS,CACd,CAAC;AAEJ;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,mBAAU,EAAEzB,IAAK,CAAC","ignoreList":[]}
|
|
@@ -19,15 +19,8 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
|
|
|
19
19
|
function useSlot(name) {
|
|
20
20
|
const registry = (0, _element.useContext)(_slotFillContext.default);
|
|
21
21
|
const slot = (0, _compose.useObservableValue)(registry.slots, name);
|
|
22
|
-
const api = (0, _element.useMemo)(() => ({
|
|
23
|
-
updateSlot: fillProps => registry.updateSlot(name, fillProps),
|
|
24
|
-
unregisterSlot: ref => registry.unregisterSlot(name, ref),
|
|
25
|
-
registerFill: ref => registry.registerFill(name, ref),
|
|
26
|
-
unregisterFill: ref => registry.unregisterFill(name, ref)
|
|
27
|
-
}), [name, registry]);
|
|
28
22
|
return {
|
|
29
|
-
...slot
|
|
30
|
-
...api
|
|
23
|
+
...slot
|
|
31
24
|
};
|
|
32
25
|
}
|
|
33
26
|
//# sourceMappingURL=use-slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_compose","_slotFillContext","_interopRequireDefault","useSlot","name","registry","useContext","SlotFillContext","slot","useObservableValue","slots"
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_slotFillContext","_interopRequireDefault","useSlot","name","registry","useContext","SlotFillContext","slot","useObservableValue","slots"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { useObservableValue } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type { SlotKey } from '../types';\n\nexport default function useSlot( name: SlotKey ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\treturn { ...slot };\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIe,SAASI,OAAOA,CAAEC,IAAa,EAAG;EAChD,MAAMC,QAAQ,GAAG,IAAAC,mBAAU,EAAEC,wBAAgB,CAAC;EAC9C,MAAMC,IAAI,GAAG,IAAAC,2BAAkB,EAAEJ,QAAQ,CAACK,KAAK,EAAEN,IAAK,CAAC;EACvD,OAAO;IAAE,GAAGI;EAAK,CAAC;AACnB","ignoreList":[]}
|
package/build/slot-fill/fill.js
CHANGED
|
@@ -20,10 +20,7 @@ function Fill({
|
|
|
20
20
|
name,
|
|
21
21
|
children
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
registerFill,
|
|
25
|
-
unregisterFill
|
|
26
|
-
} = (0, _element.useContext)(_context.default);
|
|
23
|
+
const registry = (0, _element.useContext)(_context.default);
|
|
27
24
|
const slot = (0, _useSlot.default)(name);
|
|
28
25
|
const ref = (0, _element.useRef)({
|
|
29
26
|
name,
|
|
@@ -31,30 +28,16 @@ function Fill({
|
|
|
31
28
|
});
|
|
32
29
|
(0, _element.useLayoutEffect)(() => {
|
|
33
30
|
const refValue = ref.current;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, []);
|
|
31
|
+
refValue.name = name;
|
|
32
|
+
registry.registerFill(name, refValue);
|
|
33
|
+
return () => registry.unregisterFill(name, refValue);
|
|
34
|
+
}, [registry, name]);
|
|
39
35
|
(0, _element.useLayoutEffect)(() => {
|
|
40
36
|
ref.current.children = children;
|
|
41
37
|
if (slot) {
|
|
42
|
-
slot.
|
|
38
|
+
slot.rerender();
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
46
|
-
}, [children]);
|
|
47
|
-
(0, _element.useLayoutEffect)(() => {
|
|
48
|
-
if (name === ref.current.name) {
|
|
49
|
-
// Ignore initial effect.
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
unregisterFill(ref.current.name, ref.current);
|
|
53
|
-
ref.current.name = name;
|
|
54
|
-
registerFill(name, ref.current);
|
|
55
|
-
// The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
56
|
-
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
57
|
-
}, [name]);
|
|
40
|
+
}, [slot, children]);
|
|
58
41
|
return null;
|
|
59
42
|
}
|
|
60
43
|
//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_useSlot","Fill","name","children","
|
|
1
|
+
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_useSlot","Fill","name","children","registry","useContext","SlotFillContext","slot","useSlot","ref","useRef","useLayoutEffect","refValue","current","registerFill","unregisterFill","rerender"],"sources":["@wordpress/components/src/slot-fill/fill.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\nimport type { FillComponentProps } from './types';\n\nexport default function Fill( { name, children }: FillComponentProps ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tconst refValue = ref.current;\n\t\trefValue.name = name;\n\t\tregistry.registerFill( name, refValue );\n\t\treturn () => registry.unregisterFill( name, refValue );\n\t}, [ registry, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}, [ slot, children ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAKe,SAASI,IAAIA,CAAE;EAAEC,IAAI;EAAEC;AAA6B,CAAC,EAAG;EACtE,MAAMC,QAAQ,GAAG,IAAAC,mBAAU,EAAEC,gBAAgB,CAAC;EAC9C,MAAMC,IAAI,GAAG,IAAAC,gBAAO,EAAEN,IAAK,CAAC;EAE5B,MAAMO,GAAG,GAAG,IAAAC,eAAM,EAAE;IACnBR,IAAI;IACJC;EACD,CAAE,CAAC;EAEH,IAAAQ,wBAAe,EAAE,MAAM;IACtB,MAAMC,QAAQ,GAAGH,GAAG,CAACI,OAAO;IAC5BD,QAAQ,CAACV,IAAI,GAAGA,IAAI;IACpBE,QAAQ,CAACU,YAAY,CAAEZ,IAAI,EAAEU,QAAS,CAAC;IACvC,OAAO,MAAMR,QAAQ,CAACW,cAAc,CAAEb,IAAI,EAAEU,QAAS,CAAC;EACvD,CAAC,EAAE,CAAER,QAAQ,EAAEF,IAAI,CAAG,CAAC;EAEvB,IAAAS,wBAAe,EAAE,MAAM;IACtBF,GAAG,CAACI,OAAO,CAACV,QAAQ,GAAGA,QAAQ;IAC/B,IAAKI,IAAI,EAAG;MACXA,IAAI,CAACS,QAAQ,CAAC,CAAC;IAChB;EACD,CAAC,EAAE,CAAET,IAAI,EAAEJ,QAAQ,CAAG,CAAC;EAEvB,OAAO,IAAI;AACZ","ignoreList":[]}
|
package/build/slot-fill/index.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.Fill = Fill;
|
|
|
8
8
|
exports.Provider = Provider;
|
|
9
9
|
exports.Slot = void 0;
|
|
10
10
|
exports.UnforwardedSlot = UnforwardedSlot;
|
|
11
|
-
exports.createPrivateSlotFill = void 0;
|
|
12
11
|
exports.createSlotFill = createSlotFill;
|
|
13
12
|
Object.defineProperty(exports, "useSlot", {
|
|
14
13
|
enumerable: true,
|
|
@@ -102,19 +101,15 @@ function createSlotFill(key) {
|
|
|
102
101
|
...props
|
|
103
102
|
});
|
|
104
103
|
SlotComponent.displayName = `${baseName}Slot`;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated 6.8.0
|
|
106
|
+
* Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.
|
|
107
|
+
*/
|
|
105
108
|
SlotComponent.__unstableName = key;
|
|
106
109
|
return {
|
|
110
|
+
name: key,
|
|
107
111
|
Fill: FillComponent,
|
|
108
112
|
Slot: SlotComponent
|
|
109
113
|
};
|
|
110
114
|
}
|
|
111
|
-
const createPrivateSlotFill = name => {
|
|
112
|
-
const privateKey = Symbol(name);
|
|
113
|
-
const privateSlotFill = createSlotFill(privateKey);
|
|
114
|
-
return {
|
|
115
|
-
privateKey,
|
|
116
|
-
...privateSlotFill
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
exports.createPrivateSlotFill = createPrivateSlotFill;
|
|
120
115
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_fill","_interopRequireDefault","_slot","_fill2","_slot2","_slotFillProvider","_provider","_slotFillContext","_jsxRuntime","_useSlot","_useSlotFills","Fill","props","jsxs","Fragment","children","jsx","default","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","exports","forwardRef","Provider","passthrough","parent","useContext","SlotFillContext","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName"
|
|
1
|
+
{"version":3,"names":["_element","require","_fill","_interopRequireDefault","_slot","_fill2","_slot2","_slotFillProvider","_provider","_slotFillContext","_jsxRuntime","_useSlot","_useSlotFills","Fill","props","jsxs","Fragment","children","jsx","default","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","exports","forwardRef","Provider","passthrough","parent","useContext","SlotFillContext","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName"],"sources":["@wordpress/components/src/slot-fill/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport SlotFillContext from './bubbles-virtually/slot-fill-context';\nimport type { WordPressComponentProps } from '../context';\n\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\nimport type {\n\tDistributiveOmit,\n\tFillComponentProps,\n\tSlotComponentProps,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\n\nexport function Fill( props: FillComponentProps ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\n\nexport function UnforwardedSlot(\n\tprops: SlotComponentProps &\n\t\tOmit< WordPressComponentProps< {}, 'div' >, 'className' >,\n\tref: ForwardedRef< any >\n) {\n\tconst { bubblesVirtually, ...restProps } = props;\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...restProps } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...restProps } />;\n}\nexport const Slot = forwardRef( UnforwardedSlot );\n\nexport function Provider( {\n\tchildren,\n\tpassthrough = false,\n}: SlotFillProviderProps ) {\n\tconst parent = useContext( SlotFillContext );\n\tif ( ! parent.isDefault && passthrough ) {\n\t\treturn <>{ children }</>;\n\t}\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\nProvider.displayName = 'SlotFillProvider';\n\nexport function createSlotFill( key: SlotKey ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props: Omit< FillComponentProps, 'name' > ) => (\n\t\t<Fill name={ key } { ...props } />\n\t);\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = (\n\t\tprops: DistributiveOmit< SlotComponentProps, 'name' >\n\t) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\t/**\n\t * @deprecated 6.8.0\n\t * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.\n\t */\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tname: key,\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -35,7 +35,7 @@ function createSlotRegistry() {
|
|
|
35
35
|
// assigned into the instance, such that its own rendering of children
|
|
36
36
|
// will be empty (the new Slot will subsume all fills for this name).
|
|
37
37
|
if (previousSlot) {
|
|
38
|
-
previousSlot.
|
|
38
|
+
previousSlot.rerender();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function registerFill(name, instance) {
|
|
@@ -71,7 +71,7 @@ function createSlotRegistry() {
|
|
|
71
71
|
function forceUpdateSlot(name) {
|
|
72
72
|
const slot = getSlot(name);
|
|
73
73
|
if (slot) {
|
|
74
|
-
slot.
|
|
74
|
+
slot.rerender();
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
function triggerListeners() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_jsxRuntime","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","
|
|
1
|
+
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_jsxRuntime","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","rerender","registerFill","instance","unregisterSlot","unregisterFill","_fills$name$filter","filter","fill","getSlot","getFills","slotInstance","forEach","listener","subscribe","push","l","SlotFillProvider","children","contextValue","useState","jsx","default","Provider","value","_default","exports"],"sources":["@wordpress/components/src/slot-fill/provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type {\n\tFillComponentProps,\n\tBaseSlotFillContext,\n\tSlotFillProviderProps,\n\tSlotKey,\n\tRerenderable,\n} from './types';\n\nfunction createSlotRegistry(): BaseSlotFillContext {\n\tconst slots: Record< SlotKey, Rerenderable > = {};\n\tconst fills: Record< SlotKey, FillComponentProps[] > = {};\n\tlet listeners: Array< () => void > = [];\n\n\tfunction registerSlot( name: SlotKey, slot: Rerenderable ) {\n\t\tconst previousSlot = slots[ name ];\n\t\tslots[ name ] = slot;\n\t\ttriggerListeners();\n\n\t\t// Sometimes the fills are registered after the initial render of slot\n\t\t// But before the registerSlot call, we need to rerender the slot.\n\t\tforceUpdateSlot( name );\n\n\t\t// If a new instance of a slot is being mounted while another with the\n\t\t// same name exists, force its update _after_ the new slot has been\n\t\t// assigned into the instance, such that its own rendering of children\n\t\t// will be empty (the new Slot will subsume all fills for this name).\n\t\tif ( previousSlot ) {\n\t\t\tpreviousSlot.rerender();\n\t\t}\n\t}\n\n\tfunction registerFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] = [ ...( fills[ name ] || [] ), instance ];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction unregisterSlot( name: SlotKey, instance: Rerenderable ) {\n\t\t// If a previous instance of a Slot by this name unmounts, do nothing,\n\t\t// as the slot and its fills should only be removed for the current\n\t\t// known instance.\n\t\tif ( slots[ name ] !== instance ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdelete slots[ name ];\n\t\ttriggerListeners();\n\t}\n\n\tfunction unregisterFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] =\n\t\t\tfills[ name ]?.filter( ( fill ) => fill !== instance ) ?? [];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction getSlot( name: SlotKey ): Rerenderable | undefined {\n\t\treturn slots[ name ];\n\t}\n\n\tfunction getFills(\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t): FillComponentProps[] {\n\t\t// Fills should only be returned for the current instance of the slot\n\t\t// in which they occupy.\n\t\tif ( slots[ name ] !== slotInstance ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn fills[ name ];\n\t}\n\n\tfunction forceUpdateSlot( name: SlotKey ) {\n\t\tconst slot = getSlot( name );\n\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}\n\n\tfunction triggerListeners() {\n\t\tlisteners.forEach( ( listener ) => listener() );\n\t}\n\n\tfunction subscribe( listener: () => void ) {\n\t\tlisteners.push( listener );\n\n\t\treturn () => {\n\t\t\tlisteners = listeners.filter( ( l ) => l !== listener );\n\t\t};\n\t}\n\n\treturn {\n\t\tregisterSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t\tgetSlot,\n\t\tgetFills,\n\t\tsubscribe,\n\t};\n}\n\nexport function SlotFillProvider( { children }: SlotFillProviderProps ) {\n\tconst [ contextValue ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n\nexport default SlotFillProvider;\n"],"mappings":"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","ignoreList":[]}
|
package/build/slot-fill/slot.js
CHANGED
|
@@ -29,85 +29,45 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
29
29
|
function isFunction(maybeFunc) {
|
|
30
30
|
return typeof maybeFunc === 'function';
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
forceUpdate() {
|
|
63
|
-
if (this.isUnmounted) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
super.forceUpdate();
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
var _getFills;
|
|
70
|
-
const {
|
|
71
|
-
children,
|
|
72
|
-
name,
|
|
73
|
-
fillProps = {},
|
|
74
|
-
getFills
|
|
75
|
-
} = this.props;
|
|
76
|
-
const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
|
|
77
|
-
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
78
|
-
return _element.Children.map(fillChildren, (child, childIndex) => {
|
|
79
|
-
if (!child || typeof child === 'string') {
|
|
80
|
-
return child;
|
|
81
|
-
}
|
|
82
|
-
let childKey = childIndex;
|
|
83
|
-
if (typeof child === 'object' && 'key' in child && child?.key) {
|
|
84
|
-
childKey = child.key;
|
|
85
|
-
}
|
|
86
|
-
return (0, _element.cloneElement)(child, {
|
|
87
|
-
key: childKey
|
|
88
|
-
});
|
|
32
|
+
function Slot(props) {
|
|
33
|
+
var _registry$getFills;
|
|
34
|
+
const registry = (0, _element.useContext)(_context.default);
|
|
35
|
+
const [, rerender] = (0, _element.useReducer)(() => [], []);
|
|
36
|
+
const ref = (0, _element.useRef)({
|
|
37
|
+
rerender
|
|
38
|
+
});
|
|
39
|
+
const {
|
|
40
|
+
name,
|
|
41
|
+
children,
|
|
42
|
+
fillProps = {}
|
|
43
|
+
} = props;
|
|
44
|
+
(0, _element.useEffect)(() => {
|
|
45
|
+
const refValue = ref.current;
|
|
46
|
+
registry.registerSlot(name, refValue);
|
|
47
|
+
return () => registry.unregisterSlot(name, refValue);
|
|
48
|
+
}, [registry, name]);
|
|
49
|
+
const fills = ((_registry$getFills = registry.getFills(name, ref.current)) !== null && _registry$getFills !== void 0 ? _registry$getFills : []).map(fill => {
|
|
50
|
+
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
51
|
+
return _element.Children.map(fillChildren, (child, childIndex) => {
|
|
52
|
+
if (!child || typeof child === 'string') {
|
|
53
|
+
return child;
|
|
54
|
+
}
|
|
55
|
+
let childKey = childIndex;
|
|
56
|
+
if (typeof child === 'object' && 'key' in child && child?.key) {
|
|
57
|
+
childKey = child.key;
|
|
58
|
+
}
|
|
59
|
+
return (0, _element.cloneElement)(child, {
|
|
60
|
+
key: childKey
|
|
89
61
|
});
|
|
90
|
-
}).filter(
|
|
91
|
-
// In some cases fills are rendered only when some conditions apply.
|
|
92
|
-
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
93
|
-
// it allows us to render wrappers only when the fills are actually present.
|
|
94
|
-
element => !(0, _element.isEmptyElement)(element));
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
96
|
-
children: isFunction(children) ? children(fills) : fills
|
|
97
62
|
});
|
|
98
|
-
}
|
|
63
|
+
}).filter(
|
|
64
|
+
// In some cases fills are rendered only when some conditions apply.
|
|
65
|
+
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
66
|
+
// it allows us to render wrappers only when the fills are actually present.
|
|
67
|
+
element => !(0, _element.isEmptyElement)(element));
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
69
|
+
children: isFunction(children) ? children(fills) : fills
|
|
70
|
+
});
|
|
99
71
|
}
|
|
100
|
-
const Slot = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.default.Consumer, {
|
|
101
|
-
children: ({
|
|
102
|
-
registerSlot,
|
|
103
|
-
unregisterSlot,
|
|
104
|
-
getFills
|
|
105
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(SlotComponent, {
|
|
106
|
-
...props,
|
|
107
|
-
registerSlot: registerSlot,
|
|
108
|
-
unregisterSlot: unregisterSlot,
|
|
109
|
-
getFills: getFills
|
|
110
|
-
})
|
|
111
|
-
});
|
|
112
72
|
var _default = exports.default = Slot;
|
|
113
73
|
//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_jsxRuntime","isFunction","maybeFunc","
|
|
1
|
+
{"version":3,"names":["_element","require","_context","_interopRequireDefault","_jsxRuntime","isFunction","maybeFunc","Slot","props","_registry$getFills","registry","useContext","SlotFillContext","rerender","useReducer","ref","useRef","name","children","fillProps","useEffect","refValue","current","registerSlot","unregisterSlot","fills","getFills","map","fill","fillChildren","Children","child","childIndex","childKey","key","cloneElement","filter","element","isEmptyElement","jsx","Fragment","_default","exports","default"],"sources":["@wordpress/components/src/slot-fill/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ReactNode, Key } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseReducer,\n\tuseRef,\n\tChildren,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { SlotComponentProps } from './types';\n\n/**\n * Whether the argument is a function.\n *\n * @param maybeFunc The argument to check.\n * @return True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc: any ): maybeFunc is Function {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction Slot( props: Omit< SlotComponentProps, 'bubblesVirtually' > ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst [ , rerender ] = useReducer( () => [], [] );\n\tconst ref = useRef( { rerender } );\n\n\tconst { name, children, fillProps = {} } = props;\n\n\tuseEffect( () => {\n\t\tconst refValue = ref.current;\n\t\tregistry.registerSlot( name, refValue );\n\t\treturn () => registry.unregisterSlot( name, refValue );\n\t}, [ registry, name ] );\n\n\tconst fills: ReactNode[] = ( registry.getFills( name, ref.current ) ?? [] )\n\t\t.map( ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\tif ( ! child || typeof child === 'string' ) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t\tlet childKey: Key = childIndex;\n\t\t\t\tif (\n\t\t\t\t\ttypeof child === 'object' &&\n\t\t\t\t\t'key' in child &&\n\t\t\t\t\tchild?.key\n\t\t\t\t) {\n\t\t\t\t\tchildKey = child.key;\n\t\t\t\t}\n\n\t\t\t\treturn cloneElement( child as ReactElement, {\n\t\t\t\t\tkey: childKey,\n\t\t\t\t} );\n\t\t\t} );\n\t\t} )\n\t\t.filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t( element ) => ! isEmptyElement( element )\n\t\t);\n\n\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n}\n\nexport default Slot;\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAaA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAwC,IAAAG,WAAA,GAAAH,OAAA;AArBxC;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,UAAUA,CAAEC,SAAc,EAA0B;EAC5D,OAAO,OAAOA,SAAS,KAAK,UAAU;AACvC;AAEA,SAASC,IAAIA,CAAEC,KAAqD,EAAG;EAAA,IAAAC,kBAAA;EACtE,MAAMC,QAAQ,GAAG,IAAAC,mBAAU,EAAEC,gBAAgB,CAAC;EAC9C,MAAM,GAAIC,QAAQ,CAAE,GAAG,IAAAC,mBAAU,EAAE,MAAM,EAAE,EAAE,EAAG,CAAC;EACjD,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAE;IAAEH;EAAS,CAAE,CAAC;EAElC,MAAM;IAAEI,IAAI;IAAEC,QAAQ;IAAEC,SAAS,GAAG,CAAC;EAAE,CAAC,GAAGX,KAAK;EAEhD,IAAAY,kBAAS,EAAE,MAAM;IAChB,MAAMC,QAAQ,GAAGN,GAAG,CAACO,OAAO;IAC5BZ,QAAQ,CAACa,YAAY,CAAEN,IAAI,EAAEI,QAAS,CAAC;IACvC,OAAO,MAAMX,QAAQ,CAACc,cAAc,CAAEP,IAAI,EAAEI,QAAS,CAAC;EACvD,CAAC,EAAE,CAAEX,QAAQ,EAAEO,IAAI,CAAG,CAAC;EAEvB,MAAMQ,KAAkB,GAAG,EAAAhB,kBAAA,GAAEC,QAAQ,CAACgB,QAAQ,CAAET,IAAI,EAAEF,GAAG,CAACO,OAAQ,CAAC,cAAAb,kBAAA,cAAAA,kBAAA,GAAI,EAAE,EACvEkB,GAAG,CAAIC,IAAI,IAAM;IACjB,MAAMC,YAAY,GAAGxB,UAAU,CAAEuB,IAAI,CAACV,QAAS,CAAC,GAC7CU,IAAI,CAACV,QAAQ,CAAEC,SAAU,CAAC,GAC1BS,IAAI,CAACV,QAAQ;IAChB,OAAOY,iBAAQ,CAACH,GAAG,CAAEE,YAAY,EAAE,CAAEE,KAAK,EAAEC,UAAU,KAAM;MAC3D,IAAK,CAAED,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAG;QAC3C,OAAOA,KAAK;MACb;MACA,IAAIE,QAAa,GAAGD,UAAU;MAC9B,IACC,OAAOD,KAAK,KAAK,QAAQ,IACzB,KAAK,IAAIA,KAAK,IACdA,KAAK,EAAEG,GAAG,EACT;QACDD,QAAQ,GAAGF,KAAK,CAACG,GAAG;MACrB;MAEA,OAAO,IAAAC,qBAAY,EAAEJ,KAAK,EAAkB;QAC3CG,GAAG,EAAED;MACN,CAAE,CAAC;IACJ,CAAE,CAAC;EACJ,CAAE,CAAC,CACFG,MAAM;EACN;EACA;EACA;EACEC,OAAO,IAAM,CAAE,IAAAC,uBAAc,EAAED,OAAQ,CAC1C,CAAC;EAEF,oBAAO,IAAAjC,WAAA,CAAAmC,GAAA,EAAAnC,WAAA,CAAAoC,QAAA;IAAAtB,QAAA,EAAIb,UAAU,CAAEa,QAAS,CAAC,GAAGA,QAAQ,CAAEO,KAAM,CAAC,GAAGA;EAAK,CAAI,CAAC;AACnE;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcpC,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type { ObservableMap } from '@wordpress/compose';\n\nexport type DistributiveOmit< T, K extends keyof any > = T extends any\n\t? Omit< T, K >\n\t: never;\n\nexport type SlotKey = string | symbol;\n\nexport type FillProps = Record< string, any >;\n\ntype SlotPropBase = {\n\t/**\n\t * Slot name.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * props to pass from `Slot` to `Fill`.\n\t *\n\t * @default {}\n\t */\n\tfillProps?: FillProps;\n};\n\nexport type SlotComponentProps =\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually: true;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: never;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: string;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: React.CSSProperties;\n\t } )\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually?: false;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: ( fills: ReactNode ) => ReactNode;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: never;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: never;\n\t } );\n\nexport type FillComponentProps = {\n\t/**\n\t * The name of the slot to fill into.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * Children elements or render function.\n\t */\n\tchildren?: ReactNode | ( ( fillProps: FillProps ) => ReactNode );\n};\n\nexport type SlotFillProviderProps = {\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n\n\t/**\n\t * Whether to pass slots to the parent provider if existent.\n\t */\n\tpassthrough?: boolean;\n};\n\nexport type SlotRef = RefObject< HTMLElement >;\nexport type Rerenderable = { rerender: () => void };\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap< SlotKey, { ref: SlotRef; fillProps: FillProps } >;\n\tfills: ObservableMap< SlotKey, Rerenderable[] >;\n\tregisterSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tunregisterSlot: ( name: SlotKey, ref: SlotRef ) => void;\n\tupdateSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tregisterFill: ( name: SlotKey, ref: Rerenderable ) => void;\n\tunregisterFill: ( name: SlotKey, ref: Rerenderable ) => void;\n\n\t/**\n\t * This helps the provider know if it's using the default context value or not.\n\t */\n\tisDefault?: boolean;\n};\n\nexport type BaseSlotFillContext = {\n\tregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tunregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tgetSlot: ( name: SlotKey ) => Rerenderable | undefined;\n\tgetFills: (\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t) => FillComponentProps[];\n\tsubscribe: ( listener: () => void ) => () => void;\n};\n"],"mappings":"","ignoreList":[]}
|
package/build/snackbar/index.js
CHANGED
|
@@ -129,8 +129,9 @@ function UnforwardedSnackbar({
|
|
|
129
129
|
url
|
|
130
130
|
}, index) => {
|
|
131
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
|
|
132
|
+
__next40pxDefaultSize: true,
|
|
132
133
|
href: url,
|
|
133
|
-
variant: "
|
|
134
|
+
variant: "link",
|
|
134
135
|
onClick: event => onActionClick(event, onClick),
|
|
135
136
|
className: "components-snackbar__action",
|
|
136
137
|
children: label
|