@wordpress/components 27.4.0 → 27.5.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 +27 -1
- package/build/alignment-matrix-control/index.js +3 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -8
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/alignment-matrix-control/utils.js +6 -2
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +3 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +21 -7
- package/build/autocomplete/index.js.map +1 -1
- package/build/checkbox-control/index.js +9 -2
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-picker/hex-input.js +3 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hue-picker.native.js +6 -2
- package/build/color-picker/hue-picker.native.js.map +1 -1
- package/build/color-picker/index.native.js +9 -3
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/saturation-picker.native.js +6 -2
- package/build/color-picker/saturation-picker.native.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js +9 -3
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/context/context-connect.js +6 -2
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-select-control-v2/legacy-component/index.js +3 -1
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build/drop-zone/index.js +72 -64
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/styles.js +5 -3
- package/build/dropdown/styles.js.map +1 -1
- package/build/duotone-picker/utils.js +3 -1
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/elevation/hook.js +5 -6
- package/build/elevation/hook.js.map +1 -1
- package/build/focal-point-picker/controls.js +3 -1
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js +21 -7
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +12 -12
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +3 -8
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/focal-point-picker/utils.js +3 -1
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/font-size-picker/index.js +3 -2
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/types.js.map +1 -1
- package/build/input-control/input-field.js +3 -1
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/label.js +3 -1
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +31 -23
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/utils.js +8 -4
- package/build/input-control/utils.js.map +1 -1
- package/build/item-group/item/hook.js +0 -4
- package/build/item-group/item/hook.js.map +1 -1
- package/build/mobile/gradient/index.native.js +3 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +9 -3
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +15 -13
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/shared.native.js +33 -0
- package/build/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
- package/build/modal/aria-helper.js +9 -3
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +6 -2
- package/build/modal/index.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +12 -12
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/panel/body.js +3 -1
- package/build/panel/body.js.map +1 -1
- package/build/popover/index.js +3 -1
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js +3 -1
- package/build/popover/overlay-middlewares.js.map +1 -1
- package/build/query-controls/author-select.js +3 -1
- package/build/query-controls/author-select.js.map +1 -1
- package/build/range-control/rail.js +1 -1
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +29 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +3 -1
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js +3 -1
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +12 -4
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/select-control/index.js +3 -1
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +8 -6
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -3
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +3 -3
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js +2 -2
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +2 -2
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/text/get-line-height.js +6 -2
- package/build/text/get-line-height.js.map +1 -1
- package/build/text/utils.js +6 -2
- package/build/text/utils.js.map +1 -1
- package/build/theme/color-algorithms.js +6 -2
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js +3 -1
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/unit-control/index.js +3 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/colors.js +21 -7
- package/build/utils/colors.js.map +1 -1
- package/build/utils/font-size.js +3 -1
- package/build/utils/font-size.js.map +1 -1
- package/build/utils/get-valid-children.js +3 -1
- package/build/utils/get-valid-children.js.map +1 -1
- package/build/utils/input/base.js +2 -3
- package/build/utils/input/base.js.map +1 -1
- package/build/utils/strings.js +11 -57
- package/build/utils/strings.js.map +1 -1
- package/build/utils/use-responsive-value.js +3 -1
- package/build/utils/use-responsive-value.js.map +1 -1
- package/build/view/component.js +26 -8
- package/build/view/component.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +3 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +6 -2
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +3 -1
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +21 -7
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/checkbox-control/index.js +9 -2
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-picker/hex-input.js +3 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hue-picker.native.js +6 -2
- package/build-module/color-picker/hue-picker.native.js.map +1 -1
- package/build-module/color-picker/index.native.js +9 -3
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/saturation-picker.native.js +6 -2
- package/build-module/color-picker/saturation-picker.native.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js +9 -3
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/context/context-connect.js +6 -2
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js +3 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build-module/drop-zone/index.js +72 -64
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/styles.js +5 -3
- package/build-module/dropdown/styles.js.map +1 -1
- package/build-module/duotone-picker/utils.js +3 -1
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/elevation/hook.js +6 -7
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +3 -1
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js +21 -7
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +13 -13
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +3 -8
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +3 -1
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/font-size-picker/index.js +3 -2
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/types.js.map +1 -1
- package/build-module/input-control/input-field.js +3 -1
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/label.js +3 -1
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +31 -23
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/utils.js +8 -4
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/item-group/item/hook.js +0 -4
- package/build-module/item-group/item/hook.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +3 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +9 -3
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +16 -15
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/shared.native.js +27 -0
- package/build-module/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
- package/build-module/modal/aria-helper.js +9 -3
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +6 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +13 -13
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/panel/body.js +3 -1
- package/build-module/panel/body.js.map +1 -1
- package/build-module/popover/index.js +3 -1
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js +3 -1
- package/build-module/popover/overlay-middlewares.js.map +1 -1
- package/build-module/query-controls/author-select.js +3 -1
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/range-control/rail.js +1 -1
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +30 -30
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +3 -1
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js +3 -1
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +12 -4
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/select-control/index.js +3 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +8 -6
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +2 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/text/get-line-height.js +6 -2
- package/build-module/text/get-line-height.js.map +1 -1
- package/build-module/text/utils.js +6 -2
- package/build-module/text/utils.js.map +1 -1
- package/build-module/theme/color-algorithms.js +6 -2
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +10 -10
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +3 -1
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/unit-control/index.js +3 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/colors.js +21 -7
- package/build-module/utils/colors.js.map +1 -1
- package/build-module/utils/font-size.js +3 -1
- package/build-module/utils/font-size.js.map +1 -1
- package/build-module/utils/get-valid-children.js +3 -1
- package/build-module/utils/get-valid-children.js.map +1 -1
- package/build-module/utils/input/base.js +2 -3
- package/build-module/utils/input/base.js.map +1 -1
- package/build-module/utils/strings.js +12 -57
- package/build-module/utils/strings.js.map +1 -1
- package/build-module/utils/use-responsive-value.js +3 -1
- package/build-module/utils/use-responsive-value.js.map +1 -1
- package/build-module/view/component.js +26 -8
- package/build-module/view/component.js.map +1 -1
- package/build-style/style-rtl.css +39 -36
- package/build-style/style.css +39 -36
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +4 -4
- package/build-types/border-control/border-control/hook.d.ts +4 -4
- package/build-types/border-control/border-control-dropdown/hook.d.ts +4 -4
- package/build-types/box-control/stories/index.story.d.ts +24 -24
- package/build-types/card/card/hook.d.ts +4 -4
- package/build-types/card/card-body/hook.d.ts +4 -4
- package/build-types/card/card-divider/hook.d.ts +4 -4
- package/build-types/card/card-footer/hook.d.ts +4 -4
- package/build-types/card/card-header/hook.d.ts +4 -4
- package/build-types/card/card-media/hook.d.ts +4 -4
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/context/context-connect.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
- package/build-types/drop-zone/index.d.ts.map +1 -1
- package/build-types/dropdown/styles.d.ts.map +1 -1
- package/build-types/duotone-picker/utils.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +4 -4
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +4 -4
- package/build-types/flex/flex-block/hook.d.ts +4 -4
- package/build-types/flex/flex-item/hook.d.ts +4 -4
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
- package/build-types/focal-point-picker/utils.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/font-size-picker/types.d.ts +2 -0
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +4 -4
- package/build-types/h-stack/hook.d.ts +4 -4
- package/build-types/heading/hook.d.ts +4 -4
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/label.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +2 -1
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/utils.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +5 -5
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +4 -4
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +4 -4
- package/build-types/navigator/navigator-button/hook.d.ts +4 -4
- package/build-types/palette-edit/styles.d.ts +749 -10
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/body.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +4 -4
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.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/use-slot-fills.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +2 -2
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +4 -4
- package/build-types/surface/hook.d.ts +4 -4
- package/build-types/text/get-line-height.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +4 -4
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/theme/color-algorithms.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +4 -4
- package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +4 -4
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/utils/colors.d.ts.map +1 -1
- package/build-types/utils/font-size.d.ts.map +1 -1
- package/build-types/utils/get-valid-children.d.ts.map +1 -1
- package/build-types/utils/input/base.d.ts.map +1 -1
- package/build-types/utils/strings.d.ts.map +1 -1
- package/build-types/utils/use-responsive-value.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +4 -4
- package/build-types/view/component.d.ts +253 -7
- package/build-types/view/component.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/index.tsx +3 -1
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +4 -3
- package/src/alignment-matrix-control/utils.tsx +6 -2
- package/src/autocomplete/autocompleter-ui.tsx +3 -1
- package/src/autocomplete/index.tsx +21 -7
- package/src/autocomplete/style.scss +10 -4
- package/src/box-control/test/index.tsx +22 -0
- package/src/card/test/__snapshots__/index.tsx.snap +44 -47
- package/src/checkbox-control/index.tsx +44 -35
- package/src/checkbox-control/style.scss +12 -1
- package/src/checkbox-control/test/__snapshots__/index.tsx.snap +27 -26
- package/src/checkbox-control/test/index.tsx +5 -0
- package/src/color-picker/hex-input.tsx +3 -1
- package/src/color-picker/hue-picker.native.js +6 -2
- package/src/color-picker/index.native.js +9 -3
- package/src/color-picker/saturation-picker.native.js +6 -2
- package/src/color-picker/use-deprecated-props.ts +9 -3
- package/src/context/context-connect.ts +6 -2
- package/src/custom-select-control-v2/README.md +0 -4
- package/src/custom-select-control-v2/legacy-component/index.tsx +3 -1
- package/src/custom-select-control-v2/stories/default.story.tsx +1 -1
- package/src/custom-select-control-v2/stories/legacy.story.tsx +1 -1
- package/src/drop-zone/index.tsx +66 -66
- package/src/dropdown/styles.ts +3 -1
- package/src/duotone-picker/utils.ts +3 -1
- package/src/elevation/hook.ts +6 -3
- package/src/elevation/test/__snapshots__/index.tsx.snap +18 -24
- package/src/flex/test/__snapshots__/index.tsx.snap +4 -4
- package/src/focal-point-picker/controls.tsx +3 -1
- package/src/focal-point-picker/index.tsx +20 -7
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +4 -3
- package/src/focal-point-picker/tooltip/index.native.js +1 -7
- package/src/focal-point-picker/utils.ts +3 -1
- package/src/font-size-picker/README.md +1 -0
- package/src/font-size-picker/index.tsx +4 -2
- package/src/font-size-picker/stories/index.story.tsx +0 -1
- package/src/font-size-picker/types.ts +2 -0
- package/src/higher-order/navigate-regions/style.scss +3 -3
- package/src/input-control/input-field.tsx +3 -1
- package/src/input-control/label.tsx +3 -1
- package/src/input-control/stories/index.story.tsx +31 -1
- package/src/input-control/styles/input-control-styles.tsx +12 -4
- package/src/input-control/test/index.js +8 -4
- package/src/input-control/utils.ts +3 -2
- package/src/item-group/item/hook.ts +1 -10
- package/src/item-group/test/__snapshots__/index.js.snap +16 -16
- package/src/mobile/gradient/index.native.js +3 -1
- package/src/mobile/keyboard-aware-flat-list/index.android.js +11 -2
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +30 -19
- package/src/mobile/keyboard-aware-flat-list/shared.native.js +26 -0
- package/src/mobile/keyboard-aware-flat-list/styles.native.scss +8 -0
- package/src/modal/aria-helper.ts +8 -3
- package/src/modal/index.tsx +6 -2
- package/src/modal/test/index.tsx +11 -4
- package/src/navigation/styles/navigation-styles.tsx +4 -3
- package/src/panel/body.tsx +3 -1
- package/src/panel/style.scss +1 -0
- package/src/placeholder/style.scss +12 -34
- package/src/popover/index.tsx +2 -1
- package/src/popover/overlay-middlewares.tsx +3 -1
- package/src/popover/stories/index.story.tsx +0 -2
- package/src/query-controls/author-select.tsx +3 -1
- package/src/range-control/rail.tsx +1 -1
- package/src/range-control/styles/range-control-styles.ts +5 -3
- package/src/resizable-box/resize-tooltip/index.tsx +3 -1
- package/src/resizable-box/resize-tooltip/label.tsx +3 -1
- package/src/resizable-box/resize-tooltip/utils.ts +12 -4
- package/src/select-control/index.tsx +3 -1
- package/src/select-control/styles/select-control-styles.ts +3 -1
- package/src/slot-fill/bubbles-virtually/slot-fill-context.ts +2 -1
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +1 -1
- package/src/slot-fill/bubbles-virtually/use-slot-fills.ts +1 -1
- package/src/slot-fill/bubbles-virtually/use-slot.ts +1 -1
- package/src/slot-fill/types.ts +2 -2
- package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
- package/src/text/get-line-height.ts +6 -2
- package/src/text/utils.ts +6 -2
- package/src/theme/color-algorithms.ts +6 -2
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -24
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +7 -6
- package/src/toolbar/toolbar/style.scss +2 -2
- package/src/tree-grid/roving-tab-index-item.tsx +3 -1
- package/src/unit-control/index.tsx +5 -1
- package/src/utils/colors.js +21 -7
- package/src/utils/font-size.ts +3 -1
- package/src/utils/get-valid-children.ts +3 -1
- package/src/utils/input/base.js +4 -3
- package/src/utils/strings.ts +11 -59
- package/src/utils/test/strings.js +62 -0
- package/src/utils/use-responsive-value.ts +2 -1
- package/src/view/component.tsx +18 -11
- package/tsconfig.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/slot-fill/bubbles-virtually/observable-map.js +0 -68
- package/build/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
- package/build/view/types.js +0 -6
- package/build/view/types.js.map +0 -1
- package/build-module/slot-fill/bubbles-virtually/observable-map.js +0 -60
- package/build-module/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
- package/build-module/view/types.js +0 -2
- package/build-module/view/types.js.map +0 -1
- package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts +0 -19
- package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts.map +0 -1
- package/build-types/view/types.d.ts +0 -8
- package/build-types/view/types.d.ts.map +0 -1
- package/src/slot-fill/bubbles-virtually/observable-map.ts +0 -79
- package/src/slot-fill/test/observable-map.js +0 -83
- package/src/utils/hooks/stories/use-cx.js +0 -157
- package/src/view/types.ts +0 -6
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.observableMap = observableMap;
|
|
7
|
-
exports.useObservableValue = useObservableValue;
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
/**
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A key/value map where the individual entries are observable by subscribing to them
|
|
15
|
-
* with the `subscribe` methods.
|
|
16
|
-
*/
|
|
17
|
-
function observableMap() {
|
|
18
|
-
const map = new Map();
|
|
19
|
-
const listeners = new Map();
|
|
20
|
-
function callListeners(name) {
|
|
21
|
-
const list = listeners.get(name);
|
|
22
|
-
if (!list) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
for (const listener of list) {
|
|
26
|
-
listener();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
get(name) {
|
|
31
|
-
return map.get(name);
|
|
32
|
-
},
|
|
33
|
-
set(name, value) {
|
|
34
|
-
map.set(name, value);
|
|
35
|
-
callListeners(name);
|
|
36
|
-
},
|
|
37
|
-
delete(name) {
|
|
38
|
-
map.delete(name);
|
|
39
|
-
callListeners(name);
|
|
40
|
-
},
|
|
41
|
-
subscribe(name, listener) {
|
|
42
|
-
let list = listeners.get(name);
|
|
43
|
-
if (!list) {
|
|
44
|
-
list = new Set();
|
|
45
|
-
listeners.set(name, list);
|
|
46
|
-
}
|
|
47
|
-
list.add(listener);
|
|
48
|
-
return () => {
|
|
49
|
-
list.delete(listener);
|
|
50
|
-
if (list.size === 0) {
|
|
51
|
-
listeners.delete(name);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* React hook that lets you observe an individual entry in an `ObservableMap`.
|
|
60
|
-
*
|
|
61
|
-
* @param map The `ObservableMap` to observe.
|
|
62
|
-
* @param name The map key to observe.
|
|
63
|
-
*/
|
|
64
|
-
function useObservableValue(map, name) {
|
|
65
|
-
const [subscribe, getValue] = (0, _element.useMemo)(() => [listener => map.subscribe(name, listener), () => map.get(name)], [map, name]);
|
|
66
|
-
return (0, _element.useSyncExternalStore)(subscribe, getValue);
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=observable-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","observableMap","map","Map","listeners","callListeners","name","list","get","listener","set","value","delete","subscribe","Set","add","size","useObservableValue","getValue","useMemo","useSyncExternalStore"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/observable-map.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useSyncExternalStore } from '@wordpress/element';\n\nexport type ObservableMap< K, V > = {\n\tget( name: K ): V | undefined;\n\tset( name: K, value: V ): void;\n\tdelete( name: K ): void;\n\tsubscribe( name: K, listener: () => void ): () => void;\n};\n\n/**\n * A key/value map where the individual entries are observable by subscribing to them\n * with the `subscribe` methods.\n */\nexport function observableMap< K, V >(): ObservableMap< K, V > {\n\tconst map = new Map< K, V >();\n\tconst listeners = new Map< K, Set< () => void > >();\n\n\tfunction callListeners( name: K ) {\n\t\tconst list = listeners.get( name );\n\t\tif ( ! list ) {\n\t\t\treturn;\n\t\t}\n\t\tfor ( const listener of list ) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\treturn {\n\t\tget( name ) {\n\t\t\treturn map.get( name );\n\t\t},\n\t\tset( name, value ) {\n\t\t\tmap.set( name, value );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tdelete( name ) {\n\t\t\tmap.delete( name );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tsubscribe( name, listener ) {\n\t\t\tlet list = listeners.get( name );\n\t\t\tif ( ! list ) {\n\t\t\t\tlist = new Set();\n\t\t\t\tlisteners.set( name, list );\n\t\t\t}\n\t\t\tlist.add( listener );\n\n\t\t\treturn () => {\n\t\t\t\tlist.delete( listener );\n\t\t\t\tif ( list.size === 0 ) {\n\t\t\t\t\tlisteners.delete( name );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * React hook that lets you observe an individual entry in an `ObservableMap`.\n *\n * @param map The `ObservableMap` to observe.\n * @param name The map key to observe.\n */\nexport function useObservableValue< K, V >(\n\tmap: ObservableMap< K, V >,\n\tname: K\n): V | undefined {\n\tconst [ subscribe, getValue ] = useMemo(\n\t\t() => [\n\t\t\t( listener: () => void ) => map.subscribe( name, listener ),\n\t\t\t() => map.get( name ),\n\t\t],\n\t\t[ map, name ]\n\t);\n\treturn useSyncExternalStore( subscribe, getValue );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAA,EAAkC;EAC9D,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC7B,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAyB,CAAC;EAEnD,SAASE,aAAaA,CAAEC,IAAO,EAAG;IACjC,MAAMC,IAAI,GAAGH,SAAS,CAACI,GAAG,CAAEF,IAAK,CAAC;IAClC,IAAK,CAAEC,IAAI,EAAG;MACb;IACD;IACA,KAAM,MAAME,QAAQ,IAAIF,IAAI,EAAG;MAC9BE,QAAQ,CAAC,CAAC;IACX;EACD;EAEA,OAAO;IACND,GAAGA,CAAEF,IAAI,EAAG;MACX,OAAOJ,GAAG,CAACM,GAAG,CAAEF,IAAK,CAAC;IACvB,CAAC;IACDI,GAAGA,CAAEJ,IAAI,EAAEK,KAAK,EAAG;MAClBT,GAAG,CAACQ,GAAG,CAAEJ,IAAI,EAAEK,KAAM,CAAC;MACtBN,aAAa,CAAEC,IAAK,CAAC;IACtB,CAAC;IACDM,MAAMA,CAAEN,IAAI,EAAG;MACdJ,GAAG,CAACU,MAAM,CAAEN,IAAK,CAAC;MAClBD,aAAa,CAAEC,IAAK,CAAC;IACtB,CAAC;IACDO,SAASA,CAAEP,IAAI,EAAEG,QAAQ,EAAG;MAC3B,IAAIF,IAAI,GAAGH,SAAS,CAACI,GAAG,CAAEF,IAAK,CAAC;MAChC,IAAK,CAAEC,IAAI,EAAG;QACbA,IAAI,GAAG,IAAIO,GAAG,CAAC,CAAC;QAChBV,SAAS,CAACM,GAAG,CAAEJ,IAAI,EAAEC,IAAK,CAAC;MAC5B;MACAA,IAAI,CAACQ,GAAG,CAAEN,QAAS,CAAC;MAEpB,OAAO,MAAM;QACZF,IAAI,CAACK,MAAM,CAAEH,QAAS,CAAC;QACvB,IAAKF,IAAI,CAACS,IAAI,KAAK,CAAC,EAAG;UACtBZ,SAAS,CAACQ,MAAM,CAAEN,IAAK,CAAC;QACzB;MACD,CAAC;IACF;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,kBAAkBA,CACjCf,GAA0B,EAC1BI,IAAO,EACS;EAChB,MAAM,CAAEO,SAAS,EAAEK,QAAQ,CAAE,GAAG,IAAAC,gBAAO,EACtC,MAAM,CACHV,QAAoB,IAAMP,GAAG,CAACW,SAAS,CAAEP,IAAI,EAAEG,QAAS,CAAC,EAC3D,MAAMP,GAAG,CAACM,GAAG,CAAEF,IAAK,CAAC,CACrB,EACD,CAAEJ,GAAG,EAAEI,IAAI,CACZ,CAAC;EACD,OAAO,IAAAc,6BAAoB,EAAEP,SAAS,EAAEK,QAAS,CAAC;AACnD","ignoreList":[]}
|
package/build/view/types.js
DELETED
package/build/view/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/view/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type ViewProps = { children?: ReactNode };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo, useSyncExternalStore } from '@wordpress/element';
|
|
5
|
-
/**
|
|
6
|
-
* A key/value map where the individual entries are observable by subscribing to them
|
|
7
|
-
* with the `subscribe` methods.
|
|
8
|
-
*/
|
|
9
|
-
export function observableMap() {
|
|
10
|
-
const map = new Map();
|
|
11
|
-
const listeners = new Map();
|
|
12
|
-
function callListeners(name) {
|
|
13
|
-
const list = listeners.get(name);
|
|
14
|
-
if (!list) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
for (const listener of list) {
|
|
18
|
-
listener();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
get(name) {
|
|
23
|
-
return map.get(name);
|
|
24
|
-
},
|
|
25
|
-
set(name, value) {
|
|
26
|
-
map.set(name, value);
|
|
27
|
-
callListeners(name);
|
|
28
|
-
},
|
|
29
|
-
delete(name) {
|
|
30
|
-
map.delete(name);
|
|
31
|
-
callListeners(name);
|
|
32
|
-
},
|
|
33
|
-
subscribe(name, listener) {
|
|
34
|
-
let list = listeners.get(name);
|
|
35
|
-
if (!list) {
|
|
36
|
-
list = new Set();
|
|
37
|
-
listeners.set(name, list);
|
|
38
|
-
}
|
|
39
|
-
list.add(listener);
|
|
40
|
-
return () => {
|
|
41
|
-
list.delete(listener);
|
|
42
|
-
if (list.size === 0) {
|
|
43
|
-
listeners.delete(name);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* React hook that lets you observe an individual entry in an `ObservableMap`.
|
|
52
|
-
*
|
|
53
|
-
* @param map The `ObservableMap` to observe.
|
|
54
|
-
* @param name The map key to observe.
|
|
55
|
-
*/
|
|
56
|
-
export function useObservableValue(map, name) {
|
|
57
|
-
const [subscribe, getValue] = useMemo(() => [listener => map.subscribe(name, listener), () => map.get(name)], [map, name]);
|
|
58
|
-
return useSyncExternalStore(subscribe, getValue);
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=observable-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useSyncExternalStore","observableMap","map","Map","listeners","callListeners","name","list","get","listener","set","value","delete","subscribe","Set","add","size","useObservableValue","getValue"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/observable-map.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useSyncExternalStore } from '@wordpress/element';\n\nexport type ObservableMap< K, V > = {\n\tget( name: K ): V | undefined;\n\tset( name: K, value: V ): void;\n\tdelete( name: K ): void;\n\tsubscribe( name: K, listener: () => void ): () => void;\n};\n\n/**\n * A key/value map where the individual entries are observable by subscribing to them\n * with the `subscribe` methods.\n */\nexport function observableMap< K, V >(): ObservableMap< K, V > {\n\tconst map = new Map< K, V >();\n\tconst listeners = new Map< K, Set< () => void > >();\n\n\tfunction callListeners( name: K ) {\n\t\tconst list = listeners.get( name );\n\t\tif ( ! list ) {\n\t\t\treturn;\n\t\t}\n\t\tfor ( const listener of list ) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\treturn {\n\t\tget( name ) {\n\t\t\treturn map.get( name );\n\t\t},\n\t\tset( name, value ) {\n\t\t\tmap.set( name, value );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tdelete( name ) {\n\t\t\tmap.delete( name );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tsubscribe( name, listener ) {\n\t\t\tlet list = listeners.get( name );\n\t\t\tif ( ! list ) {\n\t\t\t\tlist = new Set();\n\t\t\t\tlisteners.set( name, list );\n\t\t\t}\n\t\t\tlist.add( listener );\n\n\t\t\treturn () => {\n\t\t\t\tlist.delete( listener );\n\t\t\t\tif ( list.size === 0 ) {\n\t\t\t\t\tlisteners.delete( name );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * React hook that lets you observe an individual entry in an `ObservableMap`.\n *\n * @param map The `ObservableMap` to observe.\n * @param name The map key to observe.\n */\nexport function useObservableValue< K, V >(\n\tmap: ObservableMap< K, V >,\n\tname: K\n): V | undefined {\n\tconst [ subscribe, getValue ] = useMemo(\n\t\t() => [\n\t\t\t( listener: () => void ) => map.subscribe( name, listener ),\n\t\t\t() => map.get( name ),\n\t\t],\n\t\t[ map, name ]\n\t);\n\treturn useSyncExternalStore( subscribe, getValue );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,oBAAoB,QAAQ,oBAAoB;AASlE;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAA,EAAkC;EAC9D,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC7B,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAyB,CAAC;EAEnD,SAASE,aAAaA,CAAEC,IAAO,EAAG;IACjC,MAAMC,IAAI,GAAGH,SAAS,CAACI,GAAG,CAAEF,IAAK,CAAC;IAClC,IAAK,CAAEC,IAAI,EAAG;MACb;IACD;IACA,KAAM,MAAME,QAAQ,IAAIF,IAAI,EAAG;MAC9BE,QAAQ,CAAC,CAAC;IACX;EACD;EAEA,OAAO;IACND,GAAGA,CAAEF,IAAI,EAAG;MACX,OAAOJ,GAAG,CAACM,GAAG,CAAEF,IAAK,CAAC;IACvB,CAAC;IACDI,GAAGA,CAAEJ,IAAI,EAAEK,KAAK,EAAG;MAClBT,GAAG,CAACQ,GAAG,CAAEJ,IAAI,EAAEK,KAAM,CAAC;MACtBN,aAAa,CAAEC,IAAK,CAAC;IACtB,CAAC;IACDM,MAAMA,CAAEN,IAAI,EAAG;MACdJ,GAAG,CAACU,MAAM,CAAEN,IAAK,CAAC;MAClBD,aAAa,CAAEC,IAAK,CAAC;IACtB,CAAC;IACDO,SAASA,CAAEP,IAAI,EAAEG,QAAQ,EAAG;MAC3B,IAAIF,IAAI,GAAGH,SAAS,CAACI,GAAG,CAAEF,IAAK,CAAC;MAChC,IAAK,CAAEC,IAAI,EAAG;QACbA,IAAI,GAAG,IAAIO,GAAG,CAAC,CAAC;QAChBV,SAAS,CAACM,GAAG,CAAEJ,IAAI,EAAEC,IAAK,CAAC;MAC5B;MACAA,IAAI,CAACQ,GAAG,CAAEN,QAAS,CAAC;MAEpB,OAAO,MAAM;QACZF,IAAI,CAACK,MAAM,CAAEH,QAAS,CAAC;QACvB,IAAKF,IAAI,CAACS,IAAI,KAAK,CAAC,EAAG;UACtBZ,SAAS,CAACQ,MAAM,CAAEN,IAAK,CAAC;QACzB;MACD,CAAC;IACF;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,kBAAkBA,CACjCf,GAA0B,EAC1BI,IAAO,EACS;EAChB,MAAM,CAAEO,SAAS,EAAEK,QAAQ,CAAE,GAAGnB,OAAO,CACtC,MAAM,CACHU,QAAoB,IAAMP,GAAG,CAACW,SAAS,CAAEP,IAAI,EAAEG,QAAS,CAAC,EAC3D,MAAMP,GAAG,CAACM,GAAG,CAAEF,IAAK,CAAC,CACrB,EACD,CAAEJ,GAAG,EAAEI,IAAI,CACZ,CAAC;EACD,OAAON,oBAAoB,CAAEa,SAAS,EAAEK,QAAS,CAAC;AACnD","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/view/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type ViewProps = { children?: ReactNode };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type ObservableMap<K, V> = {
|
|
2
|
-
get(name: K): V | undefined;
|
|
3
|
-
set(name: K, value: V): void;
|
|
4
|
-
delete(name: K): void;
|
|
5
|
-
subscribe(name: K, listener: () => void): () => void;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* A key/value map where the individual entries are observable by subscribing to them
|
|
9
|
-
* with the `subscribe` methods.
|
|
10
|
-
*/
|
|
11
|
-
export declare function observableMap<K, V>(): ObservableMap<K, V>;
|
|
12
|
-
/**
|
|
13
|
-
* React hook that lets you observe an individual entry in an `ObservableMap`.
|
|
14
|
-
*
|
|
15
|
-
* @param map The `ObservableMap` to observe.
|
|
16
|
-
* @param name The map key to observe.
|
|
17
|
-
*/
|
|
18
|
-
export declare function useObservableValue<K, V>(map: ObservableMap<K, V>, name: K): V | undefined;
|
|
19
|
-
//# sourceMappingURL=observable-map.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"observable-map.d.ts","sourceRoot":"","sources":["../../../src/slot-fill/bubbles-virtually/observable-map.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,CAAE,CAAC,EAAE,CAAC,IAAK;IACnC,GAAG,CAAE,IAAI,EAAE,CAAC,GAAI,CAAC,GAAG,SAAS,CAAC;IAC9B,GAAG,CAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAI,IAAI,CAAC;IAC/B,MAAM,CAAE,IAAI,EAAE,CAAC,GAAI,IAAI,CAAC;IACxB,SAAS,CAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAI,MAAM,IAAI,CAAC;CACvD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,CAAE,CAAC,EAAE,CAAC,KAAM,aAAa,CAAE,CAAC,EAAE,CAAC,CAAE,CA0C7D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAE,CAAC,EAAE,CAAC,EACvC,GAAG,EAAE,aAAa,CAAE,CAAC,EAAE,CAAC,CAAE,EAC1B,IAAI,EAAE,CAAC,GACL,CAAC,GAAG,SAAS,CASf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/view/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo, useSyncExternalStore } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
export type ObservableMap< K, V > = {
|
|
7
|
-
get( name: K ): V | undefined;
|
|
8
|
-
set( name: K, value: V ): void;
|
|
9
|
-
delete( name: K ): void;
|
|
10
|
-
subscribe( name: K, listener: () => void ): () => void;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A key/value map where the individual entries are observable by subscribing to them
|
|
15
|
-
* with the `subscribe` methods.
|
|
16
|
-
*/
|
|
17
|
-
export function observableMap< K, V >(): ObservableMap< K, V > {
|
|
18
|
-
const map = new Map< K, V >();
|
|
19
|
-
const listeners = new Map< K, Set< () => void > >();
|
|
20
|
-
|
|
21
|
-
function callListeners( name: K ) {
|
|
22
|
-
const list = listeners.get( name );
|
|
23
|
-
if ( ! list ) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
for ( const listener of list ) {
|
|
27
|
-
listener();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
get( name ) {
|
|
33
|
-
return map.get( name );
|
|
34
|
-
},
|
|
35
|
-
set( name, value ) {
|
|
36
|
-
map.set( name, value );
|
|
37
|
-
callListeners( name );
|
|
38
|
-
},
|
|
39
|
-
delete( name ) {
|
|
40
|
-
map.delete( name );
|
|
41
|
-
callListeners( name );
|
|
42
|
-
},
|
|
43
|
-
subscribe( name, listener ) {
|
|
44
|
-
let list = listeners.get( name );
|
|
45
|
-
if ( ! list ) {
|
|
46
|
-
list = new Set();
|
|
47
|
-
listeners.set( name, list );
|
|
48
|
-
}
|
|
49
|
-
list.add( listener );
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
list.delete( listener );
|
|
53
|
-
if ( list.size === 0 ) {
|
|
54
|
-
listeners.delete( name );
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* React hook that lets you observe an individual entry in an `ObservableMap`.
|
|
63
|
-
*
|
|
64
|
-
* @param map The `ObservableMap` to observe.
|
|
65
|
-
* @param name The map key to observe.
|
|
66
|
-
*/
|
|
67
|
-
export function useObservableValue< K, V >(
|
|
68
|
-
map: ObservableMap< K, V >,
|
|
69
|
-
name: K
|
|
70
|
-
): V | undefined {
|
|
71
|
-
const [ subscribe, getValue ] = useMemo(
|
|
72
|
-
() => [
|
|
73
|
-
( listener: () => void ) => map.subscribe( name, listener ),
|
|
74
|
-
() => map.get( name ),
|
|
75
|
-
],
|
|
76
|
-
[ map, name ]
|
|
77
|
-
);
|
|
78
|
-
return useSyncExternalStore( subscribe, getValue );
|
|
79
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen, act } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
observableMap,
|
|
11
|
-
useObservableValue,
|
|
12
|
-
} from '../bubbles-virtually/observable-map';
|
|
13
|
-
|
|
14
|
-
describe( 'ObservableMap', () => {
|
|
15
|
-
test( 'should observe individual values', () => {
|
|
16
|
-
const map = observableMap();
|
|
17
|
-
|
|
18
|
-
const listenerA = jest.fn();
|
|
19
|
-
const listenerB = jest.fn();
|
|
20
|
-
|
|
21
|
-
const unsubA = map.subscribe( 'a', listenerA );
|
|
22
|
-
const unsubB = map.subscribe( 'b', listenerB );
|
|
23
|
-
|
|
24
|
-
// check that setting `a` doesn't notify the `b` listener
|
|
25
|
-
map.set( 'a', 1 );
|
|
26
|
-
expect( listenerA ).toHaveBeenCalledTimes( 1 );
|
|
27
|
-
expect( listenerB ).toHaveBeenCalledTimes( 0 );
|
|
28
|
-
|
|
29
|
-
// check that setting `b` doesn't notify the `a` listener
|
|
30
|
-
map.set( 'b', 2 );
|
|
31
|
-
expect( listenerA ).toHaveBeenCalledTimes( 1 );
|
|
32
|
-
expect( listenerB ).toHaveBeenCalledTimes( 1 );
|
|
33
|
-
|
|
34
|
-
// check that `delete` triggers notifications, too
|
|
35
|
-
map.delete( 'a' );
|
|
36
|
-
expect( listenerA ).toHaveBeenCalledTimes( 2 );
|
|
37
|
-
expect( listenerB ).toHaveBeenCalledTimes( 1 );
|
|
38
|
-
|
|
39
|
-
// check that the subscription survived the `delete`
|
|
40
|
-
map.set( 'a', 2 );
|
|
41
|
-
expect( listenerA ).toHaveBeenCalledTimes( 3 );
|
|
42
|
-
expect( listenerB ).toHaveBeenCalledTimes( 1 );
|
|
43
|
-
|
|
44
|
-
// check that unsubscription really works
|
|
45
|
-
unsubA();
|
|
46
|
-
unsubB();
|
|
47
|
-
map.set( 'a', 3 );
|
|
48
|
-
expect( listenerA ).toHaveBeenCalledTimes( 3 );
|
|
49
|
-
expect( listenerB ).toHaveBeenCalledTimes( 1 );
|
|
50
|
-
} );
|
|
51
|
-
} );
|
|
52
|
-
|
|
53
|
-
describe( 'useObservableValue', () => {
|
|
54
|
-
test( 'reacts only to the specified key', () => {
|
|
55
|
-
const map = observableMap();
|
|
56
|
-
map.set( 'a', 1 );
|
|
57
|
-
|
|
58
|
-
const MapUI = jest.fn( () => {
|
|
59
|
-
const value = useObservableValue( map, 'a' );
|
|
60
|
-
return <div>value is { value }</div>;
|
|
61
|
-
} );
|
|
62
|
-
|
|
63
|
-
render( <MapUI /> );
|
|
64
|
-
expect( screen.getByText( /^value is/ ) ).toHaveTextContent(
|
|
65
|
-
'value is 1'
|
|
66
|
-
);
|
|
67
|
-
expect( MapUI ).toHaveBeenCalledTimes( 1 );
|
|
68
|
-
|
|
69
|
-
act( () => {
|
|
70
|
-
map.set( 'a', 2 );
|
|
71
|
-
} );
|
|
72
|
-
expect( screen.getByText( /^value is/ ) ).toHaveTextContent(
|
|
73
|
-
'value is 2'
|
|
74
|
-
);
|
|
75
|
-
expect( MapUI ).toHaveBeenCalledTimes( 2 );
|
|
76
|
-
|
|
77
|
-
// check that setting unobserved map key doesn't trigger a render at all
|
|
78
|
-
act( () => {
|
|
79
|
-
map.set( 'b', 1 );
|
|
80
|
-
} );
|
|
81
|
-
expect( MapUI ).toHaveBeenCalledTimes( 2 );
|
|
82
|
-
} );
|
|
83
|
-
} );
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __unstableIframe as Iframe } from '@wordpress/block-editor';
|
|
10
|
-
import { useMemo } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { useCx } from '..';
|
|
16
|
-
import StyleProvider from '../../../style-provider';
|
|
17
|
-
import {
|
|
18
|
-
createSlotFill,
|
|
19
|
-
Provider as SlotFillProvider,
|
|
20
|
-
} from '../../../slot-fill';
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
title: 'Components (Experimental)/useCx',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Example = ( { serializedStyles, children } ) => {
|
|
27
|
-
const cx = useCx();
|
|
28
|
-
const classes = cx( serializedStyles );
|
|
29
|
-
return <span className={ classes }>{ children }</span>;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const ExampleWithUseMemoWrong = ( { serializedStyles, children } ) => {
|
|
33
|
-
const cx = useCx();
|
|
34
|
-
// Wrong: using 'useMemo' without adding 'cx' to the dependency list.
|
|
35
|
-
const classes = useMemo(
|
|
36
|
-
() => cx( serializedStyles ),
|
|
37
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
-
[ serializedStyles ]
|
|
39
|
-
);
|
|
40
|
-
return <span className={ classes }>{ children }</span>;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const ExampleWithUseMemoRight = ( { serializedStyles, children } ) => {
|
|
44
|
-
const cx = useCx();
|
|
45
|
-
// Right: using 'useMemo' with 'cx' listed as a dependency.
|
|
46
|
-
const classes = useMemo(
|
|
47
|
-
() => cx( serializedStyles ),
|
|
48
|
-
[ cx, serializedStyles ]
|
|
49
|
-
);
|
|
50
|
-
return <span className={ classes }>{ children }</span>;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const _slotFill = () => {
|
|
54
|
-
const { Fill, Slot } = createSlotFill( 'UseCxExampleSlot' );
|
|
55
|
-
|
|
56
|
-
const redText = css`
|
|
57
|
-
color: red;
|
|
58
|
-
`;
|
|
59
|
-
const blueText = css`
|
|
60
|
-
color: blue;
|
|
61
|
-
`;
|
|
62
|
-
const greenText = css`
|
|
63
|
-
color: green;
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<SlotFillProvider>
|
|
68
|
-
<StyleProvider document={ document }>
|
|
69
|
-
<Iframe>
|
|
70
|
-
<Iframe>
|
|
71
|
-
<Example serializedStyles={ redText }>
|
|
72
|
-
This text is inside an iframe and should be red
|
|
73
|
-
</Example>
|
|
74
|
-
<Fill name="test-slot">
|
|
75
|
-
<Example serializedStyles={ blueText }>
|
|
76
|
-
This text is also inside the iframe, but is
|
|
77
|
-
relocated by a slot/fill and should be blue
|
|
78
|
-
</Example>
|
|
79
|
-
</Fill>
|
|
80
|
-
<Fill name="outside-frame">
|
|
81
|
-
<Example serializedStyles={ greenText }>
|
|
82
|
-
This text is also inside the iframe, but is
|
|
83
|
-
relocated by a slot/fill and should be green
|
|
84
|
-
</Example>
|
|
85
|
-
</Fill>
|
|
86
|
-
</Iframe>
|
|
87
|
-
<StyleProvider document={ document }>
|
|
88
|
-
<Slot bubblesVirtually name="test-slot" />
|
|
89
|
-
</StyleProvider>
|
|
90
|
-
</Iframe>
|
|
91
|
-
<Slot bubblesVirtually name="outside-frame" />
|
|
92
|
-
</StyleProvider>
|
|
93
|
-
</SlotFillProvider>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const _slotFillSimple = () => {
|
|
98
|
-
const { Fill, Slot } = createSlotFill( 'UseCxExampleSlotTwo' );
|
|
99
|
-
|
|
100
|
-
const redText = css`
|
|
101
|
-
color: red;
|
|
102
|
-
`;
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<SlotFillProvider>
|
|
106
|
-
<Iframe>
|
|
107
|
-
<Fill name="test-slot">
|
|
108
|
-
<Example serializedStyles={ redText }>
|
|
109
|
-
This text should be red
|
|
110
|
-
</Example>
|
|
111
|
-
</Fill>
|
|
112
|
-
</Iframe>
|
|
113
|
-
<Slot bubblesVirtually name="test-slot" />
|
|
114
|
-
</SlotFillProvider>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const _useMemoBadPractices = () => {
|
|
119
|
-
const redText = css`
|
|
120
|
-
color: red;
|
|
121
|
-
`;
|
|
122
|
-
const blueText = css`
|
|
123
|
-
color: blue;
|
|
124
|
-
`;
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<>
|
|
128
|
-
<Example serializedStyles={ redText }>
|
|
129
|
-
This text should be red
|
|
130
|
-
</Example>
|
|
131
|
-
<ExampleWithUseMemoRight serializedStyles={ blueText }>
|
|
132
|
-
This text should be blue
|
|
133
|
-
</ExampleWithUseMemoRight>
|
|
134
|
-
<Iframe>
|
|
135
|
-
<Example serializedStyles={ redText }>
|
|
136
|
-
This text should be red
|
|
137
|
-
</Example>
|
|
138
|
-
<ExampleWithUseMemoWrong serializedStyles={ blueText }>
|
|
139
|
-
This text should be blue but it's not!
|
|
140
|
-
</ExampleWithUseMemoWrong>
|
|
141
|
-
</Iframe>
|
|
142
|
-
</>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const _default = () => {
|
|
147
|
-
const redText = css`
|
|
148
|
-
color: red;
|
|
149
|
-
`;
|
|
150
|
-
return (
|
|
151
|
-
<Iframe>
|
|
152
|
-
<Example serializedStyles={ redText }>
|
|
153
|
-
This text is inside an iframe and is red!
|
|
154
|
-
</Example>
|
|
155
|
-
</Iframe>
|
|
156
|
-
);
|
|
157
|
-
};
|