@wordpress/global-styles-ui 1.1.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/LICENSE.md +788 -0
- package/README.md +48 -0
- package/build/background-panel.js +62 -0
- package/build/background-panel.js.map +7 -0
- package/build/block-preview-panel.js +90 -0
- package/build/block-preview-panel.js.map +7 -0
- package/build/color-indicator-wrapper.js +55 -0
- package/build/color-indicator-wrapper.js.map +7 -0
- package/build/color-palette-panel.js +123 -0
- package/build/color-palette-panel.js.map +7 -0
- package/build/color-preview.js +94 -0
- package/build/color-preview.js.map +7 -0
- package/build/color-variations.js +41 -0
- package/build/color-variations.js.map +7 -0
- package/build/confirm-reset-shadow-dialog.js +55 -0
- package/build/confirm-reset-shadow-dialog.js.map +7 -0
- package/build/context.js +37 -0
- package/build/context.js.map +7 -0
- package/build/dimensions-panel.js +89 -0
- package/build/dimensions-panel.js.map +7 -0
- package/build/font-families.js +114 -0
- package/build/font-families.js.map +7 -0
- package/build/font-family-item.js +48 -0
- package/build/font-family-item.js.map +7 -0
- package/build/font-library-modal/collection-font-variant.js +75 -0
- package/build/font-library-modal/collection-font-variant.js.map +7 -0
- package/build/font-library-modal/context.js +386 -0
- package/build/font-library-modal/context.js.map +7 -0
- package/build/font-library-modal/font-card.js +81 -0
- package/build/font-library-modal/font-card.js.map +7 -0
- package/build/font-library-modal/font-collection.js +510 -0
- package/build/font-library-modal/font-collection.js.map +7 -0
- package/build/font-library-modal/font-demo.js +111 -0
- package/build/font-library-modal/font-demo.js.map +7 -0
- package/build/font-library-modal/google-fonts-confirm-dialog.js +58 -0
- package/build/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
- package/build/font-library-modal/index.js +110 -0
- package/build/font-library-modal/index.js.map +7 -0
- package/build/font-library-modal/installed-fonts.js +453 -0
- package/build/font-library-modal/installed-fonts.js.map +7 -0
- package/build/font-library-modal/lib/inflate.js +2628 -0
- package/build/font-library-modal/lib/inflate.js.map +7 -0
- package/build/font-library-modal/lib/lib-font.browser.d.js +33 -0
- package/build/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
- package/build/font-library-modal/lib/lib-font.browser.js +3788 -0
- package/build/font-library-modal/lib/lib-font.browser.js.map +7 -0
- package/build/font-library-modal/lib/unbrotli.js +3678 -0
- package/build/font-library-modal/lib/unbrotli.js.map +7 -0
- package/build/font-library-modal/library-font-details.js +63 -0
- package/build/font-library-modal/library-font-details.js.map +7 -0
- package/build/font-library-modal/library-font-variant.js +81 -0
- package/build/font-library-modal/library-font-variant.js.map +7 -0
- package/build/font-library-modal/resolvers.js +115 -0
- package/build/font-library-modal/resolvers.js.map +7 -0
- package/build/font-library-modal/types.js +17 -0
- package/build/font-library-modal/types.js.map +7 -0
- package/build/font-library-modal/upload-fonts.js +207 -0
- package/build/font-library-modal/upload-fonts.js.map +7 -0
- package/build/font-library-modal/utils/constants.js +49 -0
- package/build/font-library-modal/utils/constants.js.map +7 -0
- package/build/font-library-modal/utils/filter-fonts.js +39 -0
- package/build/font-library-modal/utils/filter-fonts.js.map +7 -0
- package/build/font-library-modal/utils/fonts-outline.js +51 -0
- package/build/font-library-modal/utils/fonts-outline.js.map +7 -0
- package/build/font-library-modal/utils/index.js +274 -0
- package/build/font-library-modal/utils/index.js.map +7 -0
- package/build/font-library-modal/utils/make-families-from-faces.js +45 -0
- package/build/font-library-modal/utils/make-families-from-faces.js.map +7 -0
- package/build/font-library-modal/utils/preview-styles.js +119 -0
- package/build/font-library-modal/utils/preview-styles.js.map +7 -0
- package/build/font-library-modal/utils/set-immutably.js +40 -0
- package/build/font-library-modal/utils/set-immutably.js.map +7 -0
- package/build/font-library-modal/utils/sort-font-faces.js +59 -0
- package/build/font-library-modal/utils/sort-font-faces.js.map +7 -0
- package/build/font-library-modal/utils/toggleFont.js +67 -0
- package/build/font-library-modal/utils/toggleFont.js.map +7 -0
- package/build/font-sizes/confirm-delete-font-size-dialog.js +60 -0
- package/build/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js +55 -0
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
- package/build/font-sizes/font-size-preview.js +50 -0
- package/build/font-sizes/font-size-preview.js.map +7 -0
- package/build/font-sizes/font-size.js +261 -0
- package/build/font-sizes/font-size.js.map +7 -0
- package/build/font-sizes/font-sizes-count.js +40 -0
- package/build/font-sizes/font-sizes-count.js.map +7 -0
- package/build/font-sizes/font-sizes.js +215 -0
- package/build/font-sizes/font-sizes.js.map +7 -0
- package/build/font-sizes/rename-font-size-dialog.js +96 -0
- package/build/font-sizes/rename-font-size-dialog.js.map +7 -0
- package/build/global-styles-ui.js +213 -0
- package/build/global-styles-ui.js.map +7 -0
- package/build/gradients-palette-panel.js +133 -0
- package/build/gradients-palette-panel.js.map +7 -0
- package/build/highlighted-colors.js +57 -0
- package/build/highlighted-colors.js.map +7 -0
- package/build/hooks.js +176 -0
- package/build/hooks.js.map +7 -0
- package/build/icon-with-current-color.js +56 -0
- package/build/icon-with-current-color.js.map +7 -0
- package/build/index.js +51 -0
- package/build/index.js.map +7 -0
- package/build/lock-unlock.js +35 -0
- package/build/lock-unlock.js.map +7 -0
- package/build/navigation-button.js +52 -0
- package/build/navigation-button.js.map +7 -0
- package/build/pagination/index.js +133 -0
- package/build/pagination/index.js.map +7 -0
- package/build/palette.js +93 -0
- package/build/palette.js.map +7 -0
- package/build/preset-colors.js +40 -0
- package/build/preset-colors.js.map +7 -0
- package/build/preview-colors.js +86 -0
- package/build/preview-colors.js.map +7 -0
- package/build/preview-hooks.js +60 -0
- package/build/preview-hooks.js.map +7 -0
- package/build/preview-styles.js +219 -0
- package/build/preview-styles.js.map +7 -0
- package/build/preview-typography.js +72 -0
- package/build/preview-typography.js.map +7 -0
- package/build/preview-wrapper.js +102 -0
- package/build/preview-wrapper.js.map +7 -0
- package/build/provider.js +54 -0
- package/build/provider.js.map +7 -0
- package/build/root-menu.js +72 -0
- package/build/root-menu.js.map +7 -0
- package/build/screen-background.js +58 -0
- package/build/screen-background.js.map +7 -0
- package/build/screen-block-list.js +160 -0
- package/build/screen-block-list.js.map +7 -0
- package/build/screen-block.js +316 -0
- package/build/screen-block.js.map +7 -0
- package/build/screen-color-palette.js +64 -0
- package/build/screen-color-palette.js.map +7 -0
- package/build/screen-colors.js +85 -0
- package/build/screen-colors.js.map +7 -0
- package/build/screen-css.js +68 -0
- package/build/screen-css.js.map +7 -0
- package/build/screen-header.js +61 -0
- package/build/screen-header.js.map +7 -0
- package/build/screen-layout.js +54 -0
- package/build/screen-layout.js.map +7 -0
- package/build/screen-revisions/index.js +147 -0
- package/build/screen-revisions/index.js.map +7 -0
- package/build/screen-revisions/revisions-buttons.js +198 -0
- package/build/screen-revisions/revisions-buttons.js.map +7 -0
- package/build/screen-revisions/types.js +17 -0
- package/build/screen-revisions/types.js.map +7 -0
- package/build/screen-revisions/use-global-styles-revisions.js +163 -0
- package/build/screen-revisions/use-global-styles-revisions.js.map +7 -0
- package/build/screen-root.js +134 -0
- package/build/screen-root.js.map +7 -0
- package/build/screen-shadows.js +49 -0
- package/build/screen-shadows.js.map +7 -0
- package/build/screen-style-variations.js +52 -0
- package/build/screen-style-variations.js.map +7 -0
- package/build/screen-typography-element.js +167 -0
- package/build/screen-typography-element.js.map +7 -0
- package/build/screen-typography.js +65 -0
- package/build/screen-typography.js.map +7 -0
- package/build/shadow-utils.js +125 -0
- package/build/shadow-utils.js.map +7 -0
- package/build/shadows-edit-panel.js +503 -0
- package/build/shadows-edit-panel.js.map +7 -0
- package/build/shadows-panel.js +203 -0
- package/build/shadows-panel.js.map +7 -0
- package/build/size-control/index.js +86 -0
- package/build/size-control/index.js.map +7 -0
- package/build/style-variations-container.js +130 -0
- package/build/style-variations-container.js.map +7 -0
- package/build/style-variations-content.js +52 -0
- package/build/style-variations-content.js.map +7 -0
- package/build/style-variations.js +41 -0
- package/build/style-variations.js.map +7 -0
- package/build/subtitle.js +33 -0
- package/build/subtitle.js.map +7 -0
- package/build/typography-elements.js +117 -0
- package/build/typography-elements.js.map +7 -0
- package/build/typography-example.js +79 -0
- package/build/typography-example.js.map +7 -0
- package/build/typography-panel.js +64 -0
- package/build/typography-panel.js.map +7 -0
- package/build/typography-preview.js +70 -0
- package/build/typography-preview.js.map +7 -0
- package/build/typography-variations.js +41 -0
- package/build/typography-variations.js.map +7 -0
- package/build/utils.js +210 -0
- package/build/utils.js.map +7 -0
- package/build/variations/variation.js +116 -0
- package/build/variations/variation.js.map +7 -0
- package/build/variations/variations-color.js +64 -0
- package/build/variations/variations-color.js.map +7 -0
- package/build/variations/variations-panel.js +69 -0
- package/build/variations/variations-panel.js.map +7 -0
- package/build/variations/variations-typography.js +80 -0
- package/build/variations/variations-typography.js.map +7 -0
- package/build/with-global-styles-provider.js +48 -0
- package/build/with-global-styles-provider.js.map +7 -0
- package/build-module/background-panel.js +38 -0
- package/build-module/background-panel.js.map +7 -0
- package/build-module/block-preview-panel.js +70 -0
- package/build-module/block-preview-panel.js.map +7 -0
- package/build-module/color-indicator-wrapper.js +25 -0
- package/build-module/color-indicator-wrapper.js.map +7 -0
- package/build-module/color-palette-panel.js +97 -0
- package/build-module/color-palette-panel.js.map +7 -0
- package/build-module/color-preview.js +70 -0
- package/build-module/color-preview.js.map +7 -0
- package/build-module/color-variations.js +7 -0
- package/build-module/color-variations.js.map +7 -0
- package/build-module/confirm-reset-shadow-dialog.js +35 -0
- package/build-module/confirm-reset-shadow-dialog.js.map +7 -0
- package/build-module/context.js +13 -0
- package/build-module/context.js.map +7 -0
- package/build-module/dimensions-panel.js +69 -0
- package/build-module/dimensions-panel.js.map +7 -0
- package/build-module/font-families.js +92 -0
- package/build-module/font-families.js.map +7 -0
- package/build-module/font-family-item.js +32 -0
- package/build-module/font-family-item.js.map +7 -0
- package/build-module/font-library-modal/collection-font-variant.js +45 -0
- package/build-module/font-library-modal/collection-font-variant.js.map +7 -0
- package/build-module/font-library-modal/context.js +382 -0
- package/build-module/font-library-modal/context.js.map +7 -0
- package/build-module/font-library-modal/font-card.js +57 -0
- package/build-module/font-library-modal/font-card.js.map +7 -0
- package/build-module/font-library-modal/font-collection.js +510 -0
- package/build-module/font-library-modal/font-collection.js.map +7 -0
- package/build-module/font-library-modal/font-demo.js +94 -0
- package/build-module/font-library-modal/font-demo.js.map +7 -0
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js +45 -0
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
- package/build-module/font-library-modal/index.js +83 -0
- package/build-module/font-library-modal/index.js.map +7 -0
- package/build-module/font-library-modal/installed-fonts.js +442 -0
- package/build-module/font-library-modal/installed-fonts.js.map +7 -0
- package/build-module/font-library-modal/lib/inflate.js +2636 -0
- package/build-module/font-library-modal/lib/inflate.js.map +7 -0
- package/build-module/font-library-modal/lib/lib-font.browser.d.js +9 -0
- package/build-module/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
- package/build-module/font-library-modal/lib/lib-font.browser.js +3754 -0
- package/build-module/font-library-modal/lib/lib-font.browser.js.map +7 -0
- package/build-module/font-library-modal/lib/unbrotli.js +3686 -0
- package/build-module/font-library-modal/lib/unbrotli.js.map +7 -0
- package/build-module/font-library-modal/library-font-details.js +36 -0
- package/build-module/font-library-modal/library-font-details.js.map +7 -0
- package/build-module/font-library-modal/library-font-variant.js +51 -0
- package/build-module/font-library-modal/library-font-variant.js.map +7 -0
- package/build-module/font-library-modal/resolvers.js +76 -0
- package/build-module/font-library-modal/resolvers.js.map +7 -0
- package/build-module/font-library-modal/types.js +1 -0
- package/build-module/font-library-modal/types.js.map +7 -0
- package/build-module/font-library-modal/upload-fonts.js +187 -0
- package/build-module/font-library-modal/upload-fonts.js.map +7 -0
- package/build-module/font-library-modal/utils/constants.js +23 -0
- package/build-module/font-library-modal/utils/constants.js.map +7 -0
- package/build-module/font-library-modal/utils/filter-fonts.js +19 -0
- package/build-module/font-library-modal/utils/filter-fonts.js.map +7 -0
- package/build-module/font-library-modal/utils/fonts-outline.js +26 -0
- package/build-module/font-library-modal/utils/fonts-outline.js.map +7 -0
- package/build-module/font-library-modal/utils/index.js +238 -0
- package/build-module/font-library-modal/utils/index.js.map +7 -0
- package/build-module/font-library-modal/utils/make-families-from-faces.js +25 -0
- package/build-module/font-library-modal/utils/make-families-from-faces.js.map +7 -0
- package/build-module/font-library-modal/utils/preview-styles.js +92 -0
- package/build-module/font-library-modal/utils/preview-styles.js.map +7 -0
- package/build-module/font-library-modal/utils/set-immutably.js +16 -0
- package/build-module/font-library-modal/utils/set-immutably.js.map +7 -0
- package/build-module/font-library-modal/utils/sort-font-faces.js +35 -0
- package/build-module/font-library-modal/utils/sort-font-faces.js.map +7 -0
- package/build-module/font-library-modal/utils/toggleFont.js +43 -0
- package/build-module/font-library-modal/utils/toggleFont.js.map +7 -0
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js +40 -0
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js +35 -0
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
- package/build-module/font-sizes/font-size-preview.js +30 -0
- package/build-module/font-sizes/font-size-preview.js.map +7 -0
- package/build-module/font-sizes/font-size.js +241 -0
- package/build-module/font-sizes/font-size.js.map +7 -0
- package/build-module/font-sizes/font-sizes-count.js +25 -0
- package/build-module/font-sizes/font-sizes-count.js.map +7 -0
- package/build-module/font-sizes/font-sizes.js +200 -0
- package/build-module/font-sizes/font-sizes.js.map +7 -0
- package/build-module/font-sizes/rename-font-size-dialog.js +82 -0
- package/build-module/font-sizes/rename-font-size-dialog.js.map +7 -0
- package/build-module/global-styles-ui.js +182 -0
- package/build-module/global-styles-ui.js.map +7 -0
- package/build-module/gradients-palette-panel.js +118 -0
- package/build-module/gradients-palette-panel.js.map +7 -0
- package/build-module/highlighted-colors.js +37 -0
- package/build-module/highlighted-colors.js.map +7 -0
- package/build-module/hooks.js +144 -0
- package/build-module/hooks.js.map +7 -0
- package/build-module/icon-with-current-color.js +22 -0
- package/build-module/icon-with-current-color.js.map +7 -0
- package/build-module/index.js +13 -0
- package/build-module/index.js.map +7 -0
- package/build-module/lock-unlock.js +10 -0
- package/build-module/lock-unlock.js.map +7 -0
- package/build-module/navigation-button.js +32 -0
- package/build-module/navigation-button.js.map +7 -0
- package/build-module/pagination/index.js +107 -0
- package/build-module/pagination/index.js.map +7 -0
- package/build-module/palette.js +70 -0
- package/build-module/palette.js.map +7 -0
- package/build-module/preset-colors.js +20 -0
- package/build-module/preset-colors.js.map +7 -0
- package/build-module/preview-colors.js +59 -0
- package/build-module/preview-colors.js.map +7 -0
- package/build-module/preview-hooks.js +36 -0
- package/build-module/preview-hooks.js.map +7 -0
- package/build-module/preview-styles.js +193 -0
- package/build-module/preview-styles.js.map +7 -0
- package/build-module/preview-typography.js +42 -0
- package/build-module/preview-typography.js.map +7 -0
- package/build-module/preview-wrapper.js +86 -0
- package/build-module/preview-wrapper.js.map +7 -0
- package/build-module/provider.js +30 -0
- package/build-module/provider.js.map +7 -0
- package/build-module/root-menu.js +58 -0
- package/build-module/root-menu.js.map +7 -0
- package/build-module/screen-background.js +28 -0
- package/build-module/screen-background.js.map +7 -0
- package/build-module/screen-block-list.js +150 -0
- package/build-module/screen-block-list.js.map +7 -0
- package/build-module/screen-block.js +293 -0
- package/build-module/screen-block.js.map +7 -0
- package/build-module/screen-color-palette.js +34 -0
- package/build-module/screen-color-palette.js.map +7 -0
- package/build-module/screen-colors.js +55 -0
- package/build-module/screen-colors.js.map +7 -0
- package/build-module/screen-css.js +48 -0
- package/build-module/screen-css.js.map +7 -0
- package/build-module/screen-header.js +44 -0
- package/build-module/screen-header.js.map +7 -0
- package/build-module/screen-layout.js +24 -0
- package/build-module/screen-layout.js.map +7 -0
- package/build-module/screen-revisions/index.js +121 -0
- package/build-module/screen-revisions/index.js.map +7 -0
- package/build-module/screen-revisions/revisions-buttons.js +178 -0
- package/build-module/screen-revisions/revisions-buttons.js.map +7 -0
- package/build-module/screen-revisions/types.js +1 -0
- package/build-module/screen-revisions/types.js.map +7 -0
- package/build-module/screen-revisions/use-global-styles-revisions.js +145 -0
- package/build-module/screen-revisions/use-global-styles-revisions.js.map +7 -0
- package/build-module/screen-root.js +114 -0
- package/build-module/screen-root.js.map +7 -0
- package/build-module/screen-shadows.js +14 -0
- package/build-module/screen-shadows.js.map +7 -0
- package/build-module/screen-style-variations.js +32 -0
- package/build-module/screen-style-variations.js.map +7 -0
- package/build-module/screen-typography-element.js +141 -0
- package/build-module/screen-typography-element.js.map +7 -0
- package/build-module/screen-typography.js +35 -0
- package/build-module/screen-typography.js.map +7 -0
- package/build-module/shadow-utils.js +98 -0
- package/build-module/shadow-utils.js.map +7 -0
- package/build-module/shadows-edit-panel.js +502 -0
- package/build-module/shadows-edit-panel.js.map +7 -0
- package/build-module/shadows-panel.js +182 -0
- package/build-module/shadows-panel.js.map +7 -0
- package/build-module/size-control/index.js +72 -0
- package/build-module/size-control/index.js.map +7 -0
- package/build-module/style-variations-container.js +100 -0
- package/build-module/style-variations-container.js.map +7 -0
- package/build-module/style-variations-content.js +18 -0
- package/build-module/style-variations-content.js.map +7 -0
- package/build-module/style-variations.js +7 -0
- package/build-module/style-variations.js.map +7 -0
- package/build-module/subtitle.js +9 -0
- package/build-module/subtitle.js.map +7 -0
- package/build-module/typography-elements.js +102 -0
- package/build-module/typography-elements.js.map +7 -0
- package/build-module/typography-example.js +59 -0
- package/build-module/typography-example.js.map +7 -0
- package/build-module/typography-panel.js +44 -0
- package/build-module/typography-panel.js.map +7 -0
- package/build-module/typography-preview.js +50 -0
- package/build-module/typography-preview.js.map +7 -0
- package/build-module/typography-variations.js +7 -0
- package/build-module/typography-variations.js.map +7 -0
- package/build-module/utils.js +179 -0
- package/build-module/utils.js.map +7 -0
- package/build-module/variations/variation.js +86 -0
- package/build-module/variations/variation.js.map +7 -0
- package/build-module/variations/variations-color.js +37 -0
- package/build-module/variations/variations-color.js.map +7 -0
- package/build-module/variations/variations-panel.js +44 -0
- package/build-module/variations/variations-panel.js.map +7 -0
- package/build-module/variations/variations-typography.js +53 -0
- package/build-module/variations/variations-typography.js.map +7 -0
- package/build-module/with-global-styles-provider.js +24 -0
- package/build-module/with-global-styles-provider.js.map +7 -0
- package/build-style/style-rtl.css +717 -0
- package/build-style/style.css +718 -0
- package/build-types/background-panel.d.ts +10 -0
- package/build-types/background-panel.d.ts.map +1 -0
- package/build-types/block-preview-panel.d.ts +7 -0
- package/build-types/block-preview-panel.d.ts.map +1 -0
- package/build-types/color-indicator-wrapper.d.ts +7 -0
- package/build-types/color-indicator-wrapper.d.ts.map +1 -0
- package/build-types/color-palette-panel.d.ts +6 -0
- package/build-types/color-palette-panel.d.ts.map +1 -0
- package/build-types/color-preview.d.ts +2 -0
- package/build-types/color-preview.d.ts.map +1 -0
- package/build-types/color-variations.d.ts +27 -0
- package/build-types/color-variations.d.ts.map +1 -0
- package/build-types/confirm-reset-shadow-dialog.d.ts +10 -0
- package/build-types/confirm-reset-shadow-dialog.d.ts.map +1 -0
- package/build-types/context.d.ts +10 -0
- package/build-types/context.d.ts.map +1 -0
- package/build-types/dimensions-panel.d.ts +2 -0
- package/build-types/dimensions-panel.d.ts.map +1 -0
- package/build-types/font-families.d.ts +4 -0
- package/build-types/font-families.d.ts.map +1 -0
- package/build-types/font-family-item.d.ts +7 -0
- package/build-types/font-family-item.d.ts.map +1 -0
- package/build-types/font-library-modal/collection-font-variant.d.ts +4 -0
- package/build-types/font-library-modal/collection-font-variant.d.ts.map +1 -0
- package/build-types/font-library-modal/context.d.ts +7 -0
- package/build-types/font-library-modal/context.d.ts.map +1 -0
- package/build-types/font-library-modal/font-card.d.ts +9 -0
- package/build-types/font-library-modal/font-card.d.ts.map +1 -0
- package/build-types/font-library-modal/font-collection.d.ts +5 -0
- package/build-types/font-library-modal/font-collection.d.ts.map +1 -0
- package/build-types/font-library-modal/font-demo.d.ts +4 -0
- package/build-types/font-library-modal/font-demo.d.ts.map +1 -0
- package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts +3 -0
- package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts.map +1 -0
- package/build-types/font-library-modal/index.d.ts +6 -0
- package/build-types/font-library-modal/index.d.ts.map +1 -0
- package/build-types/font-library-modal/installed-fonts.d.ts +3 -0
- package/build-types/font-library-modal/installed-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/library-font-details.d.ts +6 -0
- package/build-types/font-library-modal/library-font-details.d.ts.map +1 -0
- package/build-types/font-library-modal/library-font-variant.d.ts +7 -0
- package/build-types/font-library-modal/library-font-variant.d.ts.map +1 -0
- package/build-types/font-library-modal/resolvers.d.ts +43 -0
- package/build-types/font-library-modal/resolvers.d.ts.map +1 -0
- package/build-types/font-library-modal/types.d.ts +133 -0
- package/build-types/font-library-modal/types.d.ts.map +1 -0
- package/build-types/font-library-modal/upload-fonts.d.ts +3 -0
- package/build-types/font-library-modal/upload-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/constants.d.ts +4 -0
- package/build-types/font-library-modal/utils/constants.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/filter-fonts.d.ts +25 -0
- package/build-types/font-library-modal/utils/filter-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/fonts-outline.d.ts +7 -0
- package/build-types/font-library-modal/utils/fonts-outline.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/index.d.ts +21 -0
- package/build-types/font-library-modal/utils/index.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/make-families-from-faces.d.ts +6 -0
- package/build-types/font-library-modal/utils/make-families-from-faces.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/preview-styles.d.ts +13 -0
- package/build-types/font-library-modal/utils/preview-styles.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/set-immutably.d.ts +13 -0
- package/build-types/font-library-modal/utils/set-immutably.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/sort-font-faces.d.ts +6 -0
- package/build-types/font-library-modal/utils/sort-font-faces.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/toggleFont.d.ts +38 -0
- package/build-types/font-library-modal/utils/toggleFont.d.ts.map +1 -0
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts +10 -0
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts.map +1 -0
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts +10 -0
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts.map +1 -0
- package/build-types/font-sizes/font-size-preview.d.ts +7 -0
- package/build-types/font-sizes/font-size-preview.d.ts.map +1 -0
- package/build-types/font-sizes/font-size.d.ts +4 -0
- package/build-types/font-sizes/font-size.d.ts.map +1 -0
- package/build-types/font-sizes/font-sizes-count.d.ts +3 -0
- package/build-types/font-sizes/font-sizes-count.d.ts.map +1 -0
- package/build-types/font-sizes/font-sizes.d.ts +3 -0
- package/build-types/font-sizes/font-sizes.d.ts.map +1 -0
- package/build-types/font-sizes/rename-font-size-dialog.d.ts +9 -0
- package/build-types/font-sizes/rename-font-size-dialog.d.ts.map +1 -0
- package/build-types/global-styles-ui.d.ts +26 -0
- package/build-types/global-styles-ui.d.ts.map +1 -0
- package/build-types/gradients-palette-panel.d.ts +6 -0
- package/build-types/gradients-palette-panel.d.ts.map +1 -0
- package/build-types/highlighted-colors.d.ts +7 -0
- package/build-types/highlighted-colors.d.ts.map +1 -0
- package/build-types/hooks.d.ts +46 -0
- package/build-types/hooks.d.ts.map +1 -0
- package/build-types/icon-with-current-color.d.ts +9 -0
- package/build-types/icon-with-current-color.d.ts.map +1 -0
- package/build-types/index.d.ts +6 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/navigation-button.d.ts +10 -0
- package/build-types/navigation-button.d.ts.map +1 -0
- package/build-types/pagination/index.d.ts +13 -0
- package/build-types/pagination/index.d.ts.map +1 -0
- package/build-types/palette.d.ts +6 -0
- package/build-types/palette.d.ts.map +1 -0
- package/build-types/preset-colors.d.ts +2 -0
- package/build-types/preset-colors.d.ts.map +1 -0
- package/build-types/preview-colors.d.ts +8 -0
- package/build-types/preview-colors.d.ts.map +1 -0
- package/build-types/preview-hooks.d.ts +9 -0
- package/build-types/preview-hooks.d.ts.map +1 -0
- package/build-types/preview-styles.d.ts +9 -0
- package/build-types/preview-styles.d.ts.map +1 -0
- package/build-types/preview-typography.d.ts +8 -0
- package/build-types/preview-typography.d.ts.map +1 -0
- package/build-types/preview-wrapper.d.ts +15 -0
- package/build-types/preview-wrapper.d.ts.map +1 -0
- package/build-types/provider.d.ts +15 -0
- package/build-types/provider.d.ts.map +1 -0
- package/build-types/root-menu.d.ts +3 -0
- package/build-types/root-menu.d.ts.map +1 -0
- package/build-types/screen-background.d.ts +3 -0
- package/build-types/screen-background.d.ts.map +1 -0
- package/build-types/screen-block-list.d.ts +4 -0
- package/build-types/screen-block-list.d.ts.map +1 -0
- package/build-types/screen-block.d.ts +7 -0
- package/build-types/screen-block.d.ts.map +1 -0
- package/build-types/screen-color-palette.d.ts +5 -0
- package/build-types/screen-color-palette.d.ts.map +1 -0
- package/build-types/screen-colors.d.ts +3 -0
- package/build-types/screen-colors.d.ts.map +1 -0
- package/build-types/screen-css.d.ts +3 -0
- package/build-types/screen-css.d.ts.map +1 -0
- package/build-types/screen-header.d.ts +8 -0
- package/build-types/screen-header.d.ts.map +1 -0
- package/build-types/screen-layout.d.ts +3 -0
- package/build-types/screen-layout.d.ts.map +1 -0
- package/build-types/screen-revisions/index.d.ts +6 -0
- package/build-types/screen-revisions/index.d.ts.map +1 -0
- package/build-types/screen-revisions/revisions-buttons.d.ts +23 -0
- package/build-types/screen-revisions/revisions-buttons.d.ts.map +1 -0
- package/build-types/screen-revisions/types.d.ts +17 -0
- package/build-types/screen-revisions/types.d.ts.map +1 -0
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts +17 -0
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts.map +1 -0
- package/build-types/screen-root.d.ts +3 -0
- package/build-types/screen-root.d.ts.map +1 -0
- package/build-types/screen-shadows.d.ts +3 -0
- package/build-types/screen-shadows.d.ts.map +1 -0
- package/build-types/screen-style-variations.d.ts +3 -0
- package/build-types/screen-style-variations.d.ts.map +1 -0
- package/build-types/screen-typography-element.d.ts +28 -0
- package/build-types/screen-typography-element.d.ts.map +1 -0
- package/build-types/screen-typography.d.ts +3 -0
- package/build-types/screen-typography.d.ts.map +1 -0
- package/build-types/shadow-utils.d.ts +126 -0
- package/build-types/shadow-utils.d.ts.map +1 -0
- package/build-types/shadows-edit-panel.d.ts +2 -0
- package/build-types/shadows-edit-panel.d.ts.map +1 -0
- package/build-types/shadows-panel.d.ts +3 -0
- package/build-types/shadows-panel.d.ts.map +1 -0
- package/build-types/size-control/index.d.ts +11 -0
- package/build-types/size-control/index.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts +6 -0
- package/build-types/stories/index.story.d.ts.map +1 -0
- package/build-types/style-variations-container.d.ts +6 -0
- package/build-types/style-variations-container.d.ts.map +1 -0
- package/build-types/style-variations-content.d.ts +2 -0
- package/build-types/style-variations-content.d.ts.map +1 -0
- package/build-types/style-variations.d.ts +25 -0
- package/build-types/style-variations.d.ts.map +1 -0
- package/build-types/subtitle.d.ts +7 -0
- package/build-types/subtitle.d.ts.map +1 -0
- package/build-types/test/shadow-utils.spec.d.ts +2 -0
- package/build-types/test/shadow-utils.spec.d.ts.map +1 -0
- package/build-types/test/utils.spec.d.ts +2 -0
- package/build-types/test/utils.spec.d.ts.map +1 -0
- package/build-types/typography-elements.d.ts +3 -0
- package/build-types/typography-elements.d.ts.map +1 -0
- package/build-types/typography-example.d.ts +7 -0
- package/build-types/typography-example.d.ts.map +1 -0
- package/build-types/typography-panel.d.ts +7 -0
- package/build-types/typography-panel.d.ts.map +1 -0
- package/build-types/typography-preview.d.ts +8 -0
- package/build-types/typography-preview.d.ts.map +1 -0
- package/build-types/typography-variations.d.ts +27 -0
- package/build-types/typography-variations.d.ts.map +1 -0
- package/build-types/utils.d.ts +63 -0
- package/build-types/utils.d.ts.map +1 -0
- package/build-types/variations/variation.d.ts +10 -0
- package/build-types/variations/variation.d.ts.map +1 -0
- package/build-types/variations/variations-color.d.ts +7 -0
- package/build-types/variations/variations-color.d.ts.map +1 -0
- package/build-types/variations/variations-panel.d.ts +13 -0
- package/build-types/variations/variations-panel.d.ts.map +1 -0
- package/build-types/variations/variations-typography.d.ts +7 -0
- package/build-types/variations/variations-typography.d.ts.map +1 -0
- package/build-types/with-global-styles-provider.d.ts +20 -0
- package/build-types/with-global-styles-provider.d.ts.map +1 -0
- package/package.json +67 -0
- package/src/README.md +99 -0
- package/src/background-panel.tsx +56 -0
- package/src/block-preview-panel.tsx +91 -0
- package/src/color-indicator-wrapper.tsx +34 -0
- package/src/color-palette-panel.tsx +111 -0
- package/src/color-preview.tsx +78 -0
- package/src/color-variations.tsx +35 -0
- package/src/confirm-reset-shadow-dialog.tsx +45 -0
- package/src/context.ts +21 -0
- package/src/dimensions-panel.tsx +85 -0
- package/src/font-families.tsx +127 -0
- package/src/font-family-item.tsx +52 -0
- package/src/font-library-modal/collection-font-variant.tsx +52 -0
- package/src/font-library-modal/context.tsx +591 -0
- package/src/font-library-modal/font-card.tsx +77 -0
- package/src/font-library-modal/font-collection.tsx +592 -0
- package/src/font-library-modal/font-demo.tsx +123 -0
- package/src/font-library-modal/google-fonts-confirm-dialog.tsx +57 -0
- package/src/font-library-modal/index.tsx +110 -0
- package/src/font-library-modal/installed-fonts.tsx +547 -0
- package/src/font-library-modal/lib/inflate.js +4112 -0
- package/src/font-library-modal/lib/lib-font.browser.d.ts +11 -0
- package/src/font-library-modal/lib/lib-font.browser.js +3861 -0
- package/src/font-library-modal/lib/unbrotli.js +2706 -0
- package/src/font-library-modal/library-font-details.tsx +46 -0
- package/src/font-library-modal/library-font-variant.tsx +67 -0
- package/src/font-library-modal/resolvers.tsx +100 -0
- package/src/font-library-modal/style.scss +222 -0
- package/src/font-library-modal/types.ts +176 -0
- package/src/font-library-modal/upload-fonts.tsx +269 -0
- package/src/font-library-modal/utils/constants.ts +23 -0
- package/src/font-library-modal/utils/filter-fonts.ts +47 -0
- package/src/font-library-modal/utils/fonts-outline.ts +33 -0
- package/src/font-library-modal/utils/index.ts +368 -0
- package/src/font-library-modal/utils/make-families-from-faces.ts +34 -0
- package/src/font-library-modal/utils/preview-styles.ts +167 -0
- package/src/font-library-modal/utils/set-immutably.ts +37 -0
- package/src/font-library-modal/utils/sort-font-faces.ts +46 -0
- package/src/font-library-modal/utils/toggleFont.ts +109 -0
- package/src/font-sizes/confirm-delete-font-size-dialog.tsx +51 -0
- package/src/font-sizes/confirm-reset-font-sizes-dialog.tsx +45 -0
- package/src/font-sizes/font-size-preview.tsx +47 -0
- package/src/font-sizes/font-size.tsx +289 -0
- package/src/font-sizes/font-sizes-count.tsx +37 -0
- package/src/font-sizes/font-sizes.tsx +265 -0
- package/src/font-sizes/rename-font-size-dialog.tsx +83 -0
- package/src/global-styles-ui.tsx +292 -0
- package/src/gradients-palette-panel.tsx +126 -0
- package/src/highlighted-colors.tsx +44 -0
- package/src/hooks.ts +251 -0
- package/src/icon-with-current-color.tsx +31 -0
- package/src/index.ts +7 -0
- package/src/lock-unlock.ts +10 -0
- package/src/navigation-button.tsx +53 -0
- package/src/pagination/index.tsx +107 -0
- package/src/pagination/style.scss +7 -0
- package/src/palette.tsx +101 -0
- package/src/preset-colors.tsx +18 -0
- package/src/preview-colors.tsx +68 -0
- package/src/preview-hooks.tsx +58 -0
- package/src/preview-styles.tsx +196 -0
- package/src/preview-typography.tsx +49 -0
- package/src/preview-wrapper.tsx +137 -0
- package/src/provider.tsx +54 -0
- package/src/root-menu.tsx +87 -0
- package/src/screen-background.tsx +37 -0
- package/src/screen-block-list.tsx +198 -0
- package/src/screen-block.tsx +370 -0
- package/src/screen-color-palette.tsx +47 -0
- package/src/screen-colors.tsx +67 -0
- package/src/screen-css.tsx +56 -0
- package/src/screen-header.tsx +56 -0
- package/src/screen-layout.tsx +34 -0
- package/src/screen-revisions/index.tsx +158 -0
- package/src/screen-revisions/revisions-buttons.tsx +259 -0
- package/src/screen-revisions/style.scss +194 -0
- package/src/screen-revisions/types.ts +18 -0
- package/src/screen-revisions/use-global-styles-revisions.tsx +204 -0
- package/src/screen-root.tsx +146 -0
- package/src/screen-shadows.tsx +13 -0
- package/src/screen-style-variations.tsx +36 -0
- package/src/screen-typography-element.tsx +127 -0
- package/src/screen-typography.tsx +41 -0
- package/src/shadow-utils.ts +167 -0
- package/src/shadows-edit-panel.tsx +559 -0
- package/src/shadows-panel.tsx +207 -0
- package/src/size-control/index.tsx +97 -0
- package/src/size-control/style.scss +7 -0
- package/src/stories/index.story.js +410 -0
- package/src/style-variations-container.tsx +153 -0
- package/src/style-variations-content.tsx +24 -0
- package/src/style-variations.tsx +33 -0
- package/src/style.scss +287 -0
- package/src/subtitle.tsx +17 -0
- package/src/test/shadow-utils.spec.js +251 -0
- package/src/test/utils.spec.js +59 -0
- package/src/typography-elements.tsx +113 -0
- package/src/typography-example.tsx +78 -0
- package/src/typography-panel.tsx +56 -0
- package/src/typography-preview.tsx +61 -0
- package/src/typography-variations.tsx +35 -0
- package/src/utils.ts +301 -0
- package/src/variations/style.scss +43 -0
- package/src/variations/variation.tsx +113 -0
- package/src/variations/variations-color.tsx +54 -0
- package/src/variations/variations-panel.tsx +79 -0
- package/src/variations/variations-typography.tsx +65 -0
- package/src/with-global-styles-provider.tsx +44 -0
- package/tsconfig.json +26 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
__experimentalHStack as HStack,
|
|
11
|
+
__experimentalVStack as VStack,
|
|
12
|
+
__experimentalSpacer as Spacer,
|
|
13
|
+
__experimentalItemGroup as ItemGroup,
|
|
14
|
+
__experimentalInputControl as InputControl,
|
|
15
|
+
__experimentalUnitControl as UnitControl,
|
|
16
|
+
__experimentalGrid as Grid,
|
|
17
|
+
__experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
18
|
+
useNavigator,
|
|
19
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
20
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
21
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
22
|
+
Dropdown,
|
|
23
|
+
Button,
|
|
24
|
+
Flex,
|
|
25
|
+
FlexItem,
|
|
26
|
+
ColorPalette,
|
|
27
|
+
Modal,
|
|
28
|
+
privateApis as componentsPrivateApis,
|
|
29
|
+
} from '@wordpress/components';
|
|
30
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
31
|
+
import {
|
|
32
|
+
plus,
|
|
33
|
+
shadow as shadowIcon,
|
|
34
|
+
reset,
|
|
35
|
+
moreVertical,
|
|
36
|
+
} from '@wordpress/icons';
|
|
37
|
+
import { useState, useMemo, useEffect, useRef } from '@wordpress/element';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Internal dependencies
|
|
41
|
+
*/
|
|
42
|
+
import { Subtitle } from './subtitle';
|
|
43
|
+
import { ScreenHeader } from './screen-header';
|
|
44
|
+
import { defaultShadow } from './shadows-panel';
|
|
45
|
+
import {
|
|
46
|
+
getShadowParts,
|
|
47
|
+
shadowStringToObject,
|
|
48
|
+
shadowObjectToString,
|
|
49
|
+
} from './shadow-utils';
|
|
50
|
+
import { useSetting } from './hooks';
|
|
51
|
+
import { unlock } from './lock-unlock';
|
|
52
|
+
|
|
53
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
54
|
+
|
|
55
|
+
const customShadowMenuItems = [
|
|
56
|
+
{
|
|
57
|
+
label: __( 'Rename' ),
|
|
58
|
+
action: 'rename',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: __( 'Delete' ),
|
|
62
|
+
action: 'delete',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const presetShadowMenuItems = [
|
|
67
|
+
{
|
|
68
|
+
label: __( 'Reset' ),
|
|
69
|
+
action: 'reset',
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export default function ShadowsEditPanel() {
|
|
74
|
+
const { goBack, params } = useNavigator();
|
|
75
|
+
const { category, slug } = params;
|
|
76
|
+
|
|
77
|
+
const [ shadows, setShadows ] = useSetting(
|
|
78
|
+
`shadow.presets.${ category }`
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
useEffect( () => {
|
|
82
|
+
const hasCurrentShadow = shadows?.some(
|
|
83
|
+
( shadow: any ) => shadow.slug === slug
|
|
84
|
+
);
|
|
85
|
+
// If the shadow being edited doesn't exist anymore in the global styles setting, navigate back
|
|
86
|
+
// to prevent the user from editing a non-existent shadow entry.
|
|
87
|
+
// This can happen, for example:
|
|
88
|
+
// - when the user deletes the shadow
|
|
89
|
+
// - when the user resets the styles while editing a custom shadow
|
|
90
|
+
//
|
|
91
|
+
// The check on the slug is necessary to prevent a double back navigation when the user triggers
|
|
92
|
+
// a backward navigation by interacting with the screen's UI.
|
|
93
|
+
if ( !! slug && ! hasCurrentShadow ) {
|
|
94
|
+
goBack();
|
|
95
|
+
}
|
|
96
|
+
}, [ shadows, slug, goBack ] );
|
|
97
|
+
|
|
98
|
+
const [ baseShadows ] = useSetting(
|
|
99
|
+
`shadow.presets.${ category }`,
|
|
100
|
+
undefined,
|
|
101
|
+
'base'
|
|
102
|
+
);
|
|
103
|
+
const [ selectedShadow, setSelectedShadow ] = useState( () =>
|
|
104
|
+
( shadows || [] ).find( ( shadow: any ) => shadow.slug === slug )
|
|
105
|
+
);
|
|
106
|
+
const baseSelectedShadow = useMemo(
|
|
107
|
+
() => ( baseShadows || [] ).find( ( b: any ) => b.slug === slug ),
|
|
108
|
+
[ baseShadows, slug ]
|
|
109
|
+
);
|
|
110
|
+
const [ isConfirmDialogVisible, setIsConfirmDialogVisible ] =
|
|
111
|
+
useState( false );
|
|
112
|
+
const [ isRenameModalVisible, setIsRenameModalVisible ] = useState( false );
|
|
113
|
+
const [ shadowName, setShadowName ] = useState< string | undefined >(
|
|
114
|
+
selectedShadow?.name
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if ( ! category || ! slug ) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const onShadowChange = ( shadow: string ) => {
|
|
122
|
+
setSelectedShadow( { ...selectedShadow, shadow } );
|
|
123
|
+
const updatedShadows = shadows.map( ( s: any ) =>
|
|
124
|
+
s.slug === slug ? { ...selectedShadow, shadow } : s
|
|
125
|
+
);
|
|
126
|
+
setShadows( updatedShadows );
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const onMenuClick = ( action: string ) => {
|
|
130
|
+
if ( action === 'reset' ) {
|
|
131
|
+
const updatedShadows = shadows.map( ( s: any ) =>
|
|
132
|
+
s.slug === slug ? baseSelectedShadow : s
|
|
133
|
+
);
|
|
134
|
+
setSelectedShadow( baseSelectedShadow );
|
|
135
|
+
setShadows( updatedShadows );
|
|
136
|
+
} else if ( action === 'delete' ) {
|
|
137
|
+
setIsConfirmDialogVisible( true );
|
|
138
|
+
} else if ( action === 'rename' ) {
|
|
139
|
+
setIsRenameModalVisible( true );
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const handleShadowDelete = () => {
|
|
144
|
+
setShadows( shadows.filter( ( s: any ) => s.slug !== slug ) );
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const handleShadowRename = ( newName: string | undefined ) => {
|
|
148
|
+
if ( ! newName ) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const updatedShadows = shadows.map( ( s: any ) =>
|
|
152
|
+
s.slug === slug ? { ...selectedShadow, name: newName } : s
|
|
153
|
+
);
|
|
154
|
+
setSelectedShadow( { ...selectedShadow, name: newName } );
|
|
155
|
+
setShadows( updatedShadows );
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return ! selectedShadow ? (
|
|
159
|
+
<ScreenHeader title="" />
|
|
160
|
+
) : (
|
|
161
|
+
<>
|
|
162
|
+
<HStack justify="space-between">
|
|
163
|
+
<ScreenHeader title={ selectedShadow.name } />
|
|
164
|
+
<FlexItem>
|
|
165
|
+
<Spacer marginTop={ 2 } marginBottom={ 0 } paddingX={ 4 }>
|
|
166
|
+
<Menu>
|
|
167
|
+
<Menu.TriggerButton
|
|
168
|
+
render={
|
|
169
|
+
<Button
|
|
170
|
+
size="small"
|
|
171
|
+
icon={ moreVertical }
|
|
172
|
+
label={ __( 'Menu' ) }
|
|
173
|
+
/>
|
|
174
|
+
}
|
|
175
|
+
/>
|
|
176
|
+
<Menu.Popover>
|
|
177
|
+
{ ( category === 'custom'
|
|
178
|
+
? customShadowMenuItems
|
|
179
|
+
: presetShadowMenuItems
|
|
180
|
+
).map( ( item ) => (
|
|
181
|
+
<Menu.Item
|
|
182
|
+
key={ item.action }
|
|
183
|
+
onClick={ () =>
|
|
184
|
+
onMenuClick( item.action )
|
|
185
|
+
}
|
|
186
|
+
disabled={
|
|
187
|
+
item.action === 'reset' &&
|
|
188
|
+
selectedShadow.shadow ===
|
|
189
|
+
baseSelectedShadow?.shadow
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
<Menu.ItemLabel>
|
|
193
|
+
{ item.label }
|
|
194
|
+
</Menu.ItemLabel>
|
|
195
|
+
</Menu.Item>
|
|
196
|
+
) ) }
|
|
197
|
+
</Menu.Popover>
|
|
198
|
+
</Menu>
|
|
199
|
+
</Spacer>
|
|
200
|
+
</FlexItem>
|
|
201
|
+
</HStack>
|
|
202
|
+
<div className="global-styles-ui-screen">
|
|
203
|
+
<ShadowsPreview shadow={ selectedShadow.shadow } />
|
|
204
|
+
<ShadowEditor
|
|
205
|
+
shadow={ selectedShadow.shadow }
|
|
206
|
+
onChange={ onShadowChange }
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
{ isConfirmDialogVisible && (
|
|
210
|
+
<ConfirmDialog
|
|
211
|
+
isOpen
|
|
212
|
+
onConfirm={ () => {
|
|
213
|
+
handleShadowDelete();
|
|
214
|
+
setIsConfirmDialogVisible( false );
|
|
215
|
+
} }
|
|
216
|
+
onCancel={ () => {
|
|
217
|
+
setIsConfirmDialogVisible( false );
|
|
218
|
+
} }
|
|
219
|
+
confirmButtonText={ __( 'Delete' ) }
|
|
220
|
+
size="medium"
|
|
221
|
+
>
|
|
222
|
+
{ sprintf(
|
|
223
|
+
/* translators: %s: Name of the shadow preset. */
|
|
224
|
+
__(
|
|
225
|
+
'Are you sure you want to delete "%s" shadow preset?'
|
|
226
|
+
),
|
|
227
|
+
selectedShadow.name
|
|
228
|
+
) }
|
|
229
|
+
</ConfirmDialog>
|
|
230
|
+
) }
|
|
231
|
+
{ isRenameModalVisible && (
|
|
232
|
+
<Modal
|
|
233
|
+
title={ __( 'Rename' ) }
|
|
234
|
+
onRequestClose={ () => setIsRenameModalVisible( false ) }
|
|
235
|
+
size="small"
|
|
236
|
+
>
|
|
237
|
+
<form
|
|
238
|
+
onSubmit={ ( event ) => {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
handleShadowRename( shadowName );
|
|
241
|
+
setIsRenameModalVisible( false );
|
|
242
|
+
} }
|
|
243
|
+
>
|
|
244
|
+
<InputControl
|
|
245
|
+
__next40pxDefaultSize
|
|
246
|
+
autoComplete="off"
|
|
247
|
+
label={ __( 'Name' ) }
|
|
248
|
+
placeholder={ __( 'Shadow name' ) }
|
|
249
|
+
value={ shadowName ?? '' }
|
|
250
|
+
onChange={ setShadowName }
|
|
251
|
+
/>
|
|
252
|
+
<Spacer marginBottom={ 6 } />
|
|
253
|
+
<Flex
|
|
254
|
+
className="block-editor-shadow-edit-modal__actions"
|
|
255
|
+
justify="flex-end"
|
|
256
|
+
expanded={ false }
|
|
257
|
+
>
|
|
258
|
+
<FlexItem>
|
|
259
|
+
<Button
|
|
260
|
+
__next40pxDefaultSize
|
|
261
|
+
variant="tertiary"
|
|
262
|
+
onClick={ () =>
|
|
263
|
+
setIsRenameModalVisible( false )
|
|
264
|
+
}
|
|
265
|
+
>
|
|
266
|
+
{ __( 'Cancel' ) }
|
|
267
|
+
</Button>
|
|
268
|
+
</FlexItem>
|
|
269
|
+
<FlexItem>
|
|
270
|
+
<Button
|
|
271
|
+
__next40pxDefaultSize
|
|
272
|
+
variant="primary"
|
|
273
|
+
type="submit"
|
|
274
|
+
>
|
|
275
|
+
{ __( 'Save' ) }
|
|
276
|
+
</Button>
|
|
277
|
+
</FlexItem>
|
|
278
|
+
</Flex>
|
|
279
|
+
</form>
|
|
280
|
+
</Modal>
|
|
281
|
+
) }
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
interface ShadowsPreviewProps {
|
|
287
|
+
shadow: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function ShadowsPreview( { shadow }: ShadowsPreviewProps ) {
|
|
291
|
+
const shadowStyle = {
|
|
292
|
+
boxShadow: shadow,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<Spacer marginBottom={ 4 } marginTop={ -2 }>
|
|
297
|
+
<HStack
|
|
298
|
+
alignment="center"
|
|
299
|
+
justify="center"
|
|
300
|
+
className="global-styles-ui__shadow-preview-panel"
|
|
301
|
+
>
|
|
302
|
+
<div
|
|
303
|
+
className="global-styles-ui__shadow-preview-block"
|
|
304
|
+
style={ shadowStyle }
|
|
305
|
+
/>
|
|
306
|
+
</HStack>
|
|
307
|
+
</Spacer>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface ShadowEditorProps {
|
|
312
|
+
shadow: string;
|
|
313
|
+
onChange: ( shadow: string ) => void;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function ShadowEditor( { shadow, onChange }: ShadowEditorProps ) {
|
|
317
|
+
const addShadowButtonRef = useRef< HTMLButtonElement >( null );
|
|
318
|
+
const shadowParts = useMemo( () => getShadowParts( shadow ), [ shadow ] );
|
|
319
|
+
|
|
320
|
+
const onChangeShadowPart = ( index: number, part: string ) => {
|
|
321
|
+
const newShadowParts = [ ...shadowParts ];
|
|
322
|
+
newShadowParts[ index ] = part;
|
|
323
|
+
onChange( newShadowParts.join( ', ' ) );
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const onAddShadowPart = () => {
|
|
327
|
+
onChange( [ ...shadowParts, defaultShadow ].join( ', ' ) );
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const onRemoveShadowPart = ( index: number ) => {
|
|
331
|
+
onChange( shadowParts.filter( ( p, i ) => i !== index ).join( ', ' ) );
|
|
332
|
+
addShadowButtonRef.current?.focus();
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
return (
|
|
336
|
+
<>
|
|
337
|
+
<VStack spacing={ 2 }>
|
|
338
|
+
<HStack justify="space-between">
|
|
339
|
+
<Subtitle level={ 3 }>{ __( 'Shadows' ) }</Subtitle>
|
|
340
|
+
<FlexItem className="global-styles-ui__shadows-panel__options-container">
|
|
341
|
+
<Button
|
|
342
|
+
size="small"
|
|
343
|
+
icon={ plus }
|
|
344
|
+
label={ __( 'Add shadow' ) }
|
|
345
|
+
onClick={ () => {
|
|
346
|
+
onAddShadowPart();
|
|
347
|
+
} }
|
|
348
|
+
ref={ addShadowButtonRef }
|
|
349
|
+
/>
|
|
350
|
+
</FlexItem>
|
|
351
|
+
</HStack>
|
|
352
|
+
</VStack>
|
|
353
|
+
<Spacer />
|
|
354
|
+
<ItemGroup isBordered isSeparated>
|
|
355
|
+
{ shadowParts.map( ( part, index ) => (
|
|
356
|
+
<ShadowItem
|
|
357
|
+
key={ index }
|
|
358
|
+
shadow={ part }
|
|
359
|
+
onChange={ ( value ) =>
|
|
360
|
+
onChangeShadowPart( index, value )
|
|
361
|
+
}
|
|
362
|
+
canRemove={ shadowParts.length > 1 }
|
|
363
|
+
onRemove={ () => onRemoveShadowPart( index ) }
|
|
364
|
+
/>
|
|
365
|
+
) ) }
|
|
366
|
+
</ItemGroup>
|
|
367
|
+
</>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
interface ShadowItemProps {
|
|
372
|
+
shadow: string;
|
|
373
|
+
onChange: ( shadow: string ) => void;
|
|
374
|
+
canRemove: boolean;
|
|
375
|
+
onRemove: () => void;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function ShadowItem( {
|
|
379
|
+
shadow,
|
|
380
|
+
onChange,
|
|
381
|
+
canRemove,
|
|
382
|
+
onRemove,
|
|
383
|
+
}: ShadowItemProps ) {
|
|
384
|
+
const popoverProps = {
|
|
385
|
+
placement: 'left-start' as const,
|
|
386
|
+
offset: 36,
|
|
387
|
+
shift: true,
|
|
388
|
+
};
|
|
389
|
+
const shadowObj = useMemo(
|
|
390
|
+
() => shadowStringToObject( shadow ),
|
|
391
|
+
[ shadow ]
|
|
392
|
+
);
|
|
393
|
+
const onShadowChange = ( newShadow: any ) => {
|
|
394
|
+
onChange( shadowObjectToString( newShadow ) );
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Dropdown
|
|
399
|
+
popoverProps={ popoverProps }
|
|
400
|
+
className="global-styles-ui__shadow-editor__dropdown"
|
|
401
|
+
renderToggle={ ( { onToggle, isOpen } ) => {
|
|
402
|
+
const toggleProps = {
|
|
403
|
+
onClick: onToggle,
|
|
404
|
+
className: clsx(
|
|
405
|
+
'global-styles-ui__shadow-editor__dropdown-toggle',
|
|
406
|
+
{ 'is-open': isOpen }
|
|
407
|
+
),
|
|
408
|
+
'aria-expanded': isOpen,
|
|
409
|
+
};
|
|
410
|
+
const removeButtonProps = {
|
|
411
|
+
onClick: () => {
|
|
412
|
+
if ( isOpen ) {
|
|
413
|
+
onToggle();
|
|
414
|
+
}
|
|
415
|
+
onRemove();
|
|
416
|
+
},
|
|
417
|
+
className: clsx(
|
|
418
|
+
'global-styles-ui__shadow-editor__remove-button',
|
|
419
|
+
{ 'is-open': isOpen }
|
|
420
|
+
),
|
|
421
|
+
label: __( 'Remove shadow' ),
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<>
|
|
426
|
+
<Button
|
|
427
|
+
__next40pxDefaultSize
|
|
428
|
+
icon={ shadowIcon }
|
|
429
|
+
{ ...toggleProps }
|
|
430
|
+
>
|
|
431
|
+
{ shadowObj.inset
|
|
432
|
+
? __( 'Inner shadow' )
|
|
433
|
+
: __( 'Drop shadow' ) }
|
|
434
|
+
</Button>
|
|
435
|
+
{ canRemove && (
|
|
436
|
+
<Button
|
|
437
|
+
size="small"
|
|
438
|
+
icon={ reset }
|
|
439
|
+
{ ...removeButtonProps }
|
|
440
|
+
/>
|
|
441
|
+
) }
|
|
442
|
+
</>
|
|
443
|
+
);
|
|
444
|
+
} }
|
|
445
|
+
renderContent={ () => (
|
|
446
|
+
<DropdownContentWrapper
|
|
447
|
+
paddingSize="medium"
|
|
448
|
+
className="global-styles-ui__shadow-editor__dropdown-content"
|
|
449
|
+
>
|
|
450
|
+
<ShadowPopover
|
|
451
|
+
shadowObj={ shadowObj }
|
|
452
|
+
onChange={ onShadowChange }
|
|
453
|
+
/>
|
|
454
|
+
</DropdownContentWrapper>
|
|
455
|
+
) }
|
|
456
|
+
/>
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
interface ShadowPopoverProps {
|
|
461
|
+
shadowObj: any;
|
|
462
|
+
onChange: ( shadow: any ) => void;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function ShadowPopover( { shadowObj, onChange }: ShadowPopoverProps ) {
|
|
466
|
+
const __experimentalIsRenderedInSidebar = true;
|
|
467
|
+
const enableAlpha = true;
|
|
468
|
+
|
|
469
|
+
const onShadowChange = ( key: string, value: any ) => {
|
|
470
|
+
const newShadow = {
|
|
471
|
+
...shadowObj,
|
|
472
|
+
[ key ]: value,
|
|
473
|
+
};
|
|
474
|
+
onChange( newShadow );
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
return (
|
|
478
|
+
<VStack spacing={ 4 } className="global-styles-ui__shadow-editor-panel">
|
|
479
|
+
<ColorPalette
|
|
480
|
+
clearable={ false }
|
|
481
|
+
enableAlpha={ enableAlpha }
|
|
482
|
+
__experimentalIsRenderedInSidebar={
|
|
483
|
+
__experimentalIsRenderedInSidebar
|
|
484
|
+
}
|
|
485
|
+
value={ shadowObj.color }
|
|
486
|
+
onChange={ ( value ) => onShadowChange( 'color', value ) }
|
|
487
|
+
/>
|
|
488
|
+
<ToggleGroupControl
|
|
489
|
+
label={ __( 'Shadow Type' ) }
|
|
490
|
+
__nextHasNoMarginBottom
|
|
491
|
+
value={ shadowObj.inset ? 'inset' : 'outset' }
|
|
492
|
+
isBlock
|
|
493
|
+
onChange={ ( value ) =>
|
|
494
|
+
onShadowChange( 'inset', value === 'inset' )
|
|
495
|
+
}
|
|
496
|
+
hideLabelFromVision
|
|
497
|
+
__next40pxDefaultSize
|
|
498
|
+
>
|
|
499
|
+
<ToggleGroupControlOption
|
|
500
|
+
value="outset"
|
|
501
|
+
label={ __( 'Outset' ) }
|
|
502
|
+
/>
|
|
503
|
+
<ToggleGroupControlOption
|
|
504
|
+
value="inset"
|
|
505
|
+
label={ __( 'Inset' ) }
|
|
506
|
+
/>
|
|
507
|
+
</ToggleGroupControl>
|
|
508
|
+
<Grid columns={ 2 } gap={ 4 }>
|
|
509
|
+
<ShadowInputControl
|
|
510
|
+
label={ __( 'X Position' ) }
|
|
511
|
+
value={ shadowObj.x }
|
|
512
|
+
onChange={ ( value ) => onShadowChange( 'x', value ) }
|
|
513
|
+
/>
|
|
514
|
+
<ShadowInputControl
|
|
515
|
+
label={ __( 'Y Position' ) }
|
|
516
|
+
value={ shadowObj.y }
|
|
517
|
+
onChange={ ( value ) => onShadowChange( 'y', value ) }
|
|
518
|
+
/>
|
|
519
|
+
<ShadowInputControl
|
|
520
|
+
label={ __( 'Blur' ) }
|
|
521
|
+
value={ shadowObj.blur }
|
|
522
|
+
onChange={ ( value ) => onShadowChange( 'blur', value ) }
|
|
523
|
+
/>
|
|
524
|
+
<ShadowInputControl
|
|
525
|
+
label={ __( 'Spread' ) }
|
|
526
|
+
value={ shadowObj.spread }
|
|
527
|
+
onChange={ ( value ) => onShadowChange( 'spread', value ) }
|
|
528
|
+
/>
|
|
529
|
+
</Grid>
|
|
530
|
+
</VStack>
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
interface ShadowInputControlProps {
|
|
535
|
+
label: string;
|
|
536
|
+
value: string;
|
|
537
|
+
onChange: ( value: string ) => void;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function ShadowInputControl( {
|
|
541
|
+
label,
|
|
542
|
+
value,
|
|
543
|
+
onChange,
|
|
544
|
+
}: ShadowInputControlProps ) {
|
|
545
|
+
const onValueChange = ( next: string | undefined ) => {
|
|
546
|
+
const isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );
|
|
547
|
+
const nextValue = isNumeric ? next : '0px';
|
|
548
|
+
onChange( nextValue );
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
return (
|
|
552
|
+
<UnitControl
|
|
553
|
+
label={ label }
|
|
554
|
+
__next40pxDefaultSize
|
|
555
|
+
value={ value }
|
|
556
|
+
onChange={ onValueChange }
|
|
557
|
+
/>
|
|
558
|
+
);
|
|
559
|
+
}
|