@wordpress/global-styles-ui 1.1.0 → 1.2.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/build/background-panel.js +5 -3
- package/build/background-panel.js.map +1 -1
- package/build/block-preview-panel.js +4 -2
- package/build/block-preview-panel.js.map +1 -1
- package/build/color-indicator-wrapper.js +3 -1
- package/build/color-indicator-wrapper.js.map +1 -1
- package/build/color-palette-panel.js +4 -2
- package/build/color-palette-panel.js.map +1 -1
- package/build/color-preview.js +3 -1
- package/build/color-preview.js.map +1 -1
- package/build/color-variations.js +3 -1
- package/build/color-variations.js.map +1 -1
- package/build/confirm-reset-shadow-dialog.js +3 -1
- package/build/confirm-reset-shadow-dialog.js.map +1 -1
- package/build/context.js +3 -1
- package/build/context.js.map +1 -1
- package/build/dimensions-panel.js +5 -3
- package/build/dimensions-panel.js.map +1 -1
- package/build/font-families.js +3 -1
- package/build/font-families.js.map +1 -1
- package/build/font-family-item.js +3 -1
- package/build/font-family-item.js.map +1 -1
- package/build/font-library-modal/collection-font-variant.js +3 -1
- package/build/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/font-library-modal/context.js +4 -2
- package/build/font-library-modal/context.js.map +1 -1
- package/build/font-library-modal/font-card.js +3 -1
- package/build/font-library-modal/font-card.js.map +1 -1
- package/build/font-library-modal/font-collection.js +6 -4
- package/build/font-library-modal/font-collection.js.map +2 -2
- package/build/font-library-modal/font-demo.js +3 -1
- package/build/font-library-modal/font-demo.js.map +1 -1
- package/build/font-library-modal/google-fonts-confirm-dialog.js +3 -1
- package/build/font-library-modal/google-fonts-confirm-dialog.js.map +2 -2
- package/build/font-library-modal/index.js +7 -5
- package/build/font-library-modal/index.js.map +1 -1
- package/build/font-library-modal/installed-fonts.js +3 -1
- package/build/font-library-modal/installed-fonts.js.map +1 -1
- package/build/font-library-modal/lib/inflate.js +2 -0
- package/build/font-library-modal/lib/inflate.js.map +1 -1
- package/build/font-library-modal/lib/lib-font.browser.d.js +4 -2
- package/build/font-library-modal/lib/lib-font.browser.d.js.map +1 -1
- package/build/font-library-modal/lib/lib-font.browser.js +345 -343
- package/build/font-library-modal/lib/lib-font.browser.js.map +1 -1
- package/build/font-library-modal/lib/unbrotli.js +2 -0
- package/build/font-library-modal/lib/unbrotli.js.map +1 -1
- package/build/font-library-modal/library-font-details.js +3 -1
- package/build/font-library-modal/library-font-details.js.map +1 -1
- package/build/font-library-modal/library-font-variant.js +3 -1
- package/build/font-library-modal/library-font-variant.js.map +1 -1
- package/build/font-library-modal/resolvers.js +4 -2
- package/build/font-library-modal/resolvers.js.map +2 -2
- package/build/font-library-modal/types.js +2 -0
- package/build/font-library-modal/types.js.map +1 -1
- package/build/font-library-modal/upload-fonts.js +3 -1
- package/build/font-library-modal/upload-fonts.js.map +2 -2
- package/build/font-library-modal/utils/constants.js +5 -3
- package/build/font-library-modal/utils/constants.js.map +1 -1
- package/build/font-library-modal/utils/filter-fonts.js +2 -0
- package/build/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build/font-library-modal/utils/fonts-outline.js +2 -0
- package/build/font-library-modal/utils/fonts-outline.js.map +1 -1
- package/build/font-library-modal/utils/index.js +4 -2
- package/build/font-library-modal/utils/index.js.map +2 -2
- package/build/font-library-modal/utils/make-families-from-faces.js +3 -1
- package/build/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build/font-library-modal/utils/preview-styles.js +2 -0
- package/build/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/font-library-modal/utils/set-immutably.js +2 -0
- package/build/font-library-modal/utils/set-immutably.js.map +1 -1
- package/build/font-library-modal/utils/sort-font-faces.js +2 -0
- package/build/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/font-library-modal/utils/toggleFont.js +2 -0
- package/build/font-library-modal/utils/toggleFont.js.map +1 -1
- package/build/font-sizes/confirm-delete-font-size-dialog.js +3 -1
- package/build/font-sizes/confirm-delete-font-size-dialog.js.map +1 -1
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js +3 -1
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -1
- package/build/font-sizes/font-size-preview.js +3 -1
- package/build/font-sizes/font-size-preview.js.map +1 -1
- package/build/font-sizes/font-size.js +4 -2
- package/build/font-sizes/font-size.js.map +1 -1
- package/build/font-sizes/font-sizes-count.js +3 -1
- package/build/font-sizes/font-sizes-count.js.map +1 -1
- package/build/font-sizes/font-sizes.js +4 -2
- package/build/font-sizes/font-sizes.js.map +1 -1
- package/build/font-sizes/rename-font-size-dialog.js +3 -1
- package/build/font-sizes/rename-font-size-dialog.js.map +1 -1
- package/build/global-styles-ui.js +43 -22
- package/build/global-styles-ui.js.map +2 -2
- package/build/gradients-palette-panel.js +5 -3
- package/build/gradients-palette-panel.js.map +1 -1
- package/build/highlighted-colors.js +3 -1
- package/build/highlighted-colors.js.map +1 -1
- package/build/hooks.js +4 -2
- package/build/hooks.js.map +1 -1
- package/build/icon-with-current-color.js +3 -1
- package/build/icon-with-current-color.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/navigation-button.js +3 -1
- package/build/navigation-button.js.map +1 -1
- package/build/pagination/index.js +3 -1
- package/build/pagination/index.js.map +1 -1
- package/build/palette.js +4 -2
- package/build/palette.js.map +1 -1
- package/build/preset-colors.js +3 -1
- package/build/preset-colors.js.map +1 -1
- package/build/preview-colors.js +5 -3
- package/build/preview-colors.js.map +1 -1
- package/build/preview-hooks.js +2 -0
- package/build/preview-hooks.js.map +1 -1
- package/build/preview-styles.js +6 -4
- package/build/preview-styles.js.map +1 -1
- package/build/preview-typography.js +4 -2
- package/build/preview-typography.js.map +1 -1
- package/build/preview-wrapper.js +6 -4
- package/build/preview-wrapper.js.map +1 -1
- package/build/provider.js +3 -1
- package/build/provider.js.map +1 -1
- package/build/root-menu.js +4 -2
- package/build/root-menu.js.map +1 -1
- package/build/screen-background.js +4 -2
- package/build/screen-background.js.map +1 -1
- package/build/screen-block-list.js +5 -3
- package/build/screen-block-list.js.map +2 -2
- package/build/screen-block.js +5 -3
- package/build/screen-block.js.map +1 -1
- package/build/screen-color-palette.js +4 -2
- package/build/screen-color-palette.js.map +1 -1
- package/build/screen-colors.js +4 -2
- package/build/screen-colors.js.map +1 -1
- package/build/screen-css.js +33 -25
- package/build/screen-css.js.map +2 -2
- package/build/screen-header.js +3 -1
- package/build/screen-header.js.map +1 -1
- package/build/screen-layout.js +4 -2
- package/build/screen-layout.js.map +1 -1
- package/build/screen-revisions/index.js +4 -2
- package/build/screen-revisions/index.js.map +1 -1
- package/build/screen-revisions/revisions-buttons.js +4 -2
- package/build/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/screen-revisions/types.js +2 -0
- package/build/screen-revisions/types.js.map +1 -1
- package/build/screen-revisions/use-global-styles-revisions.js +5 -3
- package/build/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/screen-root.js +6 -39
- package/build/screen-root.js.map +2 -2
- package/build/screen-shadows.js +3 -1
- package/build/screen-shadows.js.map +1 -1
- package/build/screen-style-variations.js +3 -1
- package/build/screen-style-variations.js.map +1 -1
- package/build/screen-typography-element.js +4 -2
- package/build/screen-typography-element.js.map +1 -1
- package/build/screen-typography.js +3 -1
- package/build/screen-typography.js.map +1 -1
- package/build/shadow-utils.js +3 -1
- package/build/shadow-utils.js.map +1 -1
- package/build/shadows-edit-panel.js +6 -4
- package/build/shadows-edit-panel.js.map +1 -1
- package/build/shadows-panel.js +5 -3
- package/build/shadows-panel.js.map +1 -1
- package/build/size-control/index.js +4 -2
- package/build/size-control/index.js.map +1 -1
- package/build/style-variations-container.js +3 -1
- package/build/style-variations-container.js.map +1 -1
- package/build/style-variations-content.js +3 -1
- package/build/style-variations-content.js.map +1 -1
- package/build/style-variations.js +3 -1
- package/build/style-variations.js.map +1 -1
- package/build/subtitle.js +3 -1
- package/build/subtitle.js.map +1 -1
- package/build/typography-elements.js +3 -1
- package/build/typography-elements.js.map +1 -1
- package/build/typography-example.js +3 -1
- package/build/typography-example.js.map +1 -1
- package/build/typography-panel.js +4 -2
- package/build/typography-panel.js.map +1 -1
- package/build/typography-preview.js +3 -1
- package/build/typography-preview.js.map +1 -1
- package/build/typography-variations.js +3 -1
- package/build/typography-variations.js.map +1 -1
- package/build/utils.js +3 -1
- package/build/utils.js.map +1 -1
- package/build/variations/variation.js +3 -1
- package/build/variations/variation.js.map +1 -1
- package/build/variations/variations-color.js +4 -2
- package/build/variations/variations-color.js.map +1 -1
- package/build/variations/variations-panel.js +3 -1
- package/build/variations/variations-panel.js.map +1 -1
- package/build/variations/variations-typography.js +4 -2
- package/build/variations/variations-typography.js.map +1 -1
- package/build/with-global-styles-provider.js +3 -1
- package/build/with-global-styles-provider.js.map +1 -1
- package/build-module/background-panel.js +4 -3
- package/build-module/background-panel.js.map +1 -1
- package/build-module/block-preview-panel.js +3 -2
- package/build-module/block-preview-panel.js.map +1 -1
- package/build-module/color-indicator-wrapper.js +2 -1
- package/build-module/color-indicator-wrapper.js.map +1 -1
- package/build-module/color-palette-panel.js +3 -2
- package/build-module/color-palette-panel.js.map +1 -1
- package/build-module/color-preview.js +2 -1
- package/build-module/color-preview.js.map +1 -1
- package/build-module/color-variations.js +2 -1
- package/build-module/color-variations.js.map +1 -1
- package/build-module/confirm-reset-shadow-dialog.js +2 -1
- package/build-module/confirm-reset-shadow-dialog.js.map +1 -1
- package/build-module/context.js +2 -1
- package/build-module/context.js.map +1 -1
- package/build-module/dimensions-panel.js +4 -3
- package/build-module/dimensions-panel.js.map +1 -1
- package/build-module/font-families.js +2 -1
- package/build-module/font-families.js.map +1 -1
- package/build-module/font-family-item.js +2 -1
- package/build-module/font-family-item.js.map +1 -1
- package/build-module/font-library-modal/collection-font-variant.js +2 -1
- package/build-module/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/font-library-modal/context.js +3 -2
- package/build-module/font-library-modal/context.js.map +1 -1
- package/build-module/font-library-modal/font-card.js +2 -1
- package/build-module/font-library-modal/font-card.js.map +1 -1
- package/build-module/font-library-modal/font-collection.js +5 -4
- package/build-module/font-library-modal/font-collection.js.map +2 -2
- package/build-module/font-library-modal/font-demo.js +2 -1
- package/build-module/font-library-modal/font-demo.js.map +1 -1
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js +2 -1
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js.map +2 -2
- package/build-module/font-library-modal/index.js +6 -5
- package/build-module/font-library-modal/index.js.map +1 -1
- package/build-module/font-library-modal/installed-fonts.js +2 -1
- package/build-module/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/font-library-modal/lib/inflate.js +11 -3
- package/build-module/font-library-modal/lib/inflate.js.map +1 -1
- package/build-module/font-library-modal/lib/lib-font.browser.d.js +3 -2
- package/build-module/font-library-modal/lib/lib-font.browser.d.js.map +1 -1
- package/build-module/font-library-modal/lib/lib-font.browser.js +344 -343
- package/build-module/font-library-modal/lib/lib-font.browser.js.map +1 -1
- package/build-module/font-library-modal/lib/unbrotli.js +11 -3
- package/build-module/font-library-modal/lib/unbrotli.js.map +1 -1
- package/build-module/font-library-modal/library-font-details.js +2 -1
- package/build-module/font-library-modal/library-font-details.js.map +1 -1
- package/build-module/font-library-modal/library-font-variant.js +2 -1
- package/build-module/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/font-library-modal/resolvers.js +3 -2
- package/build-module/font-library-modal/resolvers.js.map +2 -2
- package/build-module/font-library-modal/upload-fonts.js +2 -1
- package/build-module/font-library-modal/upload-fonts.js.map +2 -2
- package/build-module/font-library-modal/utils/constants.js +4 -3
- package/build-module/font-library-modal/utils/constants.js.map +1 -1
- package/build-module/font-library-modal/utils/filter-fonts.js +1 -0
- package/build-module/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build-module/font-library-modal/utils/fonts-outline.js +1 -0
- package/build-module/font-library-modal/utils/fonts-outline.js.map +1 -1
- package/build-module/font-library-modal/utils/index.js +3 -2
- package/build-module/font-library-modal/utils/index.js.map +2 -2
- package/build-module/font-library-modal/utils/make-families-from-faces.js +2 -1
- package/build-module/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build-module/font-library-modal/utils/preview-styles.js +1 -0
- package/build-module/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/font-library-modal/utils/set-immutably.js +1 -0
- package/build-module/font-library-modal/utils/set-immutably.js.map +1 -1
- package/build-module/font-library-modal/utils/sort-font-faces.js +1 -0
- package/build-module/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/font-library-modal/utils/toggleFont.js +1 -0
- package/build-module/font-library-modal/utils/toggleFont.js.map +1 -1
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js +2 -1
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js.map +1 -1
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js +2 -1
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -1
- package/build-module/font-sizes/font-size-preview.js +2 -1
- package/build-module/font-sizes/font-size-preview.js.map +1 -1
- package/build-module/font-sizes/font-size.js +3 -2
- package/build-module/font-sizes/font-size.js.map +1 -1
- package/build-module/font-sizes/font-sizes-count.js +2 -1
- package/build-module/font-sizes/font-sizes-count.js.map +1 -1
- package/build-module/font-sizes/font-sizes.js +3 -2
- package/build-module/font-sizes/font-sizes.js.map +1 -1
- package/build-module/font-sizes/rename-font-size-dialog.js +2 -1
- package/build-module/font-sizes/rename-font-size-dialog.js.map +1 -1
- package/build-module/global-styles-ui.js +42 -22
- package/build-module/global-styles-ui.js.map +2 -2
- package/build-module/gradients-palette-panel.js +4 -3
- package/build-module/gradients-palette-panel.js.map +1 -1
- package/build-module/highlighted-colors.js +2 -1
- package/build-module/highlighted-colors.js.map +1 -1
- package/build-module/hooks.js +3 -2
- package/build-module/hooks.js.map +1 -1
- package/build-module/icon-with-current-color.js +2 -1
- package/build-module/icon-with-current-color.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/navigation-button.js +2 -1
- package/build-module/navigation-button.js.map +1 -1
- package/build-module/pagination/index.js +2 -1
- package/build-module/pagination/index.js.map +1 -1
- package/build-module/palette.js +3 -2
- package/build-module/palette.js.map +1 -1
- package/build-module/preset-colors.js +2 -1
- package/build-module/preset-colors.js.map +1 -1
- package/build-module/preview-colors.js +4 -3
- package/build-module/preview-colors.js.map +1 -1
- package/build-module/preview-hooks.js +1 -0
- package/build-module/preview-hooks.js.map +1 -1
- package/build-module/preview-styles.js +5 -4
- package/build-module/preview-styles.js.map +1 -1
- package/build-module/preview-typography.js +3 -2
- package/build-module/preview-typography.js.map +1 -1
- package/build-module/preview-wrapper.js +5 -4
- package/build-module/preview-wrapper.js.map +1 -1
- package/build-module/provider.js +2 -1
- package/build-module/provider.js.map +1 -1
- package/build-module/root-menu.js +3 -2
- package/build-module/root-menu.js.map +1 -1
- package/build-module/screen-background.js +3 -2
- package/build-module/screen-background.js.map +1 -1
- package/build-module/screen-block-list.js +4 -3
- package/build-module/screen-block-list.js.map +2 -2
- package/build-module/screen-block.js +4 -3
- package/build-module/screen-block.js.map +1 -1
- package/build-module/screen-color-palette.js +3 -2
- package/build-module/screen-color-palette.js.map +1 -1
- package/build-module/screen-colors.js +3 -2
- package/build-module/screen-colors.js.map +1 -1
- package/build-module/screen-css.js +32 -25
- package/build-module/screen-css.js.map +2 -2
- package/build-module/screen-header.js +2 -1
- package/build-module/screen-header.js.map +1 -1
- package/build-module/screen-layout.js +3 -2
- package/build-module/screen-layout.js.map +1 -1
- package/build-module/screen-revisions/index.js +3 -2
- package/build-module/screen-revisions/index.js.map +1 -1
- package/build-module/screen-revisions/revisions-buttons.js +3 -2
- package/build-module/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/screen-revisions/use-global-styles-revisions.js +4 -3
- package/build-module/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/screen-root.js +5 -39
- package/build-module/screen-root.js.map +2 -2
- package/build-module/screen-shadows.js +2 -1
- package/build-module/screen-shadows.js.map +1 -1
- package/build-module/screen-style-variations.js +2 -1
- package/build-module/screen-style-variations.js.map +1 -1
- package/build-module/screen-typography-element.js +3 -2
- package/build-module/screen-typography-element.js.map +1 -1
- package/build-module/screen-typography.js +2 -1
- package/build-module/screen-typography.js.map +1 -1
- package/build-module/shadow-utils.js +2 -1
- package/build-module/shadow-utils.js.map +1 -1
- package/build-module/shadows-edit-panel.js +5 -4
- package/build-module/shadows-edit-panel.js.map +1 -1
- package/build-module/shadows-panel.js +4 -3
- package/build-module/shadows-panel.js.map +1 -1
- package/build-module/size-control/index.js +3 -2
- package/build-module/size-control/index.js.map +1 -1
- package/build-module/style-variations-container.js +2 -1
- package/build-module/style-variations-container.js.map +1 -1
- package/build-module/style-variations-content.js +2 -1
- package/build-module/style-variations-content.js.map +1 -1
- package/build-module/style-variations.js +2 -1
- package/build-module/style-variations.js.map +1 -1
- package/build-module/subtitle.js +2 -1
- package/build-module/subtitle.js.map +1 -1
- package/build-module/typography-elements.js +2 -1
- package/build-module/typography-elements.js.map +1 -1
- package/build-module/typography-example.js +2 -1
- package/build-module/typography-example.js.map +1 -1
- package/build-module/typography-panel.js +3 -2
- package/build-module/typography-panel.js.map +1 -1
- package/build-module/typography-preview.js +2 -1
- package/build-module/typography-preview.js.map +1 -1
- package/build-module/typography-variations.js +2 -1
- package/build-module/typography-variations.js.map +1 -1
- package/build-module/utils.js +2 -1
- package/build-module/utils.js.map +1 -1
- package/build-module/variations/variation.js +2 -1
- package/build-module/variations/variation.js.map +1 -1
- package/build-module/variations/variations-color.js +3 -2
- package/build-module/variations/variations-color.js.map +1 -1
- package/build-module/variations/variations-panel.js +2 -1
- package/build-module/variations/variations-panel.js.map +1 -1
- package/build-module/variations/variations-typography.js +3 -2
- package/build-module/variations/variations-typography.js.map +1 -1
- package/build-module/with-global-styles-provider.js +2 -1
- package/build-module/with-global-styles-provider.js.map +1 -1
- package/build-types/block-preview-panel.d.ts.map +1 -1
- package/build-types/font-library-modal/font-collection.d.ts.map +1 -1
- package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts.map +1 -1
- package/build-types/font-library-modal/resolvers.d.ts.map +1 -1
- package/build-types/font-library-modal/upload-fonts.d.ts.map +1 -1
- package/build-types/font-library-modal/utils/index.d.ts.map +1 -1
- package/build-types/global-styles-ui.d.ts.map +1 -1
- package/build-types/preview-colors.d.ts.map +1 -1
- package/build-types/preview-typography.d.ts.map +1 -1
- package/build-types/screen-block-list.d.ts.map +1 -1
- package/build-types/screen-css.d.ts.map +1 -1
- package/build-types/screen-root.d.ts.map +1 -1
- package/build-types/utils.d.ts.map +1 -1
- package/build-types/with-global-styles-provider.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/font-library-modal/font-collection.tsx +0 -1
- package/src/font-library-modal/google-fonts-confirm-dialog.tsx +0 -1
- package/src/font-library-modal/resolvers.tsx +0 -3
- package/src/font-library-modal/upload-fonts.tsx +0 -1
- package/src/font-library-modal/utils/index.ts +0 -2
- package/src/global-styles-ui.tsx +63 -42
- package/src/screen-block-list.tsx +0 -1
- package/src/screen-css.tsx +19 -13
- package/src/screen-root.tsx +4 -53
- package/tsconfig.tsbuildinfo +1 -1
package/build/hooks.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/hooks.ts
|
|
29
31
|
var hooks_exports = {};
|
|
30
32
|
__export(hooks_exports, {
|
|
31
33
|
useColorRandomizer: () => useColorRandomizer,
|
|
@@ -97,7 +99,7 @@ function useSetting(path, blockName, readFrom = "merged") {
|
|
|
97
99
|
);
|
|
98
100
|
return [settingValue, setSettingValue];
|
|
99
101
|
}
|
|
100
|
-
|
|
102
|
+
var EMPTY_ARRAY = [];
|
|
101
103
|
function hasThemeVariation({
|
|
102
104
|
title,
|
|
103
105
|
settings,
|
|
@@ -137,7 +139,7 @@ function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
|
|
|
137
139
|
return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
|
|
138
140
|
}, [properties, userVariation, variationsFromTheme]);
|
|
139
141
|
}
|
|
140
|
-
|
|
142
|
+
var propertiesToFilter = ["color"];
|
|
141
143
|
function useColorVariations() {
|
|
142
144
|
return useCurrentMergeThemeStyleVariationsWithUserConfig(
|
|
143
145
|
propertiesToFilter
|
package/build/hooks.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/hooks.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n\tmergeGlobalStyles,\n} from '@wordpress/global-styles-engine';\nimport type { StyleVariation, Color } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { GlobalStylesContext } from './context';\nimport { removePropertiesFromObject, isVariationWithProperties } from './utils';\n\n// Enable colord's a11y plugin.\nextend( [ a11yPlugin ] );\n\n/**\n * Hook to get and set style values with memoization.\n *\n * @param path The path to the style value.\n * @param blockName The name of the block, if applicable.\n * @param readFrom Which source to read from: \"base\" (theme), \"user\" (customizations), or \"merged\" (final result).\n * @param shouldDecodeEncode Whether to decode and encode the style value.\n * @return An array containing the style value and a function to set the style\n * value.\n *\n * @example\n * const [ color, setColor ] = useStyle<string>( 'color.text', 'core/button', 'merged' );\n */\nexport function useStyle< T = any >(\n\tpath: string,\n\tblockName?: string,\n\treadFrom: 'base' | 'user' | 'merged' = 'merged',\n\tshouldDecodeEncode: boolean = true\n) {\n\tconst { user, base, merged, onChange } = useContext( GlobalStylesContext );\n\n\tlet sourceValue = merged;\n\tif ( readFrom === 'base' ) {\n\t\tsourceValue = base;\n\t} else if ( readFrom === 'user' ) {\n\t\tsourceValue = user;\n\t}\n\n\tconst styleValue = useMemo(\n\t\t() => getStyle< T >( sourceValue, path, blockName, shouldDecodeEncode ),\n\t\t[ sourceValue, path, blockName, shouldDecodeEncode ]\n\t);\n\n\tconst setStyleValue = useCallback(\n\t\t( newValue: T | undefined ) => {\n\t\t\tconst newGlobalStyles = setStyle< T >(\n\t\t\t\tuser,\n\t\t\t\tpath,\n\t\t\t\tnewValue,\n\t\t\t\tblockName\n\t\t\t);\n\t\t\tonChange( newGlobalStyles );\n\t\t},\n\t\t[ user, onChange, path, blockName ]\n\t);\n\n\treturn [ styleValue, setStyleValue ] as const;\n}\n\n/**\n * Hook to get and set setting values with memoization.\n *\n * @param path The path to the setting value.\n * @param blockName The name of the block, if applicable.\n * @param readFrom Which source to read from: \"base\" (theme), \"user\" (customizations), or \"merged\" (final result).\n * @return An array containing the setting value and a function to set the\n * setting value.\n *\n * @example\n * const [ fontSize, setFontSize ] = useSetting<string>( 'fontSize', 'core/button', 'merged' );\n */\nexport function useSetting< T = any >(\n\tpath: string,\n\tblockName?: string,\n\treadFrom: 'base' | 'user' | 'merged' = 'merged'\n) {\n\tconst { user, base, merged, onChange } = useContext( GlobalStylesContext );\n\n\tlet sourceValue = merged;\n\tif ( readFrom === 'base' ) {\n\t\tsourceValue = base;\n\t} else if ( readFrom === 'user' ) {\n\t\tsourceValue = user;\n\t}\n\tconst settingValue = useMemo(\n\t\t() => getSetting< T >( sourceValue, path, blockName ),\n\t\t[ sourceValue, path, blockName ]\n\t);\n\n\tconst setSettingValue = useCallback(\n\t\t( newValue: T | undefined ) => {\n\t\t\tconst newGlobalStyles = setSetting< T >(\n\t\t\t\tuser,\n\t\t\t\tpath,\n\t\t\t\tnewValue,\n\t\t\t\tblockName\n\t\t\t);\n\t\t\tonChange( newGlobalStyles );\n\t\t},\n\t\t[ user, onChange, path, blockName ]\n\t);\n\n\treturn [ settingValue, setSettingValue ] as const;\n}\n\nconst EMPTY_ARRAY: StyleVariation[] = [];\n\n/**\n * Checks whether a style variation is empty.\n * @param root0\n * @param root0.title\n * @param root0.settings\n * @param root0.styles\n */\nfunction hasThemeVariation( {\n\ttitle,\n\tsettings,\n\tstyles,\n}: StyleVariation ): boolean {\n\treturn (\n\t\ttitle === __( 'Default' ) ||\n\t\tObject.keys( settings || {} ).length > 0 ||\n\t\tObject.keys( styles || {} ).length > 0\n\t);\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified properties\n * and merges them with the user config.\n * @param properties\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig(\n\tproperties: string[] = []\n): StyleVariation[] {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations?.();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || EMPTY_ARRAY,\n\t\t};\n\t}, [] );\n\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\treturn useMemo( () => {\n\t\t// Create default variation from base, not user - this fixes the \"Default adapts\" issue\n\t\tconst clonedUserVariation = structuredClone( userVariation );\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperties = removePropertiesFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperties\n\t\t);\n\t\tuserVariationWithoutProperties.title = __( 'Default' );\n\n\t\tconst variationsWithPropertiesAndBase = (\n\t\t\tvariationsFromTheme as StyleVariation[]\n\t\t )\n\t\t\t.filter( ( variation: StyleVariation ) => {\n\t\t\t\treturn isVariationWithProperties( variation, properties );\n\t\t\t} )\n\t\t\t.map( ( variation: StyleVariation ) => {\n\t\t\t\treturn mergeGlobalStyles(\n\t\t\t\t\tuserVariationWithoutProperties,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\tconst variationsByProperties = [\n\t\t\tuserVariationWithoutProperties,\n\t\t\t...variationsWithPropertiesAndBase,\n\t\t];\n\n\t\treturn variationsByProperties?.length\n\t\t\t? variationsByProperties.filter( hasThemeVariation )\n\t\t\t: [];\n\t}, [ properties, userVariation, variationsFromTheme ] );\n}\n\nconst propertiesToFilter = [ 'color' ];\n\n/**\n * Hook to get color variations using the full Gutenberg implementation.\n */\nexport function useColorVariations(): StyleVariation[] {\n\treturn useCurrentMergeThemeStyleVariationsWithUserConfig(\n\t\tpropertiesToFilter\n\t);\n}\n\n/**\n * Hook to randomize theme colors using color rotation.\n *\n * @param blockName The name of the block, if applicable.\n * @return Array containing the randomize function if feature is enabled, empty array otherwise.\n */\nexport function useColorRandomizer( blockName?: string ): [ () => void ] | [] {\n\tconst [ themeColors, setThemeColors ] = useSetting< Color[] >(\n\t\t'color.palette.theme',\n\t\tblockName\n\t);\n\n\tconst randomizeColors = useCallback( () => {\n\t\tif ( ! themeColors || ! themeColors.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst randomRotationValue = Math.floor( Math.random() * 225 );\n\n\t\tconst newColors = themeColors.map( ( colorObject ) => {\n\t\t\tconst { color } = colorObject;\n\t\t\tconst newColor = colord( color )\n\t\t\t\t.rotate( randomRotationValue )\n\t\t\t\t.toHex();\n\n\t\t\treturn {\n\t\t\t\t...colorObject,\n\t\t\t\tcolor: newColor,\n\t\t\t};\n\t\t} );\n\n\t\tsetThemeColors( newColors );\n\t}, [ themeColors, setThemeColors ] );\n\n\treturn ( window as any ).__experimentalEnableColorRandomizer\n\t\t? [ randomizeColors ]\n\t\t: [];\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;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AAE,OAAQ;AAK9B,SAAS,qBAAuC;AACtD,SAAO;AAAA,IACN;AAAA,EACD;AACD;AAQO,SAAS,mBAAoB,WAA0C;AAC7E,QAAM,CAAE,aAAa,cAAe,IAAI;AAAA,IACvC;AAAA,IACA;AAAA,EACD;AAEA,QAAM,sBAAkB,4BAAa,MAAM;AAC1C,QAAK,CAAE,eAAe,CAAE,YAAY,QAAS;AAC5C;AAAA,IACD;AAEA,UAAM,sBAAsB,KAAK,MAAO,KAAK,OAAO,IAAI,GAAI;AAE5D,UAAM,YAAY,YAAY,IAAK,CAAE,gBAAiB;AACrD,YAAM,EAAE,MAAM,IAAI;AAClB,YAAM,eAAW,sBAAQ,KAAM,EAC7B,OAAQ,mBAAoB,EAC5B,MAAM;AAER,aAAO;AAAA,QACN,GAAG;AAAA,QACH,OAAO;AAAA,MACR;AAAA,IACD,CAAE;AAEF,mBAAgB,SAAU;AAAA,EAC3B,GAAG,CAAE,aAAa,cAAe,CAAE;AAEnC,SAAS,OAAgB,sCACtB,CAAE,eAAgB,IAClB,CAAC;AACL;",
|
|
6
6
|
"names": ["a11yPlugin", "coreStore"]
|
|
7
7
|
}
|
|
@@ -26,14 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/icon-with-current-color.tsx
|
|
29
31
|
var icon_with_current_color_exports = {};
|
|
30
32
|
__export(icon_with_current_color_exports, {
|
|
31
33
|
IconWithCurrentColor: () => IconWithCurrentColor
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(icon_with_current_color_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_clsx = __toESM(require("clsx"));
|
|
36
37
|
var import_icons = require("@wordpress/icons");
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
39
|
function IconWithCurrentColor({
|
|
38
40
|
className,
|
|
39
41
|
...props
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/icon-with-current-color.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/icons';\n\ninterface IconWithCurrentColorProps {\n\ticon: any;\n\tclassName?: string;\n\tsize?: number;\n\t[ key: string ]: any;\n}\n\nexport function IconWithCurrentColor( {\n\tclassName,\n\t...props\n}: IconWithCurrentColorProps ) {\n\treturn (\n\t\t<Icon\n\t\t\tclassName={ clsx(\n\t\t\t\tclassName,\n\t\t\t\t'global-styles-ui-icon-with-current-color'\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,mBAAqB;AAcnB;AALK,SAAS,qBAAsB;AAAA,EACrC;AAAA,EACA,GAAG;AACJ,GAA+B;AAC9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAY,YAAAA;AAAA,QACX;AAAA,QACA;AAAA,MACD;AAAA,MACE,GAAG;AAAA;AAAA,EACN;AAEF;",
|
|
6
6
|
"names": ["clsx"]
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/index.ts
|
|
29
31
|
var index_exports = {};
|
|
30
32
|
__export(index_exports, {
|
|
31
33
|
ColorVariations: () => import_color_variations.ColorVariations,
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export { GlobalStylesUI } from './global-styles-ui';\nexport { StyleVariations } from './style-variations';\nexport { ColorVariations } from './color-variations';\nexport { TypographyVariations } from './typography-variations';\n\n// Ideally this should just be a core-data selector.\nexport { default as useGlobalStylesRevisions } from './screen-revisions/use-global-styles-revisions';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA+B;AAC/B,8BAAgC;AAChC,8BAAgC;AAChC,mCAAqC;AAGrC,yCAAoD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/lock-unlock.ts
|
|
19
21
|
var lock_unlock_exports = {};
|
|
20
22
|
__export(lock_unlock_exports, {
|
|
21
23
|
lock: () => lock,
|
|
@@ -23,7 +25,7 @@ __export(lock_unlock_exports, {
|
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(lock_unlock_exports);
|
|
25
27
|
var import_private_apis = require("@wordpress/private-apis");
|
|
26
|
-
|
|
28
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
27
29
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
28
30
|
"@wordpress/global-styles-ui"
|
|
29
31
|
);
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/global-styles-ui'\n\t);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,15 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/navigation-button.tsx
|
|
19
21
|
var navigation_button_exports = {};
|
|
20
22
|
__export(navigation_button_exports, {
|
|
21
23
|
NavigationBackButtonAsItem: () => NavigationBackButtonAsItem,
|
|
22
24
|
NavigationButtonAsItem: () => NavigationButtonAsItem
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(navigation_button_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
27
|
var import_components = require("@wordpress/components");
|
|
27
28
|
var import_icon_with_current_color = require("./icon-with-current-color");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
30
|
function GenericNavigationButton({
|
|
29
31
|
icon,
|
|
30
32
|
children,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/navigation-button.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tNavigator,\n\t__experimentalItem as Item,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\n\ninterface GenericNavigationButtonProps {\n\ticon?: any;\n\tchildren: React.ReactNode;\n\t[ key: string ]: any;\n}\n\nfunction GenericNavigationButton( {\n\ticon,\n\tchildren,\n\t...props\n}: GenericNavigationButtonProps ) {\n\treturn (\n\t\t<Item { ...props }>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ icon } size={ 24 } />\n\t\t\t\t\t<FlexItem>{ children }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n\ninterface NavigationButtonProps {\n\tpath: string;\n\ticon?: any;\n\tchildren: React.ReactNode;\n\t[ key: string ]: any;\n}\n\nexport function NavigationButtonAsItem( props: NavigationButtonProps ) {\n\treturn <Navigator.Button as={ GenericNavigationButton } { ...props } />;\n}\n\nexport function NavigationBackButtonAsItem( props: NavigationButtonProps ) {\n\treturn <Navigator.BackButton as={ GenericNavigationButton } { ...props } />;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AAKP,qCAAqC;AAgBjC;AARJ,SAAS,wBAAyB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAkC;AACjC,SACC,6CAAC,kBAAAA,oBAAA,EAAO,GAAG,OACR;AAAA,YACD,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,cACf;AAAA,kDAAC,uDAAqB,MAAc,MAAO,IAAK;AAAA,MAChD,4CAAC,8BAAW,UAAU;AAAA,OACvB;AAAA,IAEC,CAAE,QAAQ;AAAA,KACb;AAEF;AASO,SAAS,uBAAwB,OAA+B;AACtE,SAAO,4CAAC,4BAAU,QAAV,EAAiB,IAAK,yBAA4B,GAAG,OAAQ;AACtE;AAEO,SAAS,2BAA4B,OAA+B;AAC1E,SAAO,4CAAC,4BAAU,YAAV,EAAqB,IAAK,yBAA4B,GAAG,OAAQ;AAC1E;",
|
|
6
6
|
"names": ["Item", "HStack"]
|
|
7
7
|
}
|
|
@@ -26,16 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/pagination/index.tsx
|
|
29
31
|
var pagination_exports = {};
|
|
30
32
|
__export(pagination_exports, {
|
|
31
33
|
default: () => Pagination
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(pagination_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_clsx = __toESM(require("clsx"));
|
|
36
37
|
var import_components = require("@wordpress/components");
|
|
37
38
|
var import_i18n = require("@wordpress/i18n");
|
|
38
39
|
var import_icons = require("@wordpress/icons");
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
41
|
function Pagination({
|
|
40
42
|
currentPage,
|
|
41
43
|
numPages,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pagination/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { previous, chevronLeft, chevronRight, next } from '@wordpress/icons';\n\ninterface PaginationProps {\n\tcurrentPage: number;\n\tnumPages: number;\n\tchangePage: ( page: number ) => void;\n\ttotalItems: number;\n\tclassName?: string;\n\tdisabled?: boolean;\n\tbuttonVariant?: 'primary' | 'secondary' | 'tertiary';\n\tlabel?: string;\n}\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n\tclassName,\n\tdisabled = false,\n\tbuttonVariant = 'tertiary',\n\tlabel = __( 'Pagination' ),\n}: PaginationProps ) {\n\treturn (\n\t\t<HStack\n\t\t\texpanded={ false }\n\t\t\tas=\"nav\"\n\t\t\taria-label={ label }\n\t\t\tspacing={ 3 }\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'global-styles-ui-pagination', className ) }\n\t\t>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tclassName=\"global-styles-ui-pagination__total\"\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %d: Total number of patterns.\n\t\t\t\t\t_n( '%d item', '%d items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === 1 }\n\t\t\t\t\tlabel={ __( 'First page' ) }\n\t\t\t\t\ticon={ isRTL() ? next : previous }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === 1 }\n\t\t\t\t\tlabel={ __( 'Previous page' ) }\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: 1: Current page number. 2: Total number of pages.\n\t\t\t\t\t_x( '%1$d of %2$d', 'paging' ),\n\t\t\t\t\tcurrentPage,\n\t\t\t\t\tnumPages\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === numPages }\n\t\t\t\t\tlabel={ __( 'Next page' ) }\n\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tvariant={ buttonVariant }\n\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ disabled || currentPage === numPages }\n\t\t\t\t\tlabel={ __( 'Last page' ) }\n\t\t\t\t\ticon={ isRTL() ? previous : next }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAIO;AACP,kBAA2C;AAC3C,mBAA0D;AAgCvD;AAnBY,SAAR,WAA6B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,YAAQ,gBAAI,YAAa;AAC1B,GAAqB;AACpB,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,UAAW;AAAA,MACX,IAAG;AAAA,MACH,cAAa;A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B,MAAK;AAAA;AAAA,UACN;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,SAAU;AAAA,cACV,SAAU,MAAM,WAAY,QAAS;AAAA,cACrC,wBAAsB;AAAA,cACtB,UAAW,YAAY,gBAAgB;AAAA,cACvC,WAAQ,gBAAI,WAAY;AAAA,cACxB,UAAO,mBAAM,IAAI,wBAAW;AAAA,cAC5B,MAAK;AAAA;AAAA,UACN;AAAA,WACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["HStack", "clsx", "Text"]
|
|
7
7
|
}
|
package/build/palette.js
CHANGED
|
@@ -26,12 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/palette.tsx
|
|
29
31
|
var palette_exports = {};
|
|
30
32
|
__export(palette_exports, {
|
|
31
33
|
default: () => palette_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(palette_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_components = require("@wordpress/components");
|
|
36
37
|
var import_i18n = require("@wordpress/i18n");
|
|
37
38
|
var import_icons = require("@wordpress/icons");
|
|
@@ -40,7 +41,8 @@ var import_subtitle = require("./subtitle");
|
|
|
40
41
|
var import_navigation_button = require("./navigation-button");
|
|
41
42
|
var import_color_indicator_wrapper = __toESM(require("./color-indicator-wrapper"));
|
|
42
43
|
var import_hooks = require("./hooks");
|
|
43
|
-
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var EMPTY_COLORS = [];
|
|
44
46
|
function Palette({ name }) {
|
|
45
47
|
const [customColors] = (0, import_hooks.useSetting)("color.palette.custom");
|
|
46
48
|
const [themeColors] = (0, import_hooks.useSetting)("color.palette.theme");
|
package/build/palette.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/palette.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tColorIndicator,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { Icon, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport type { Color } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { Subtitle } from './subtitle';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\nimport { useSetting } from './hooks';\n\nconst EMPTY_COLORS: Color[] = [];\n\ninterface PaletteProps {\n\tname?: string;\n}\n\nfunction Palette( { name }: PaletteProps ) {\n\tconst [ customColors ] = useSetting< Color[] >( 'color.palette.custom' );\n\tconst [ themeColors ] = useSetting< Color[] >( 'color.palette.theme' );\n\tconst [ defaultColors ] = useSetting< Color[] >( 'color.palette.default' );\n\tconst [ defaultPaletteEnabled ] = useSetting< boolean >(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\n\tconst safeCustomColors = customColors || EMPTY_COLORS;\n\tconst safeThemeColors = themeColors || EMPTY_COLORS;\n\tconst safeDefaultColors = defaultColors || EMPTY_COLORS;\n\tconst safeDefaultPaletteEnabled = defaultPaletteEnabled ?? true;\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...safeCustomColors,\n\t\t\t...safeThemeColors,\n\t\t\t...( safeDefaultColors && safeDefaultPaletteEnabled\n\t\t\t\t? safeDefaultColors\n\t\t\t\t: EMPTY_COLORS ),\n\t\t],\n\t\t[\n\t\t\tsafeCustomColors,\n\t\t\tsafeThemeColors,\n\t\t\tsafeDefaultColors,\n\t\t\tsafeDefaultPaletteEnabled,\n\t\t]\n\t);\n\n\tconst screenPath = ! name\n\t\t? '/colors/palette'\n\t\t: '/blocks/' + encodeURIComponent( name ) + '/colors/palette';\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle level={ 3 }>{ __( 'Palette' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<NavigationButtonAsItem path={ screenPath }>\n\t\t\t\t\t<HStack direction=\"row\">\n\t\t\t\t\t\t{ colors.length > 0 ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t\t\t{ colors\n\t\t\t\t\t\t\t\t\t\t.slice( 0, 5 )\n\t\t\t\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ColorIndicatorWrapper\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t\t\t{ __( 'Edit palette' ) }\n\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<FlexItem>{ __( 'Add colors' ) }</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Icon icon={ isRTL() ? chevronLeft : chevronRight } />\n\t\t\t\t\t</HStack>\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nexport default Pal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CAAE,EACZ,IAAK,CAAE,EAAE,MAAM,GAAG,UAClB;AAAA,UAAC,+BAAAC;AAAA,UAAA;AAAA,YAGA;AAAA,cAAC;AAAA;AAAA,gBACA,YAAa;AAAA;AAAA,YACd;AAAA;AAAA,UAJM,GAAI,KAAM,IAAK,KAAM;AAAA,QAK5B,CACC,GACJ;AAAA,QACA,4CAAC,8BAAS,SAAO,MACd,8BAAI,cAAe,GACtB;AAAA,SACD,IAEA,4CAAC,8BAAW,8BAAI,YAAa,GAAG;AAAA,MAEjC,4CAAC,qBAAK,UAAO,mBAAM,IAAI,2BAAc,2BAAe;AAAA,OACrD,GACD,GACD;AAAA,KACD;AAEF;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": ["VStack", "ItemGroup", "HStack", "ZStack", "ColorIndicatorWrapper"]
|
|
7
7
|
}
|
package/build/preset-colors.js
CHANGED
|
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/preset-colors.tsx
|
|
19
21
|
var preset_colors_exports = {};
|
|
20
22
|
__export(preset_colors_exports, {
|
|
21
23
|
default: () => PresetColors
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(preset_colors_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_preview_hooks = require("./preview-hooks");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
28
|
function PresetColors() {
|
|
27
29
|
const { paletteColors } = (0, import_preview_hooks.useStylesPreviewColors)();
|
|
28
30
|
return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preset-colors.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { useStylesPreviewColors } from './preview-hooks';\n\nexport default function PresetColors() {\n\tconst { paletteColors } = useStylesPreviewColors();\n\treturn paletteColors.slice( 0, 4 ).map( ( { slug, color }, index ) => (\n\t\t<div\n\t\t\tkey={ `${ slug }-${ index }` }\n\t\t\tstyle={ {\n\t\t\t\tflexGrow: 1,\n\t\t\t\theight: '100%',\n\t\t\t\tbackground: color,\n\t\t\t} }\n\t\t/>\n\t) );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAAuC;AAKrC;AAHa,SAAR,eAAgC;AACtC,QAAM,EAAE,cAAc,QAAI,6CAAuB;AACjD,SAAO,cAAc,MAAO,GAAG,CAAE,EAAE,IAAK,CAAE,EAAE,MAAM,MAAM,GAAG,UAC1D;AAAA,IAAC;AAAA;AAAA,MAEA,OAAQ;AAAA,QACP,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,YAAY;AAAA,MACb;AAAA;AAAA,IALM,GAAI,IAAK,IAAK,KAAM;AAAA,EAM3B,CACC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/preview-colors.js
CHANGED
|
@@ -26,16 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/preview-colors.tsx
|
|
29
31
|
var preview_colors_exports = {};
|
|
30
32
|
__export(preview_colors_exports, {
|
|
31
33
|
default: () => preview_colors_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(preview_colors_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_components = require("@wordpress/components");
|
|
36
37
|
var import_preset_colors = __toESM(require("./preset-colors"));
|
|
37
38
|
var import_preview_wrapper = __toESM(require("./preview-wrapper"));
|
|
38
|
-
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var firstFrameVariants = {
|
|
39
41
|
start: {
|
|
40
42
|
scale: 1,
|
|
41
43
|
opacity: 1
|
|
@@ -45,7 +47,7 @@ const firstFrameVariants = {
|
|
|
45
47
|
opacity: 0
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
|
-
|
|
50
|
+
var StylesPreviewColors = ({
|
|
49
51
|
label,
|
|
50
52
|
isFocused,
|
|
51
53
|
withHoverView
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-colors.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PresetColors from './preset-colors';\nimport PreviewWrapper from './preview-wrapper';\n\nconst firstFrameVariants = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\ninterface StylesPreviewColorsProps {\n\tlabel?: string;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n}\n\nconst StylesPreviewColors = ( {\n\tlabel,\n\tisFocused,\n\twithHoverView,\n}: StylesPreviewColorsProps ) => {\n\treturn (\n\t\t<PreviewWrapper\n\t\t\tlabel={ label }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ firstFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PresetColors />\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</PreviewWrapper>\n\t);\n};\n\nexport default StylesPreviewColors;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AAKP,2BAAyB;AACzB,6BAA2B;AA+CrB;AA7CN,IAAM,qBAAqB;AAAA,EAC1B,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AACD;AAQA,IAAM,sBAAsB,CAAE;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACD,MAAiC;AAChC,SACC;AAAA,IAAC,uBAAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEE,WAAE,EAAE,IAAI,MACT;AAAA,QAAC,kBAAAC,iBAAO;AAAA,QAAP;AAAA,UAEA,UAAW;AAAA,UACX,OAAQ;AAAA,YACP,QAAQ;AAAA,YACR,UAAU;AAAA,UACX;AAAA,UAEA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACA,SAAU;AAAA,cACV,SAAQ;AAAA,cACR,OAAQ;AAAA,gBACP,QAAQ;AAAA,gBACR,UAAU;AAAA,cACX;AAAA,cAEA,sDAAC,qBAAAC,SAAA,EAAa;AAAA;AAAA,UACf;AAAA;AAAA,QAhBM;AAAA,MAiBP;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": ["PreviewWrapper", "motion", "HStack", "PresetColors"]
|
|
7
7
|
}
|
package/build/preview-hooks.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/preview-hooks.tsx
|
|
19
21
|
var preview_hooks_exports = {};
|
|
20
22
|
__export(preview_hooks_exports, {
|
|
21
23
|
useStylesPreviewColors: () => useStylesPreviewColors
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-hooks.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Color } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { useSetting, useStyle } from './hooks';\n\nexport function useStylesPreviewColors(): {\n\tpaletteColors: Color[];\n\thighlightedColors: Color[];\n} {\n\tconst [ textColor = 'black' ] = useStyle< string >( 'color.text' );\n\tconst [ backgroundColor = 'white' ] =\n\t\tuseStyle< string >( 'color.background' );\n\tconst [ headingColor = textColor ] = useStyle< string >(\n\t\t'elements.h1.color.text'\n\t);\n\tconst [ linkColor = headingColor ] = useStyle< string >(\n\t\t'elements.link.color.text'\n\t);\n\tconst [ buttonBackgroundColor = linkColor ] = useStyle< string >(\n\t\t'elements.button.color.background'\n\t);\n\n\tconst [ coreColors ] = useSetting< Color[] >( 'color.palette.core' ) || [];\n\tconst [ themeColors ] =\n\t\tuseSetting< Color[] >( 'color.palette.theme' ) || [];\n\tconst [ customColors ] =\n\t\tuseSetting< Color[] >( 'color.palette.custom' ) || [];\n\n\tconst paletteColors: Color[] = ( themeColors ?? [] )\n\t\t.concat( customColors ?? [] )\n\t\t.concat( coreColors ?? [] );\n\n\tconst textColorObject = paletteColors.filter(\n\t\t( { color } ) => color === textColor\n\t);\n\tconst buttonBackgroundColorObject = paletteColors.filter(\n\t\t( { color } ) => color === buttonBackgroundColor\n\t);\n\n\tconst highlightedColors = textColorObject\n\t\t.concat( buttonBackgroundColorObject )\n\t\t.concat( paletteColors )\n\t\t.filter(\n\t\t\t// we exclude these background color because it is already visible in the preview.\n\t\t\t( { color } ) => color !== backgroundColor\n\t\t)\n\t\t.slice( 0, 2 );\n\n\treturn {\n\t\tpaletteColors,\n\t\thighlightedColors,\n\t};\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,mBAAqC;AAE9B,SAAS,yBAGd;AACD,QAAM,CAAE,YAAY,OAAQ,QAAI,uBAAoB,YAAa;AACjE,QAAM,CAAE,kBAAkB,OAAQ,QACjC,uBAAoB,kBAAmB;AACxC,QAAM,CAAE,eAAe,SAAU,QAAI;AAAA,IACpC;AAAA,EACD;AACA,QAAM,CAAE,YAAY,YAAa,QAAI;AAAA,IACpC;AAAA,EACD;AACA,QAAM,CAAE,wBAAwB,SAAU,QAAI;AAAA,IAC7C;AAAA,EACD;AAEA,QAAM,CAAE,UAAW,QAAI,yBAAuB,oBAAqB,KAAK,CAAC;AACzE,QAAM,CAAE,WAAY,QACnB,yBAAuB,qBAAsB,KAAK,CAAC;AACpD,QAAM,CAAE,YAAa,QACpB,yBAAuB,sBAAuB,KAAK,CAAC;AAErD,QAAM,iBAA2B,eAAe,CAAC,GAC/C,OAAQ,gBAAgB,CAAC,CAAE,EAC3B,OAAQ,cAAc,CAAC,CAAE;AAE3B,QAAM,kBAAkB,cAAc;AAAA,IACrC,CAAE,EAAE,MAAM,MAAO,UAAU;AAAA,EAC5B;AACA,QAAM,8BAA8B,cAAc;AAAA,IACjD,CAAE,EAAE,MAAM,MAAO,UAAU;AAAA,EAC5B;AAEA,QAAM,oBAAoB,gBACxB,OAAQ,2BAA4B,EACpC,OAAQ,aAAc,EACtB;AAAA;AAAA,IAEA,CAAE,EAAE,MAAM,MAAO,UAAU;AAAA,EAC5B,EACC,MAAO,GAAG,CAAE;AAEd,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/preview-styles.js
CHANGED
|
@@ -26,19 +26,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/preview-styles.tsx
|
|
29
31
|
var preview_styles_exports = {};
|
|
30
32
|
__export(preview_styles_exports, {
|
|
31
33
|
default: () => preview_styles_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(preview_styles_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_components = require("@wordpress/components");
|
|
36
37
|
var import_hooks = require("./hooks");
|
|
37
38
|
var import_preview_hooks = require("./preview-hooks");
|
|
38
39
|
var import_typography_example = __toESM(require("./typography-example"));
|
|
39
40
|
var import_highlighted_colors = __toESM(require("./highlighted-colors"));
|
|
40
41
|
var import_preview_wrapper = __toESM(require("./preview-wrapper"));
|
|
41
|
-
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var firstFrameVariants = {
|
|
42
44
|
start: {
|
|
43
45
|
scale: 1,
|
|
44
46
|
opacity: 1
|
|
@@ -48,7 +50,7 @@ const firstFrameVariants = {
|
|
|
48
50
|
opacity: 0
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
|
-
|
|
53
|
+
var midFrameVariants = {
|
|
52
54
|
hover: {
|
|
53
55
|
opacity: 1
|
|
54
56
|
},
|
|
@@ -56,7 +58,7 @@ const midFrameVariants = {
|
|
|
56
58
|
opacity: 0.5
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
|
-
|
|
61
|
+
var secondFrameVariants = {
|
|
60
62
|
hover: {
|
|
61
63
|
scale: 1,
|
|
62
64
|
opacity: 1
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-styles.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useStyle } from './hooks';\nimport { useStylesPreviewColors } from './preview-hooks';\nimport TypographyExample from './typography-example';\nimport HighlightedColors from './highlighted-colors';\nimport PreviewWrapper from './preview-wrapper';\n\nconst firstFrameVariants = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrameVariants = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrameVariants = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\ninterface PreviewStylesProps {\n\tlabel?: string;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n\tvariation?: any;\n}\n\nfunction PreviewStyles( {\n\tlabel,\n\tisFocused,\n\twithHoverView,\n\tvariation,\n}: PreviewStylesProps ) {\n\tconst [ fontWeight ] = useStyle< string >( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useStyle< string >(\n\t\t'typography.fontFamily'\n\t);\n\tconst [ headingFontFamily = fontFamily ] = useStyle< string >(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useStyle< string >(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useStyle< string >( 'color.text' );\n\tconst [ headingColor = textColor ] = useStyle< string >(\n\t\t'elements.h1.color.text'\n\t);\n\n\tconst { paletteColors } = useStylesPreviewColors();\n\n\treturn (\n\t\t<PreviewWrapper\n\t\t\tlabel={ label }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ firstFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TypographyExample\n\t\t\t\t\t\t\tfontSize={ 65 * ratio }\n\t\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t<HighlightedColors\n\t\t\t\t\t\t\t\tnormalizedColorSwatchSize={ 32 }\n\t\t\t\t\t\t\t\tratio={ ratio }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ withHoverView ? midFrameVariants : undefined }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ paletteColors\n\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ secondFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</PreviewWrapper>\n\t);\n}\n\nexport default PreviewStyles;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAIO;AAKP,mBAAyB;AACzB,2BAAuC;AACvC,gCAA8B;AAC9B,gCAA8B;AAC9B,6BAA2B;AA8EtB;AA5EL,IAAM,qBAAqB;AAAA,EAC1B,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AACD;AAEA,IAAM,mBAAmB;AAAA,EACxB,OAAO;AAAA,IACN,SAAS;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACN,SAAS;AAAA,EACV;AACD;AAEA,IAAM,sBAAsB;AAAA,EAC3B,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,EACV;AACD;AASA,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,CAAE,UAAW,QAAI,uBAAoB,uBAAwB;AACnE,QAAM,CAAE,aAAa,OAAQ,QAAI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apper", "motion", "HStack", "TypographyExample", "VStack", "HighlightedColors"]
|
|
7
7
|
}
|
|
@@ -26,16 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/global-styles-ui/src/preview-typography.tsx
|
|
29
31
|
var preview_typography_exports = {};
|
|
30
32
|
__export(preview_typography_exports, {
|
|
31
33
|
default: () => preview_typography_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(preview_typography_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_components = require("@wordpress/components");
|
|
36
37
|
var import_typography_example = __toESM(require("./typography-example"));
|
|
37
38
|
var import_preview_wrapper = __toESM(require("./preview-wrapper"));
|
|
38
|
-
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var StylesPreviewTypography = ({
|
|
39
41
|
variation,
|
|
40
42
|
isFocused,
|
|
41
43
|
withHoverView
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-typography.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport TypographyExample from './typography-example';\nimport PreviewWrapper from './preview-wrapper';\n\ninterface StylesPreviewTypographyProps {\n\tvariation: any;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n}\n\nconst StylesPreviewTypography = ( {\n\tvariation,\n\tisFocused,\n\twithHoverView,\n}: StylesPreviewTypographyProps ) => {\n\treturn (\n\t\t<PreviewWrapper\n\t\t\tlabel={ variation.title }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<HStack\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<TypographyExample\n\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\tfontSize={ 85 * ratio }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</PreviewWrapper>\n\t);\n};\n\nexport default StylesPreviewTypography;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+C;AAK/C,gCAA8B;AAC9B,6BAA2B;AA6BtB;AArBL,IAAM,0BAA0B,CAAE;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACD,MAAqC;AACpC,SACC;AAAA,IAAC,uBAAAA;AAAA,IAAA;AAAA,MACA,OAAQ,UAAU;AAAA,MAClB;AAAA,MACA;AAAA,MAEE,WAAE,EAAE,OAAO,IAAI,MAChB;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UAEA,SAAU,KAAK;AAAA,UACf,SAAQ;AAAA,UACR,OAAQ;AAAA,YACP,QAAQ;AAAA,YACR,UAAU;AAAA,UACX;AAAA,UAEA;AAAA,YAAC,0BAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,UAAW,KAAK;AAAA;AAAA,UACjB;AAAA;AAAA,QAXM;AAAA,MAYP;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["PreviewWrapper", "HStack", "TypographyExample"]
|
|
7
7
|
}
|
package/build/preview-wrapper.js
CHANGED
|
@@ -16,19 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/preview-wrapper.tsx
|
|
19
21
|
var preview_wrapper_exports = {};
|
|
20
22
|
__export(preview_wrapper_exports, {
|
|
21
23
|
default: () => preview_wrapper_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(preview_wrapper_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_components = require("@wordpress/components");
|
|
26
27
|
var import_compose = require("@wordpress/compose");
|
|
27
28
|
var import_element = require("@wordpress/element");
|
|
28
29
|
var import_hooks = require("./hooks");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var normalizedWidth = 248;
|
|
32
|
+
var normalizedHeight = 152;
|
|
33
|
+
var THROTTLE_OPTIONS = {
|
|
32
34
|
leading: true,
|
|
33
35
|
trailing: true
|
|
34
36
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-wrapper.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport {\n\tuseThrottle,\n\tuseReducedMotion,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { useLayoutEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useStyle } from './hooks';\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\n// Throttle options for useThrottle. Must be defined outside of the component,\n// so that the object reference is the same on each render.\nconst THROTTLE_OPTIONS = {\n\tleading: true,\n\ttrailing: true,\n};\n\ninterface PreviewWrapperProps {\n\tchildren:\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )[];\n\tlabel?: string;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n}\n\nfunction PreviewWrapper( {\n\tchildren,\n\tlabel,\n\tisFocused,\n\twithHoverView,\n}: PreviewWrapperProps ) {\n\tconst [ backgroundColor = 'white' ] =\n\t\tuseStyle< string >( 'color.background' );\n\tconst [ gradientValue ] = useStyle< string >( 'color.gradient' );\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst [ throttledWidth, setThrottledWidthState ] = useState( width );\n\tconst [ ratioState, setRatioState ] = useState< number | undefined >();\n\n\tconst setThrottledWidth = useThrottle(\n\t\tsetThrottledWidthState,\n\t\t250,\n\t\tTHROTTLE_OPTIONS\n\t);\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tif ( width ) {\n\t\t\tsetThrottledWidth( width );\n\t\t}\n\t}, [ width, setThrottledWidth ] );\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tconst newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;\n\t\tconst ratioDiff = newRatio - ( ratioState || 0 );\n\n\t\t// Only update the ratio state if the difference is big enough\n\t\t// or if the ratio state is not yet set. This is to avoid an\n\t\t// endless loop of updates at particular viewport heights when the\n\t\t// presence of a scrollbar causes the width to change slightly.\n\t\tconst isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;\n\n\t\tif ( isRatioDiffBigEnough || ! ratioState ) {\n\t\t\tsetRatioState( newRatio );\n\t\t}\n\t}, [ throttledWidth, ratioState ] );\n\n\t// Set a fallbackRatio to use before the throttled ratio has been set.\n\tconst fallbackRatio = width ? width / normalizedWidth : 1;\n\t/*\n\t * Use the throttled ratio if it has been calculated, otherwise\n\t * use the fallback ratio. The throttled ratio is used to avoid\n\t * an endless loop of updates at particular viewport heights.\n\t * See: https://github.com/WordPress/gutenberg/issues/55112\n\t */\n\tconst ratio = ratioState ? ratioState : fallbackRatio;\n\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ isReady && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"global-styles-ui-preview__wrapper\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t\tcursor: withHoverView ? 'pointer' : undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ []\n\t\t\t\t\t\t\t.concat( children as any ) // This makes sure children is always an array.\n\t\t\t\t\t\t\t.map( ( child: any, key: number ) =>\n\t\t\t\t\t\t\t\tchild( { ratio, key } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PreviewWrapper;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2C;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U;AAAA,QACV,OAAQ;AAAA,UACP,QAAQ,mBAAmB;AAAA,QAC5B;AAAA,QACA,cAAe,MAAM,aAAc,IAAK;AAAA,QACxC,cAAe,MAAM,aAAc,KAAM;AAAA,QACzC,UAAW;AAAA,QAEX;AAAA,UAAC,kBAAAA,iBAAO;AAAA,UAAP;AAAA,YACA,OAAQ;AAAA,cACP,QAAQ,mBAAmB;AAAA,cAC3B,OAAO;AAAA,cACP,YAAY,iBAAiB;AAAA,cAC7B,QAAQ,gBAAgB,YAAY;AAAA,YACrC;AAAA,YACA,SAAQ;AAAA,YACR,UACG,aAAa,cACf,CAAE,iBACF,QACG,UACA;AAAA,YAGF,WAAC,EACD,OAAQ,QAAgB,EACxB;AAAA,cAAK,CAAE,OAAY,QACnB,MAAO,EAAE,OAAO,IAAI,CAAE;AAAA,YACvB;AAAA;AAAA,QACF;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["motion"]
|
|
7
7
|
}
|
package/build/provider.js
CHANGED
|
@@ -16,15 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/provider.tsx
|
|
19
21
|
var provider_exports = {};
|
|
20
22
|
__export(provider_exports, {
|
|
21
23
|
GlobalStylesProvider: () => GlobalStylesProvider
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(provider_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_element = require("@wordpress/element");
|
|
26
27
|
var import_global_styles_engine = require("@wordpress/global-styles-engine");
|
|
27
28
|
var import_context = require("./context");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
30
|
function GlobalStylesProvider({
|
|
29
31
|
children,
|
|
30
32
|
value,
|
package/build/provider.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/provider.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\nimport { mergeGlobalStyles } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { GlobalStylesContext } from './context';\n\ninterface GlobalStylesProviderProps {\n\tchildren: ReactNode;\n\tvalue: GlobalStylesConfig;\n\tbaseValue: GlobalStylesConfig;\n\tonChange: ( newValue: GlobalStylesConfig ) => void;\n\tfontLibraryEnabled?: boolean;\n}\n\nexport function GlobalStylesProvider( {\n\tchildren,\n\tvalue,\n\tbaseValue,\n\tonChange,\n\tfontLibraryEnabled,\n}: GlobalStylesProviderProps ) {\n\t// Compute merged with memoization since merging can be expensive\n\tconst merged = useMemo( () => {\n\t\treturn mergeGlobalStyles( baseValue, value );\n\t}, [ baseValue, value ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tuser: value,\n\t\t\tbase: baseValue,\n\t\t\tmerged,\n\t\t\tonChange,\n\t\t\tfontLibraryEnabled,\n\t\t} ),\n\t\t[ value, baseValue, merged, onChange, fontLibraryEnabled ]\n\t);\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAAwB;AAExB,kCAAkC;AAKlC,qBAAoC;AAkClC;AAxBK,SAAS,qBAAsB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAA+B;AAE9B,QAAM,aAAS,wBAAS,MAAM;AAC7B,eAAO,+CAAmB,WAAW,KAAM;AAAA,EAC5C,GAAG,CAAE,WAAW,KAAM,CAAE;AAExB,QAAM,mBAAe;AAAA,IACpB,OAAQ;AAAA,MACP,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAE,OAAO,WAAW,QAAQ,UAAU,kBAAmB;AAAA,EAC1D;AAEA,SACC,4CAAC,mCAAoB,UAApB,EAA6B,OAAQ,cACnC,UACH;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/root-menu.js
CHANGED
|
@@ -16,12 +16,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/global-styles-ui/src/root-menu.tsx
|
|
19
21
|
var root_menu_exports = {};
|
|
20
22
|
__export(root_menu_exports, {
|
|
21
23
|
default: () => root_menu_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(root_menu_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_components = require("@wordpress/components");
|
|
26
27
|
var import_icons = require("@wordpress/icons");
|
|
27
28
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -29,7 +30,8 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
29
30
|
var import_navigation_button = require("./navigation-button");
|
|
30
31
|
var import_hooks = require("./hooks");
|
|
31
32
|
var import_lock_unlock = require("./lock-unlock");
|
|
32
|
-
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var {
|
|
33
35
|
useHasDimensionsPanel,
|
|
34
36
|
useHasTypographyPanel,
|
|
35
37
|
useHasColorPanel,
|
package/build/root-menu.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/root-menu.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport {\n\tbackground,\n\ttypography,\n\tcolor,\n\tlayout,\n\tshadow as shadowIcon,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n// @ts-expect-error: Not typed yet.\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport type { GlobalStylesSettings } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasColorPanel,\n\tuseSettingsForBlockElement,\n\tuseHasBackgroundPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction RootMenu() {\n\t// Get the raw settings from our custom hook\n\tconst [ rawSettings ] = useSetting< GlobalStylesSettings >( '' );\n\n\t// Process settings the same way as Gutenberg\n\tconst settings = useSettingsForBlockElement( rawSettings );\n\n\t// Use the same panel detection logic as Gutenberg\n\tconst hasBackgroundPanel = useHasBackgroundPanel( rawSettings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasShadowPanel = true; // Same as Gutenberg\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath=\"/typography\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem icon={ color } path=\"/colors\">\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBackgroundPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ background }\n\t\t\t\t\t\tpath=\"/background\"\n\t\t\t\t\t\taria-label={ __( 'Background styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Background' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasShadowPanel && (\n\t\t\t\t\t<NavigationButtonAsItem icon={ shadowIcon } path=\"/shadows\">\n\t\t\t\t\t\t{ __( 'Shadows' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem icon={ layout } path=\"/layout\">\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default RootMenu;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AACrD,mBAMO;AACP,kBAAmB;AAEnB,0BAAsD;AAMtD,+BAAuC;AACvC,mBAA2B;AAC3B,yBAAuB;AA0BrB;AAxBF,IAAM;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,QAAI,2BAAQ,oBAAAA,WAAuB;AAEnC,SAAS,WAAW;AAEnB,QAAM,CAAE,WAAY,QAAI,yBAAoC,EAAG;AAG/D,QAAM,WAAW,2BAA4B,WAAY;AAGzD,QAAM,qBAAqB,sBAAuB,WAAY;AAC9D,QAAM,qBAAqB,sBAAuB,QAAS;AAC3D,QAAM,gBAAgB,iBAAkB,QAAS;AACjD,QAAM,iBAAiB;AACvB,QA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