@wordpress/components 40.0.0 → 40.1.1-next.v.202609031004.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 +26 -0
- package/build/border-box-control/border-box-control/component.cjs +37 -5
- package/build/border-box-control/border-box-control/component.cjs.map +3 -3
- package/build/border-box-control/border-box-control/hook.cjs +24 -3
- package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
- package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
- package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
- package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
- package/build/color-palette/index.cjs +1 -1
- package/build/color-palette/index.cjs.map +2 -2
- package/build/context/context-system-provider.cjs +2 -5
- package/build/context/context-system-provider.cjs.map +3 -3
- package/build/context/use-context-system.cjs +7 -2
- package/build/context/use-context-system.cjs.map +2 -2
- package/build/icon/index.cjs +30 -12
- package/build/icon/index.cjs.map +2 -2
- package/build/item-group/item/hook.cjs +1 -1
- package/build/item-group/item/hook.cjs.map +2 -2
- package/build/item-group/item-group/hook.cjs +1 -1
- package/build/item-group/item-group/hook.cjs.map +2 -2
- package/build/resizable-box/index.cjs.map +1 -1
- package/build/snackbar/index.cjs +8 -5
- package/build/snackbar/index.cjs.map +2 -2
- package/build/tools-panel/tools-panel/hook.cjs +102 -106
- package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
- package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
- package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
- package/build-module/border-box-control/border-box-control/component.mjs +38 -6
- package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
- package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
- package/build-module/color-palette/index.mjs +1 -1
- package/build-module/color-palette/index.mjs.map +2 -2
- package/build-module/context/context-system-provider.mjs +2 -5
- package/build-module/context/context-system-provider.mjs.map +3 -3
- package/build-module/context/use-context-system.mjs +7 -2
- package/build-module/context/use-context-system.mjs.map +2 -2
- package/build-module/icon/index.mjs +30 -12
- package/build-module/icon/index.mjs.map +2 -2
- package/build-module/item-group/item/hook.mjs +1 -1
- package/build-module/item-group/item/hook.mjs.map +2 -2
- package/build-module/item-group/item-group/hook.mjs +1 -1
- package/build-module/item-group/item-group/hook.mjs.map +2 -2
- package/build-module/resizable-box/index.mjs.map +1 -1
- package/build-module/snackbar/index.mjs +8 -5
- package/build-module/snackbar/index.mjs.map +2 -2
- package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
- package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
- package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
- package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
- package/build-style/style-rtl.css +7 -35
- package/build-style/style.css +7 -35
- package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +6 -2
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/composite/types.d.ts +1 -1
- package/build-types/context/context-system-provider.d.ts +8 -6
- package/build-types/context/context-system-provider.d.ts.map +1 -1
- package/build-types/context/use-context-system.d.ts.map +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +6 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +52 -9
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/angle-picker-control/style.module.scss +1 -1
- package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
- package/src/base-control/stories/index.story.tsx +2 -2
- package/src/border-box-control/border-box-control/README.md +5 -3
- package/src/border-box-control/border-box-control/component.tsx +83 -15
- package/src/border-box-control/border-box-control/hook.ts +19 -1
- package/src/border-box-control/stories/index.story.tsx +10 -0
- package/src/border-box-control/style.module.scss +34 -3
- package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +133 -0
- package/src/border-box-control/test/utils.ts +11 -0
- package/src/border-box-control/types.ts +6 -2
- package/src/border-control/test/{index.js → index.jsdom.test.tsx} +20 -13
- package/src/checkbox-control/style.scss +2 -2
- package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +8 -5
- package/src/color-palette/index.tsx +1 -1
- package/src/composite/README.md +1 -1
- package/src/composite/types.ts +1 -1
- package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
- package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
- package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsdom.test.tsx.snap} +3 -3
- package/src/context/test/context-connect.tsx +1 -2
- package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +81 -43
- package/src/context/test/wordpress-component.tsx +1 -2
- package/src/context/use-context-system.js +13 -4
- package/src/custom-gradient-picker/test/serializer.ts +1 -0
- package/src/date-time/test/utils.test.ts +9 -0
- package/src/draggable/style.module.scss +1 -1
- package/src/dropdown/style.module.scss +2 -2
- package/src/font-size-picker/test/utils.ts +1 -0
- package/src/icon/index.tsx +28 -12
- package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
- package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
- package/src/item-group/style.module.scss +1 -2
- package/src/navigator/test/router.ts +1 -0
- package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +5 -2
- package/src/popover/README.md +2 -2
- package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
- package/src/popover/types.ts +9 -3
- package/src/query-controls/test/terms.ts +1 -0
- package/src/resizable-box/index.tsx +1 -1
- package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +3 -3
- package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
- package/src/snackbar/index.tsx +10 -6
- package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +28 -2
- package/src/snackbar/test/list.jsdom.test.tsx +99 -0
- package/src/surface/style.module.scss +2 -2
- package/src/textarea-control/style.module.scss +1 -1
- package/src/tip/style.scss +1 -1
- package/src/toggle-group-control/toggle-group-control/style.module.scss +1 -1
- package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +528 -9
- package/src/tools-panel/tools-panel/hook.ts +195 -180
- package/src/tools-panel/tools-panel-item/README.md +42 -1
- package/src/tools-panel/tools-panel-item/hook.ts +97 -69
- package/src/tools-panel/types.ts +54 -9
- package/src/truncate/style.module.scss +0 -1
- package/src/unit-control/test/utils.ts +1 -0
- package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +17 -3
- package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +3 -1
- package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +3 -1
- package/src/utils/test/colors.js +1 -0
- package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
- package/src/utils/test/math.js +1 -0
- package/src/utils/test/rtl.js +1 -0
- package/src/utils/test/space.js +1 -0
- package/src/utils/test/strings.js +1 -0
- package/src/utils/test/unit-values.js +1 -0
- package/src/view/test/{index.js → index.jsdom.test.tsx} +5 -1
- package/src/snackbar/test/list.tsx +0 -39
- /package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/button/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +0 -0
- /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +0 -0
- /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +0 -0
- /package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +0 -0
- /package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
- /package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-filters/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/item-group/test/{index.js → index.jsdom.test.tsx} +0 -0
- /package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +0 -0
- /package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +0 -0
- /package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +0 -0
- /package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +0 -0
- /package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +0 -0
- /package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/panel/test/__snapshots__/{body.tsx.snap → body.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{header.tsx.snap → header.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +0 -0
- /package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
- /package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
- /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
- /package/src/shortcut/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
- /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +0 -0
- /package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toggle-group-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +0 -0
- /package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.tsx.snap → roving-tab-index-item.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{roving-tab-index.tsx.snap → roving-tab-index.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/{cell.tsx → cell.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{row.tsx → row.jsdom.test.tsx} +0 -0
- /package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
- /package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +0 -0
- /package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools-panel/tools-panel-item/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/tools-panel/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerResetAllFilter,\n deregisterResetAllFilter,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // hasValue is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // resetAllFilter is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);\n const previousPanelId = usePrevious(currentPanelId);\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // Registering the panel item allows the panel to include it in its\n // automatically generated menu and determine its initial checked status.\n //\n // This is performed in a layout effect to ensure that the panel item\n // is registered before it is rendered preventing a rendering glitch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (hasMatchingPanel && previousPanelId !== null) {\n registerPanelItem({\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n panelId\n });\n }\n return () => {\n if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {\n deregisterPanelItem(label);\n }\n };\n }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);\n useEffect(() => {\n if (hasMatchingPanel) {\n registerResetAllFilter(resetAllFilterCallback);\n }\n return () => {\n if (hasMatchingPanel) {\n deregisterResetAllFilter(resetAllFilterCallback);\n }\n };\n }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);\n\n // Note: `label` is used as a key when building menu item state in\n // `ToolsPanel`.\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const wasMenuItemChecked = usePrevious(isMenuItemChecked);\n const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;\n const isValueSet = hasValue();\n // Notify the panel when an item's value has changed except for optional\n // items without value because the item should not cause itself to hide.\n useEffect(() => {\n if (!isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label, menuGroup);\n }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);\n\n // Determine if the panel item's corresponding menu is being toggled and\n // trigger appropriate callback if it is.\n useEffect(() => {\n // We check whether this item is currently registered as items rendered\n // via fills can persist through the parent panel being remounted.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);\n\n // The item is shown if it is a default control regardless of whether it\n // has a value. Optional items are shown when they are checked or have\n // a value.\n const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { useEvent } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect, useRef } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n defaultShown,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n onShownChange,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // `hasValue` is a new function every render. It can't use `useEvent`\n // because the panel calls it while deriving the menu during render, which\n // `useEvent` forbids, so it stays keyed on the panel it was captured for.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // `resetAllFilter` only runs from the reset handler, so a stable identity\n // that always sees the latest props is both safe and more correct than\n // freezing it per panel.\n const resetAllFilterCallback = useEvent(resetAllFilter);\n\n // `defaultShown` seeds an item's visibility when it registers, and is\n // deliberately not reactive. Holding it in a ref keeps it out of the\n // registration effect below, so a change on its own cannot deregister and\n // re-register the item, which would discard the visibility the user chose\n // from the menu.\n //\n // The ref still tracks the latest value, so that a re-registration caused\n // by something else, such as `panelId` changing, seeds from the current\n // preference rather than a stale one.\n const defaultShownRef = useRef(defaultShown);\n // Declared before the registration effect below so that it has already\n // run by the time that effect reads the ref in the same commit.\n useLayoutEffect(() => {\n defaultShownRef.current = defaultShown;\n });\n\n // `onShownChange` is a new function every render. `useEvent` gives the item\n // a stable callback to register, while the panel still invokes the latest.\n const onShownChangeCallback = useEvent(onShownChange);\n\n // A panel spanning a multi-selection has no id of its own, so every item\n // belongs to it.\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // A layout effect so the item is registered before it renders, avoiding a\n // glitch, and so a whole panel's worth of registrations land in one commit\n // for React to batch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (!hasMatchingPanel) {\n return;\n }\n const item = {\n defaultShown: defaultShownRef.current,\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n onShownChange: onShownChangeCallback,\n panelId,\n resetAllFilter: resetAllFilterCallback\n };\n registerPanelItem(item);\n\n // Passing the registration back lets the panel ignore this cleanup if\n // a replacement has already claimed the label, which happens when a\n // panel switches while its items arrive through a Slot.\n return () => {\n deregisterPanelItem(label, item);\n };\n }, [deregisterPanelItem, hasMatchingPanel, hasValueCallback, isShownByDefault, label, onShownChangeCallback, panelId, registerPanelItem, resetAllFilterCallback]);\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const isRegistered = isMenuItemChecked !== undefined;\n // Tracks the effect below rather than the render, so renders that leave\n // the checked state alone can't desync it.\n const wasMenuItemCheckedRef = useRef(undefined);\n const isValueSet = hasValue();\n\n // An optional item losing its value must not hide itself, so only default\n // items report a value going away. Items belonging to another panel stay\n // silent or they would leave an orphaned entry in this panel's menu.\n //\n // Shares the layout phase with registration above so it runs against an\n // already registered item and batches with it.\n useLayoutEffect(() => {\n if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label);\n }, [hasMatchingPanel, isValueSet, label, flagItemCustomization, isShownByDefault]);\n\n // Passive so consumer callbacks don't run before the browser has painted.\n useEffect(() => {\n const wasMenuItemChecked = wasMenuItemCheckedRef.current;\n wasMenuItemCheckedRef.current = isMenuItemChecked;\n\n // An item has no menu entry until it registers, so the first time\n // through there is no previous checked state. Items that register\n // already shown, because they have a value or `defaultShown` was set,\n // must not look as though the user just selected them.\n const wasRegistered = wasMenuItemChecked !== undefined;\n\n // Items rendered via fills can outlive a remount of the panel they\n // belong to, leaving them unregistered.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || !wasRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, onSelect, onDeselect]);\n\n // A default control shows whether or not it has a value; an optional one\n // shows once checked.\n const isShown = isShownByDefault ? isRegistered : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,qBAAyB;AACzB,qBAAgE;;;ACFhE,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MA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O,uBAAuB,SAAS,mBAAmB,sBAAsB,CAAC;AAChK,QAAM,YAAY,mBAAmB,YAAY;AACjD,QAAM,oBAAoB,YAAY,SAAS,IAAI,KAAK;AACxD,QAAM,eAAe,sBAAsB;AAG3C,QAAM,4BAAwB,uBAAO,MAAS;AAC9C,QAAM,aAAa,SAAS;AAQ5B,sCAAgB,MAAM;AACpB,QAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,YAAY;AACzD;AAAA,IACF;AACA,0BAAsB,YAAY,KAAK;AAAA,EACzC,GAAG,CAAC,kBAAkB,YAAY,OAAO,uBAAuB,gBAAgB,CAAC;AAGjF,gCAAU,MAAM;AACd,UAAM,qBAAqB,sBAAsB;AACjD,0BAAsB,UAAU;AAMhC,UAAM,gBAAgB,uBAAuB;AAK7C,QAAI,CAAC,gBAAgB,CAAC,iBAAiB,eAAe,CAAC,kBAAkB;AACvE;AAAA,IACF;AACA,QAAI,qBAAqB,CAAC,cAAc,CAAC,oBAAoB;AAC3D,iBAAW;AAAA,IACb;AACA,QAAI,CAAC,qBAAqB,cAAc,oBAAoB;AAC1D,mBAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,kBAAkB,mBAAmB,cAAc,aAAa,YAAY,UAAU,UAAU,CAAC;AAIrG,QAAM,UAAU,mBAAmB,eAAe;AAClD,QAAM,+BAA+B,2BAA2B,CAAC;AACjE,QAAM,cAAU,YAAAC,SAAK,qBAAO,kBAAkB,GAAG,gCAAgC,qBAAO,8BAA8B,GAAG,CAAC,gCAAgC,WAAW,uBAAuB,SAAS,qCAAqC,sBAAsB,SAAS,kCAAkC;AAC3S,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
|
|
6
6
|
"names": ["import_context", "clsx"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// packages/components/src/border-box-control/border-box-control/component.tsx
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { useMemo, useState } from "@wordpress/element";
|
|
4
|
-
import { useMergeRefs } from "@wordpress/compose";
|
|
4
|
+
import { useInstanceId, useMergeRefs } from "@wordpress/compose";
|
|
5
5
|
import BorderBoxControlLinkedButton from "../border-box-control-linked-button/index.mjs";
|
|
6
6
|
import BorderBoxControlSplitControls from "../border-box-control-split-controls/index.mjs";
|
|
7
7
|
import { BorderControl } from "../../border-control/index.mjs";
|
|
8
|
-
import
|
|
8
|
+
import BaseControl from "../../base-control/index.mjs";
|
|
9
|
+
import { Grid } from "../../grid/index.mjs";
|
|
9
10
|
import { View } from "../../view/index.mjs";
|
|
10
11
|
import { VisuallyHidden } from "../../visually-hidden/index.mjs";
|
|
11
12
|
import { contextConnect } from "../../context/index.mjs";
|
|
@@ -13,6 +14,7 @@ import { useBorderBoxControl } from "./hook.mjs";
|
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
var BorderLabel = (props) => {
|
|
15
16
|
const {
|
|
17
|
+
id,
|
|
16
18
|
label,
|
|
17
19
|
hideLabelFromVision
|
|
18
20
|
} = props;
|
|
@@ -20,9 +22,11 @@ var BorderLabel = (props) => {
|
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
24
|
return hideLabelFromVision ? /* @__PURE__ */ _jsx(VisuallyHidden, {
|
|
23
|
-
as: "
|
|
25
|
+
as: "span",
|
|
26
|
+
id,
|
|
24
27
|
children: label
|
|
25
|
-
}) : /* @__PURE__ */ _jsx(
|
|
28
|
+
}) : /* @__PURE__ */ _jsx(BaseControl.VisualLabel, {
|
|
29
|
+
id,
|
|
26
30
|
children: label
|
|
27
31
|
});
|
|
28
32
|
};
|
|
@@ -35,6 +39,8 @@ var UnconnectedBorderBoxControl = (props, forwardedRef) => {
|
|
|
35
39
|
enableAlpha,
|
|
36
40
|
enableStyle,
|
|
37
41
|
hasMixedBorders,
|
|
42
|
+
hasVisibleLabel,
|
|
43
|
+
headerClassName,
|
|
38
44
|
hideLabelFromVision,
|
|
39
45
|
isLinked,
|
|
40
46
|
label,
|
|
@@ -48,8 +54,12 @@ var UnconnectedBorderBoxControl = (props, forwardedRef) => {
|
|
|
48
54
|
toggleLinked,
|
|
49
55
|
wrapperClassName,
|
|
50
56
|
__experimentalIsRenderedInSidebar,
|
|
57
|
+
"aria-label": ariaLabel,
|
|
58
|
+
"aria-labelledby": ariaLabelledBy,
|
|
51
59
|
...otherProps
|
|
52
60
|
} = useBorderBoxControl(props);
|
|
61
|
+
const generatedLabelId = useInstanceId(BorderBoxControl, "border-box-control-label");
|
|
62
|
+
const labelId = label && !ariaLabel && !ariaLabelledBy ? generatedLabelId : void 0;
|
|
53
63
|
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
54
64
|
const popoverProps = useMemo(() => popoverPlacement ? {
|
|
55
65
|
placement: popoverPlacement,
|
|
@@ -60,9 +70,31 @@ var UnconnectedBorderBoxControl = (props, forwardedRef) => {
|
|
|
60
70
|
const mergedRef = useMergeRefs([setPopoverAnchor, forwardedRef]);
|
|
61
71
|
return /* @__PURE__ */ _jsxs(View, {
|
|
62
72
|
className,
|
|
73
|
+
role: label || ariaLabel || ariaLabelledBy ? "group" : void 0,
|
|
74
|
+
"aria-label": ariaLabel,
|
|
75
|
+
"aria-labelledby": ariaLabelledBy ?? labelId,
|
|
63
76
|
...otherProps,
|
|
64
77
|
ref: mergedRef,
|
|
65
|
-
children: [
|
|
78
|
+
children: [hasVisibleLabel ? (
|
|
79
|
+
// The toggle shares the label's row so that it lines up with
|
|
80
|
+
// the equivalent toggle on sibling controls, e.g. the border
|
|
81
|
+
// radius one.
|
|
82
|
+
/* @__PURE__ */ _jsxs(Grid, {
|
|
83
|
+
className: headerClassName,
|
|
84
|
+
columns: 2,
|
|
85
|
+
templateColumns: "1fr min-content",
|
|
86
|
+
alignment: "center",
|
|
87
|
+
children: [/* @__PURE__ */ _jsx(BorderLabel, {
|
|
88
|
+
id: labelId,
|
|
89
|
+
label,
|
|
90
|
+
hideLabelFromVision
|
|
91
|
+
}), /* @__PURE__ */ _jsx(BorderBoxControlLinkedButton, {
|
|
92
|
+
onClick: toggleLinked,
|
|
93
|
+
isLinked
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
) : /* @__PURE__ */ _jsx(BorderLabel, {
|
|
97
|
+
id: labelId,
|
|
66
98
|
label,
|
|
67
99
|
hideLabelFromVision
|
|
68
100
|
}), /* @__PURE__ */ _jsxs(View, {
|
|
@@ -92,7 +124,7 @@ var UnconnectedBorderBoxControl = (props, forwardedRef) => {
|
|
|
92
124
|
popoverOffset,
|
|
93
125
|
value: splitValue,
|
|
94
126
|
__experimentalIsRenderedInSidebar
|
|
95
|
-
}), /* @__PURE__ */ _jsx(BorderBoxControlLinkedButton, {
|
|
127
|
+
}), !hasVisibleLabel && /* @__PURE__ */ _jsx(BorderBoxControlLinkedButton, {
|
|
96
128
|
onClick: toggleLinked,
|
|
97
129
|
isLinked
|
|
98
130
|
})]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/border-box-control/border-box-control/component.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport {
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,SAAS,gBAAgB;AAClC,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport BaseControl from '../../base-control';\nimport { Grid } from '../../grid';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { contextConnect } from '../../context';\nimport { useBorderBoxControl } from './hook';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst BorderLabel = props => {\n const {\n id,\n label,\n hideLabelFromVision\n } = props;\n if (!label) {\n return null;\n }\n\n // The visible label is rendered as `BaseControl.VisualLabel` so it carries\n // the stable `.components-base-control__label` className consumers style\n // against; `StyledLabel` is an emotion component with a generated one.\n return hideLabelFromVision ? /*#__PURE__*/_jsx(VisuallyHidden, {\n as: \"span\",\n id: id,\n children: label\n }) : /*#__PURE__*/_jsx(BaseControl.VisualLabel, {\n id: id,\n children: label\n });\n};\nconst UnconnectedBorderBoxControl = (props, forwardedRef) => {\n const {\n className,\n colors,\n disableCustomColors,\n disableUnits,\n enableAlpha,\n enableStyle,\n hasMixedBorders,\n hasVisibleLabel,\n headerClassName,\n hideLabelFromVision,\n isLinked,\n label,\n linkedControlClassName,\n linkedValue,\n onLinkedChange,\n onSplitChange,\n popoverPlacement,\n popoverOffset,\n splitValue,\n toggleLinked,\n wrapperClassName,\n __experimentalIsRenderedInSidebar,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...otherProps\n } = useBorderBoxControl(props);\n\n // The label names the group of border controls rather than a single input,\n // so it is associated via `aria-labelledby` instead of `htmlFor`.\n const generatedLabelId = useInstanceId(BorderBoxControl, 'border-box-control-label');\n\n // A consumer-provided accessible name takes precedence, so the generated\n // relationship is only used as a fallback. Where an external name wins,\n // the unused ID is left off the internal label. Empty values are treated\n // as absent, matching the accessible name computation, which skips an\n // empty `aria-label` or `aria-labelledby` rather than resolving a name\n // from it.\n const labelId = label && !ariaLabel && !ariaLabelledBy ? generatedLabelId : undefined;\n\n // Use internal state instead of a ref to make sure that the component\n // re-renders when the popover's anchor updates.\n const [popoverAnchor, setPopoverAnchor] = useState(null);\n\n // Memoize popoverProps to avoid returning a new object every time.\n const popoverProps = useMemo(() => popoverPlacement ? {\n placement: popoverPlacement,\n offset: popoverOffset,\n anchor: popoverAnchor,\n shift: true\n } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);\n const mergedRef = useMergeRefs([setPopoverAnchor, forwardedRef]);\n return /*#__PURE__*/_jsxs(View, {\n className: className\n // Whichever naming source wins, it describes the border controls\n // as a whole, so the wrapper needs a role for that accessible\n // name to attach to. Without a name there is no group to expose.\n ,\n role: label || ariaLabel || ariaLabelledBy ? 'group' : undefined,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy ?? labelId,\n ...otherProps,\n ref: mergedRef,\n children: [hasVisibleLabel ?\n /*#__PURE__*/\n // The toggle shares the label's row so that it lines up with\n // the equivalent toggle on sibling controls, e.g. the border\n // radius one.\n _jsxs(Grid, {\n className: headerClassName,\n columns: 2,\n templateColumns: \"1fr min-content\",\n alignment: \"center\",\n children: [/*#__PURE__*/_jsx(BorderLabel, {\n id: labelId,\n label: label,\n hideLabelFromVision: hideLabelFromVision\n }), /*#__PURE__*/_jsx(BorderBoxControlLinkedButton, {\n onClick: toggleLinked,\n isLinked: isLinked\n })]\n }) : /*#__PURE__*/_jsx(BorderLabel, {\n id: labelId,\n label: label,\n hideLabelFromVision: hideLabelFromVision\n }), /*#__PURE__*/_jsxs(View, {\n className: wrapperClassName,\n children: [isLinked ? /*#__PURE__*/_jsx(BorderControl, {\n className: linkedControlClassName,\n colors: colors,\n disableUnits: disableUnits,\n disableCustomColors: disableCustomColors,\n enableAlpha: enableAlpha,\n enableStyle: enableStyle,\n onChange: onLinkedChange,\n placeholder: hasMixedBorders ? __('Mixed') : undefined,\n __unstablePopoverProps: popoverProps,\n shouldSanitizeBorder: false // This component will handle that.\n ,\n value: linkedValue,\n withSlider: true,\n width: \"116px\",\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar\n }) : /*#__PURE__*/_jsx(BorderBoxControlSplitControls, {\n colors: colors,\n disableCustomColors: disableCustomColors,\n enableAlpha: enableAlpha,\n enableStyle: enableStyle,\n onChange: onSplitChange,\n popoverPlacement: popoverPlacement,\n popoverOffset: popoverOffset,\n value: splitValue,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar\n }), !hasVisibleLabel && /*#__PURE__*/_jsx(BorderBoxControlLinkedButton, {\n onClick: toggleLinked,\n isLinked: isLinked\n })]\n })]\n });\n};\n\n/**\n * An input control for the color, style, and width of the border of a box. The\n * border can be customized as a whole, or individually for each side of the box.\n *\n * The controls are exposed as a group named by the `label` prop. Passing\n * `aria-labelledby` or `aria-label` names the group instead, taking precedence\n * over `label`; with none of the three, the wrapper is not exposed as a group.\n *\n * ```jsx\n * import { BorderBoxControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderBoxControl = () => {\n * \tconst defaultBorder = {\n * \t\tcolor: '#72aee6',\n * \t\tstyle: 'dashed',\n * \t\twidth: '1px',\n * \t};\n * \tconst [ borders, setBorders ] = useState( {\n * \t\ttop: defaultBorder,\n * \t\tright: defaultBorder,\n * \t\tbottom: defaultBorder,\n * \t\tleft: defaultBorder,\n * \t} );\n * \tconst onChange = ( newBorders ) => setBorders( newBorders );\n *\n * \treturn (\n * \t\t<BorderBoxControl\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Borders' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ borders }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderBoxControl = contextConnect(UnconnectedBorderBoxControl, 'BorderBoxControl');\nexport default BorderBoxControl;"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,SAAS,gBAAgB;AAClC,SAAS,eAAe,oBAAoB;AAC5C,OAAO,kCAAkC;AACzC,OAAO,mCAAmC;AAC1C,SAAS,qBAAqB;AAC9B,OAAO,iBAAiB;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BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// packages/components/src/border-box-control/border-box-control/hook.ts
|
|
2
|
+
import clsx from "clsx";
|
|
2
3
|
import { useState } from "@wordpress/element";
|
|
3
4
|
|
|
4
5
|
// packages/style-runtime/src/index.ts
|
|
@@ -80,9 +81,9 @@ function registerStyle(hash, css) {
|
|
|
80
81
|
|
|
81
82
|
// packages/components/src/border-box-control/style.module.scss
|
|
82
83
|
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
83
|
-
registerStyle("
|
|
84
|
+
registerStyle("2eee37fabd", ".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}");
|
|
84
85
|
}
|
|
85
|
-
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
86
|
+
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "linked-border-control-full-width": "_6a6edeeb175d724f__linked-border-control-full-width", "header": "f5104488f80fa50f__header", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
86
87
|
|
|
87
88
|
// packages/components/src/border-box-control/border-box-control/hook.ts
|
|
88
89
|
import { getBorderDiff, getCommonBorder, getSplitBorders, hasMixedBorders, hasSplitBorders, isCompleteBorder, isEmptyBorder } from "../utils.mjs";
|
|
@@ -94,6 +95,8 @@ function useBorderBoxControl(props) {
|
|
|
94
95
|
onChange,
|
|
95
96
|
enableAlpha = false,
|
|
96
97
|
enableStyle = true,
|
|
98
|
+
hideLabelFromVision,
|
|
99
|
+
label,
|
|
97
100
|
value,
|
|
98
101
|
__experimentalIsRenderedInSidebar = false,
|
|
99
102
|
// Deprecated props, no longer used.
|
|
@@ -101,6 +104,7 @@ function useBorderBoxControl(props) {
|
|
|
101
104
|
__next40pxDefaultSize: _next40pxDefaultSize,
|
|
102
105
|
...otherProps
|
|
103
106
|
} = useContextSystem(props, "BorderBoxControl");
|
|
107
|
+
const hasVisibleLabel = !!label && !hideLabelFromVision;
|
|
104
108
|
const mixedBorders = hasMixedBorders(value);
|
|
105
109
|
const splitBorders = hasSplitBorders(value);
|
|
106
110
|
const linkedValue = splitBorders ? getCommonBorder(value) : value;
|
|
@@ -151,12 +155,19 @@ function useBorderBoxControl(props) {
|
|
|
151
155
|
onChange(newBorder);
|
|
152
156
|
}
|
|
153
157
|
};
|
|
154
|
-
const linkedControlClassName = style_module_default["linked-border-control"]
|
|
158
|
+
const linkedControlClassName = clsx(style_module_default["linked-border-control"], {
|
|
159
|
+
[style_module_default["linked-border-control-full-width"]]: hasVisibleLabel
|
|
160
|
+
});
|
|
155
161
|
const wrapperClassName = style_module_default.wrapper;
|
|
162
|
+
const headerClassName = style_module_default.header;
|
|
156
163
|
return {
|
|
157
164
|
...otherProps,
|
|
158
165
|
className,
|
|
159
166
|
colors,
|
|
167
|
+
hasVisibleLabel,
|
|
168
|
+
headerClassName,
|
|
169
|
+
hideLabelFromVision,
|
|
170
|
+
label,
|
|
160
171
|
disableUnits: mixedBorders && !hasWidthValue,
|
|
161
172
|
enableAlpha,
|
|
162
173
|
enableStyle,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/border-box-control/border-box-control/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/border-box-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["import { useState } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { getBorderDiff, getCommonBorder, getSplitBorders, hasMixedBorders, hasSplitBorders, isCompleteBorder, isEmptyBorder } from '../utils';\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControl(props) {\n const {\n className,\n colors = [],\n onChange,\n enableAlpha = false,\n enableStyle = true,\n value,\n __experimentalIsRenderedInSidebar = false,\n // Deprecated props, no longer used.\n size: _size,\n __next40pxDefaultSize: _next40pxDefaultSize,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControl');\n const mixedBorders = hasMixedBorders(value);\n const splitBorders = hasSplitBorders(value);\n const linkedValue = splitBorders ? getCommonBorder(value) : value;\n const splitValue = splitBorders ? value : getSplitBorders(value);\n\n // If no numeric width value is set, the unit select will be disabled.\n const hasWidthValue = !isNaN(parseFloat(`${linkedValue?.width}`));\n const [isLinked, setIsLinked] = useState(!mixedBorders);\n const toggleLinked = () => setIsLinked(!isLinked);\n const onLinkedChange = newBorder => {\n if (!newBorder) {\n return onChange(undefined);\n }\n\n // If we have all props defined on the new border apply it.\n if (!mixedBorders || isCompleteBorder(newBorder)) {\n return onChange(isEmptyBorder(newBorder) ? undefined : newBorder);\n }\n\n // If we had mixed borders we might have had some shared border props\n // that we need to maintain. For example; we could have mixed borders\n // with all the same color but different widths. Then from the linked\n // control we change the color. We should keep the separate widths.\n const changes = getBorderDiff(linkedValue, newBorder);\n const updatedBorders = {\n top: {\n ...value?.top,\n ...changes\n },\n right: {\n ...value?.right,\n ...changes\n },\n bottom: {\n ...value?.bottom,\n ...changes\n },\n left: {\n ...value?.left,\n ...changes\n }\n };\n if (hasMixedBorders(updatedBorders)) {\n return onChange(updatedBorders);\n }\n const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top;\n onChange(filteredResult);\n };\n const onSplitChange = (newBorder, side) => {\n const updatedBorders = {\n ...splitValue,\n [side]: newBorder\n };\n if (hasMixedBorders(updatedBorders)) {\n onChange(updatedBorders);\n } else {\n onChange(newBorder);\n }\n };\n const linkedControlClassName = styles['linked-border-control'];\n const wrapperClassName = styles.wrapper;\n return {\n ...otherProps,\n className,\n colors,\n disableUnits: mixedBorders && !hasWidthValue,\n enableAlpha,\n enableStyle,\n hasMixedBorders: mixedBorders,\n isLinked,\n linkedControlClassName,\n onLinkedChange,\n onSplitChange,\n toggleLinked,\n linkedValue,\n splitValue,\n wrapperClassName,\n __experimentalIsRenderedInSidebar\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"
|
|
5
|
-
"mappings": ";AAAA,SAAS,gBAAgB;;;
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { useState } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { getBorderDiff, getCommonBorder, getSplitBorders, hasMixedBorders, hasSplitBorders, isCompleteBorder, isEmptyBorder } from '../utils';\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControl(props) {\n const {\n className,\n colors = [],\n onChange,\n enableAlpha = false,\n enableStyle = true,\n hideLabelFromVision,\n label,\n value,\n __experimentalIsRenderedInSidebar = false,\n // Deprecated props, no longer used.\n size: _size,\n __next40pxDefaultSize: _next40pxDefaultSize,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControl');\n\n // A visible label gives the control a header row to place the linked/\n // unlinked toggle in, alongside that label. Without one the toggle stays\n // inside the input wrapper, positioned absolutely.\n const hasVisibleLabel = !!label && !hideLabelFromVision;\n const mixedBorders = hasMixedBorders(value);\n const splitBorders = hasSplitBorders(value);\n const linkedValue = splitBorders ? getCommonBorder(value) : value;\n const splitValue = splitBorders ? value : getSplitBorders(value);\n\n // If no numeric width value is set, the unit select will be disabled.\n const hasWidthValue = !isNaN(parseFloat(`${linkedValue?.width}`));\n const [isLinked, setIsLinked] = useState(!mixedBorders);\n const toggleLinked = () => setIsLinked(!isLinked);\n const onLinkedChange = newBorder => {\n if (!newBorder) {\n return onChange(undefined);\n }\n\n // If we have all props defined on the new border apply it.\n if (!mixedBorders || isCompleteBorder(newBorder)) {\n return onChange(isEmptyBorder(newBorder) ? undefined : newBorder);\n }\n\n // If we had mixed borders we might have had some shared border props\n // that we need to maintain. For example; we could have mixed borders\n // with all the same color but different widths. Then from the linked\n // control we change the color. We should keep the separate widths.\n const changes = getBorderDiff(linkedValue, newBorder);\n const updatedBorders = {\n top: {\n ...value?.top,\n ...changes\n },\n right: {\n ...value?.right,\n ...changes\n },\n bottom: {\n ...value?.bottom,\n ...changes\n },\n left: {\n ...value?.left,\n ...changes\n }\n };\n if (hasMixedBorders(updatedBorders)) {\n return onChange(updatedBorders);\n }\n const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top;\n onChange(filteredResult);\n };\n const onSplitChange = (newBorder, side) => {\n const updatedBorders = {\n ...splitValue,\n [side]: newBorder\n };\n if (hasMixedBorders(updatedBorders)) {\n onChange(updatedBorders);\n } else {\n onChange(newBorder);\n }\n };\n\n // The linked control reserves an inline-end gutter for the absolutely\n // positioned toggle. Once the toggle moves up into the header row that\n // gutter only shortens the input, so drop it.\n const linkedControlClassName = clsx(styles['linked-border-control'], {\n [styles['linked-border-control-full-width']]: hasVisibleLabel\n });\n const wrapperClassName = styles.wrapper;\n const headerClassName = styles.header;\n return {\n ...otherProps,\n className,\n colors,\n hasVisibleLabel,\n headerClassName,\n hideLabelFromVision,\n label,\n disableUnits: mixedBorders && !hasWidthValue,\n enableAlpha,\n enableStyle,\n hasMixedBorders: mixedBorders,\n isLinked,\n linkedControlClassName,\n onLinkedChange,\n onSplitChange,\n toggleLinked,\n linkedValue,\n splitValue,\n wrapperClassName,\n __experimentalIsRenderedInSidebar\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2eee37fabd\", \".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}\");\n}\nexport default {\"linked-border-control\":\"fa6e6c2331986855__linked-border-control\",\"linked-border-control-full-width\":\"_6a6edeeb175d724f__linked-border-control-full-width\",\"header\":\"f5104488f80fa50f__header\",\"wrapper\":\"_48f63719b9dc7e1a__wrapper\",\"linked-button\":\"_902e774d37b6698b__linked-button\",\"visualizer\":\"_5978f65e1d08de6c__visualizer\",\"split-controls\":\"afa8e78cec6a9f62__split-controls\",\"centered-border-control\":\"ec002fcdf4036950__centered-border-control\",\"right-border-control\":\"f9ea07d7127ab067__right-border-control\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACDzB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cA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L;AAAA,MACA,QAAQ;AAAA,QACN,GAAG,OAAO;AAAA,QACV,GAAG;AAAA,MACL;AAAA,MACA,MAAM;AAAA,QACJ,GAAG,OAAO;AAAA,QACV,GAAG;AAAA,MACL;AAAA,IACF;AACA,QAAI,gBAAgB,cAAc,GAAG;AACnC,aAAO,SAAS,cAAc;AAAA,IAChC;AACA,UAAM,iBAAiB,cAAc,eAAe,GAAG,IAAI,SAAY,eAAe;AACtF,aAAS,cAAc;AAAA,EACzB;AACA,QAAM,gBAAgB,CAAC,WAAW,SAAS;AACzC,UAAM,iBAAiB;AAAA,MACrB,GAAG;AAAA,MACH,CAAC,IAAI,GAAG;AAAA,IACV;AACA,QAAI,gBAAgB,cAAc,GAAG;AACnC,eAAS,cAAc;AAAA,IACzB,OAAO;AACL,eAAS,SAAS;AAAA,IACpB;AAAA,EACF;AAKA,QAAM,yBAAyB,KAAK,qBAAO,uBAAuB,GAAG;AAAA,IACnE,CAAC,qBAAO,kCAAkC,CAAC,GAAG;AAAA,EAChD,CAAC;AACD,QAAM,mBAAmB,qBAAO;AAChC,QAAM,kBAAkB,qBAAO;AAC/B,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,gBAAgB,CAAC;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -80,9 +80,9 @@ function registerStyle(hash, css) {
|
|
|
80
80
|
|
|
81
81
|
// packages/components/src/border-box-control/style.module.scss
|
|
82
82
|
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
83
|
-
registerStyle("
|
|
83
|
+
registerStyle("2eee37fabd", ".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}");
|
|
84
84
|
}
|
|
85
|
-
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
85
|
+
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "linked-border-control-full-width": "_6a6edeeb175d724f__linked-border-control-full-width", "header": "f5104488f80fa50f__header", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
86
86
|
|
|
87
87
|
// packages/components/src/border-box-control/border-box-control-linked-button/hook.ts
|
|
88
88
|
import { useContextSystem } from "../../context/index.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/border-box-control/border-box-control-linked-button/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/border-box-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport styles from '../style.module.scss';\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControlLinkedButton(props) {\n const {\n className,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlLinkedButton');\n return {\n ...otherProps,\n className: clsx(styles['linked-button'], className)\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"
|
|
5
|
-
"mappings": ";AAAA,OA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AQ,UAAU,IAAI,iBAAiB,QAAQ,UAAU,IAAI,cAAc,KAAK,KAAK,CAAC;AACtF,aAAW,CAAC,MAAM,GAAG,KAAK,QAAQ,QAAQ;AACxC,gBAAY,gBAAgB,MAAM,GAAG;AAAA,EACvC;AACA,SAAO,MAAM;AACX,UAAM,QAAQ,QAAQ,UAAU,IAAI,cAAc;AAClD,QAAI,UAAU,QAAW;AACvB;AAAA,IACF;AACA,QAAI,SAAS,GAAG;AACd,cAAQ,UAAU,OAAO,cAAc;AACvC;AAAA,IACF;AACA,YAAQ,UAAU,IAAI,gBAAgB,QAAQ,CAAC;AAAA,EACjD;AACF;AAaO,SAAS,cAAc,MAAM,KAAK;AACvC,QAAM,UAAU,WAAW;AAC3B,UAAQ,OAAO,IAAI,MAAM,GAAG;AAC5B,aAAW,kBAAkB,QAAQ,UAAU,KAAK,GAAG;AACrD,gBAAY,gBAAgB,MAAM,GAAG;AAAA,EACvC;AACF;;;AChIA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport styles from '../style.module.scss';\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControlLinkedButton(props) {\n const {\n className,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlLinkedButton');\n return {\n ...otherProps,\n className: clsx(styles['linked-button'], className)\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2eee37fabd\", \".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}\");\n}\nexport default {\"linked-border-control\":\"fa6e6c2331986855__linked-border-control\",\"linked-border-control-full-width\":\"_6a6edeeb175d724f__linked-border-control-full-width\",\"header\":\"f5104488f80fa50f__header\",\"wrapper\":\"_48f63719b9dc7e1a__wrapper\",\"linked-button\":\"_902e774d37b6698b__linked-button\",\"visualizer\":\"_5978f65e1d08de6c__visualizer\",\"split-controls\":\"afa8e78cec6a9f62__split-controls\",\"centered-border-control\":\"ec002fcdf4036950__centered-border-control\",\"right-border-control\":\"f9ea07d7127ab067__right-border-control\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;;;ACAjB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cAAc;AAC9D,MAAI,CAAC,gBAAgB;AACnB,qBAAiB,oBAAI,IAAI;AACzB,YAAQ,eAAe,IAAI,gBAAgB,cAAc;AAAA,EAC3D;AACA,MAAI,eAAe,IAAI,IAAI,GAAG;AAC5B;AAAA,EACF;AAKA,MAAI,0BAA0B,gBAAgB,IAAI,GAAG;AACnD,mBAAe,IAAI,IAAI;AACvB;AAAA,EACF;AACA,QAA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AAAA,IACL,GAAG;AAAA,IACH,WAAW,KAAK,qBAAO,eAAe,GAAG,SAAS;AAAA,EACpD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -80,9 +80,9 @@ function registerStyle(hash, css) {
|
|
|
80
80
|
|
|
81
81
|
// packages/components/src/border-box-control/style.module.scss
|
|
82
82
|
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
83
|
-
registerStyle("
|
|
83
|
+
registerStyle("2eee37fabd", ".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}");
|
|
84
84
|
}
|
|
85
|
-
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
85
|
+
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "linked-border-control-full-width": "_6a6edeeb175d724f__linked-border-control-full-width", "header": "f5104488f80fa50f__header", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
86
86
|
|
|
87
87
|
// packages/components/src/border-box-control/border-box-control-split-controls/hook.ts
|
|
88
88
|
import { useContextSystem } from "../../context/index.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/border-box-control/border-box-control-split-controls/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/border-box-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport styles from '../style.module.scss';\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControlSplitControls(props) {\n const {\n className,\n colors = [],\n enableAlpha = false,\n enableStyle = true,\n __experimentalIsRenderedInSidebar = false,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlSplitControls');\n return {\n ...otherProps,\n centeredClassName: clsx(styles['centered-border-control'], className),\n className: clsx(styles['split-controls'], className),\n colors,\n enableAlpha,\n enableStyle,\n rightAlignedClassName: clsx(styles['right-border-control'], className),\n __experimentalIsRenderedInSidebar\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;;;ACAjB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,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\nimport { useContextSystem } from '../../context';\nexport function useBorderBoxControlSplitControls(props) {\n const {\n className,\n colors = [],\n enableAlpha = false,\n enableStyle = true,\n __experimentalIsRenderedInSidebar = false,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlSplitControls');\n return {\n ...otherProps,\n centeredClassName: clsx(styles['centered-border-control'], className),\n className: clsx(styles['split-controls'], className),\n colors,\n enableAlpha,\n enableStyle,\n rightAlignedClassName: clsx(styles['right-border-control'], className),\n __experimentalIsRenderedInSidebar\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2eee37fabd\", \".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}\");\n}\nexport default {\"linked-border-control\":\"fa6e6c2331986855__linked-border-control\",\"linked-border-control-full-width\":\"_6a6edeeb175d724f__linked-border-control-full-width\",\"header\":\"f5104488f80fa50f__header\",\"wrapper\":\"_48f63719b9dc7e1a__wrapper\",\"linked-button\":\"_902e774d37b6698b__linked-button\",\"visualizer\":\"_5978f65e1d08de6c__visualizer\",\"split-controls\":\"afa8e78cec6a9f62__split-controls\",\"centered-border-control\":\"ec002fcdf4036950__centered-border-control\",\"right-border-control\":\"f9ea07d7127ab067__right-border-control\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;;;ACAjB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;A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AAAA,IACF;AACA,YAAQ,UAAU,IAAI,gBAAgB,QAAQ,CAAC;AAAA,EACjD;AACF;AAaO,SAAS,cAAc,MAAM,KAAK;AACvC,QAAM,UAAU,WAAW;AAC3B,UAAQ,OAAO,IAAI,MAAM,GAAG;AAC5B,aAAW,kBAAkB,QAAQ,UAAU,KAAK,GAAG;AACrD,gBAAY,gBAAgB,MAAM,GAAG;AAAA,EACvC;AACF;;;AChIA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,kjCAAkjC;AAC/kC;AACA,IAAO,uBAAQ,EAAC,yBAAwB,2CAA0C,oCAAmC,uDAAsD,UAAS,4BAA2B,WAAU,8BAA6B,iBAAgB,oCAAmC,cAAa,iCAAgC,kBAAiB,oCAAmC,2BAA0B,6CAA4C,wBAAuB,yCAAwC;;;AFF/gB,SAAS,wBAAwB;AAC1B,SAAS,iCAAiC,OAAO;AACtD,QAAM;AAAA,IACJ;AAAA,IACA,SAAS,CAAC;AAAA,IACV,cAAc;AAAA,IACd,cAAc;AAAA,IACd,oCAAoC;AAAA,IACpC,GAAG;AAAA,EACL,IAAI,iBAAiB,OAAO,+BAA+B;AAC3D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,mBAAmB,KAAK,qBAAO,yBAAyB,GAAG,SAAS;AAAA,IACpE,WAAW,KAAK,qBAAO,gBAAgB,GAAG,SAAS;AAAA,IACnD;AAAA,IACA;AAAA,IACA;AAAA,IACA,uBAAuB,KAAK,qBAAO,sBAAsB,GAAG,SAAS;AAAA,IACrE;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -80,9 +80,9 @@ function registerStyle(hash, css) {
|
|
|
80
80
|
|
|
81
81
|
// packages/components/src/border-box-control/style.module.scss
|
|
82
82
|
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
83
|
-
registerStyle("
|
|
83
|
+
registerStyle("2eee37fabd", ".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}");
|
|
84
84
|
}
|
|
85
|
-
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
85
|
+
var style_module_default = { "linked-border-control": "fa6e6c2331986855__linked-border-control", "linked-border-control-full-width": "_6a6edeeb175d724f__linked-border-control-full-width", "header": "f5104488f80fa50f__header", "wrapper": "_48f63719b9dc7e1a__wrapper", "linked-button": "_902e774d37b6698b__linked-button", "visualizer": "_5978f65e1d08de6c__visualizer", "split-controls": "afa8e78cec6a9f62__split-controls", "centered-border-control": "ec002fcdf4036950__centered-border-control", "right-border-control": "f9ea07d7127ab067__right-border-control" };
|
|
86
86
|
|
|
87
87
|
// packages/components/src/border-box-control/border-box-control-visualizer/hook.ts
|
|
88
88
|
import { COLORS, CONFIG } from "../../utils/index.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/border-box-control/border-box-control-visualizer/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/border-box-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport styles from '../style.module.scss';\nimport { COLORS, CONFIG } from '../../utils';\nimport { useContextSystem } from '../../context';\nconst borderBoxStyleWithFallback = border => {\n const {\n color = COLORS.gray[200],\n style = 'solid',\n width = CONFIG.borderWidth\n } = border || {};\n const clampedWidth = width !== CONFIG.borderWidth ? `clamp(1px, ${width}, 10px)` : width;\n const hasVisibleBorder = !!width && width !== '0' || !!color;\n const borderStyle = hasVisibleBorder ? style || 'solid' : style;\n return `${color} ${borderStyle} ${clampedWidth}`;\n};\nexport function useBorderBoxControlVisualizer(props) {\n const {\n className,\n style,\n value,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlVisualizer');\n return {\n ...otherProps,\n className: clsx(styles.visualizer, className),\n style: {\n ...style,\n '--wp-components-border-box-visualizer-top': borderBoxStyleWithFallback(value?.top),\n '--wp-components-border-box-visualizer-bottom': borderBoxStyleWithFallback(value?.bottom),\n // Logical properties map left/right to inline start/end for RTL.\n '--wp-components-border-box-visualizer-start': borderBoxStyleWithFallback(value?.left),\n '--wp-components-border-box-visualizer-end': borderBoxStyleWithFallback(value?.right)\n },\n value\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;;;ACAjB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,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["import clsx from 'clsx';\nimport styles from '../style.module.scss';\nimport { COLORS, CONFIG } from '../../utils';\nimport { useContextSystem } from '../../context';\nconst borderBoxStyleWithFallback = border => {\n const {\n color = COLORS.gray[200],\n style = 'solid',\n width = CONFIG.borderWidth\n } = border || {};\n const clampedWidth = width !== CONFIG.borderWidth ? `clamp(1px, ${width}, 10px)` : width;\n const hasVisibleBorder = !!width && width !== '0' || !!color;\n const borderStyle = hasVisibleBorder ? style || 'solid' : style;\n return `${color} ${borderStyle} ${clampedWidth}`;\n};\nexport function useBorderBoxControlVisualizer(props) {\n const {\n className,\n style,\n value,\n ...otherProps\n } = useContextSystem(props, 'BorderBoxControlVisualizer');\n return {\n ...otherProps,\n className: clsx(styles.visualizer, className),\n style: {\n ...style,\n '--wp-components-border-box-visualizer-top': borderBoxStyleWithFallback(value?.top),\n '--wp-components-border-box-visualizer-bottom': borderBoxStyleWithFallback(value?.bottom),\n // Logical properties map left/right to inline start/end for RTL.\n '--wp-components-border-box-visualizer-start': borderBoxStyleWithFallback(value?.left),\n '--wp-components-border-box-visualizer-end': borderBoxStyleWithFallback(value?.right)\n },\n value\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2eee37fabd\", \".fa6e6c2331986855__linked-border-control.fa6e6c2331986855__linked-border-control{flex:1;margin-inline-end:24px}._6a6edeeb175d724f__linked-border-control-full-width._6a6edeeb175d724f__linked-border-control-full-width{margin-inline-end:0}.f5104488f80fa50f__header{margin-bottom:4px}.f5104488f80fa50f__header>span{margin-bottom:0}._48f63719b9dc7e1a__wrapper{position:relative}._48f63719b9dc7e1a__wrapper ._902e774d37b6698b__linked-button{inset-inline-end:0;position:absolute;top:8px}._902e774d37b6698b__linked-button{line-height:0}._5978f65e1d08de6c__visualizer{border-bottom:var(--wp-components-border-box-visualizer-bottom);border-inline-end:var(--wp-components-border-box-visualizer-end);border-inline-start:var(--wp-components-border-box-visualizer-start);border-top:var(--wp-components-border-box-visualizer-top);bottom:20px;position:absolute;top:20px;inset-inline:39px}.afa8e78cec6a9f62__split-controls{flex:1;position:relative}.ec002fcdf4036950__centered-border-control{grid-column:span 2;margin:0 auto}.f9ea07d7127ab067__right-border-control{margin-inline-start:auto}\");\n}\nexport default {\"linked-border-control\":\"fa6e6c2331986855__linked-border-control\",\"linked-border-control-full-width\":\"_6a6edeeb175d724f__linked-border-control-full-width\",\"header\":\"f5104488f80fa50f__header\",\"wrapper\":\"_48f63719b9dc7e1a__wrapper\",\"linked-button\":\"_902e774d37b6698b__linked-button\",\"visualizer\":\"_5978f65e1d08de6c__visualizer\",\"split-controls\":\"afa8e78cec6a9f62__split-controls\",\"centered-border-control\":\"ec002fcdf4036950__centered-border-control\",\"right-border-control\":\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;AACvD,QAAM,cAAc,mBAAmB,SAAS,UAAU;AAC1D,SAAO,GAAG,KAAK,IAAI,WAAW,IAAI,YAAY;AAChD;AACO,SAAS,8BAA8B,OAAO;AACnD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,iBAAiB,OAAO,4BAA4B;AACxD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,KAAK,qBAAO,YAAY,SAAS;AAAA,IAC5C,OAAO;AAAA,MACL,GAAG;AAAA,MACH,6CAA6C,2BAA2B,OAAO,GAAG;AAAA,MAClF,gDAAgD,2BAA2B,OAAO,MAAM;AAAA;AAAA,MAExF,+CAA+C,2BAA2B,OAAO,IAAI;AAAA,MACrF,6CAA6C,2BAA2B,OAAO,KAAK;AAAA,IACtF;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -122,7 +122,7 @@ function SinglePalette({
|
|
|
122
122
|
return /* @__PURE__ */ _jsx(CircularOptionPicker.Option, {
|
|
123
123
|
isSelected,
|
|
124
124
|
selectedIconProps: isSelected ? {
|
|
125
|
-
|
|
125
|
+
color: colordColor.contrast() > colordColor.contrast("#000") ? "#fff" : "#000"
|
|
126
126
|
} : {},
|
|
127
127
|
tooltipText: name || // translators: %s: color hex code e.g: "#f00".
|
|
128
128
|
sprintf(__("Color code: %s"), color),
|