@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,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggles the activation of a given font or font variant within a list of custom fonts.
|
|
3
|
+
*
|
|
4
|
+
* - If only the font is provided (without face), the entire font family's activation is toggled.
|
|
5
|
+
* - If both font and face are provided, the activation of the specific font variant is toggled.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} font - The font to be toggled.
|
|
8
|
+
* @param {string} font.slug - The unique identifier for the font.
|
|
9
|
+
* @param {Array} [font.fontFace] - The list of font variants (faces) associated with the font.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} [face] - The specific font variant to be toggled.
|
|
12
|
+
* @param {string} face.fontWeight - The weight of the font variant.
|
|
13
|
+
* @param {string} face.fontStyle - The style of the font variant.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array} initialfonts - The initial list of custom fonts.
|
|
16
|
+
*
|
|
17
|
+
* @return {Array} - The updated list of custom fonts with the font/font variant toggled.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const customFonts = [
|
|
21
|
+
* { slug: 'roboto', fontFace: [{ fontWeight: '400', fontStyle: 'normal' }] }
|
|
22
|
+
* ];
|
|
23
|
+
*
|
|
24
|
+
* toggleFont({ slug: 'roboto' }, null, customFonts);
|
|
25
|
+
* // This will remove 'roboto' from customFonts
|
|
26
|
+
*
|
|
27
|
+
* toggleFont({ slug: 'roboto' }, { fontWeight: '400', fontStyle: 'normal' }, customFonts);
|
|
28
|
+
* // This will remove the specified face from 'roboto' in customFonts
|
|
29
|
+
*
|
|
30
|
+
* toggleFont({ slug: 'roboto' }, { fontWeight: '500', fontStyle: 'normal' }, customFonts);
|
|
31
|
+
* // This will add the specified face to 'roboto' in customFonts
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Internal dependencies
|
|
35
|
+
*/
|
|
36
|
+
import type { FontFamily, FontFace } from '../types';
|
|
37
|
+
|
|
38
|
+
export function toggleFont(
|
|
39
|
+
font: FontFamily,
|
|
40
|
+
face?: FontFace,
|
|
41
|
+
initialfonts: FontFamily[] = []
|
|
42
|
+
): FontFamily[] {
|
|
43
|
+
// Helper to check if a font is activated based on its slug
|
|
44
|
+
const isFontActivated = ( f: FontFamily ): boolean => f.slug === font.slug;
|
|
45
|
+
|
|
46
|
+
// Helper to get the activated font from a list of fonts
|
|
47
|
+
const getActivatedFont = ( fonts: FontFamily[] ): FontFamily | undefined =>
|
|
48
|
+
fonts.find( isFontActivated );
|
|
49
|
+
|
|
50
|
+
// Toggle the activation status of an entire font family
|
|
51
|
+
const toggleEntireFontFamily = (
|
|
52
|
+
activatedFont: FontFamily | undefined
|
|
53
|
+
): FontFamily[] => {
|
|
54
|
+
if ( ! activatedFont ) {
|
|
55
|
+
// If the font is not active, activate the entire font family
|
|
56
|
+
return [ ...initialfonts, font ];
|
|
57
|
+
}
|
|
58
|
+
// If the font is already active, deactivate the entire font family
|
|
59
|
+
return initialfonts.filter(
|
|
60
|
+
( f: FontFamily ) => ! isFontActivated( f )
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Toggle the activation status of a specific font variant
|
|
65
|
+
const toggleFontVariant = (
|
|
66
|
+
activatedFont: FontFamily | undefined
|
|
67
|
+
): FontFamily[] => {
|
|
68
|
+
const isFaceActivated = ( f: FontFace ): boolean =>
|
|
69
|
+
f.fontWeight === face!.fontWeight &&
|
|
70
|
+
f.fontStyle === face!.fontStyle;
|
|
71
|
+
|
|
72
|
+
if ( ! activatedFont ) {
|
|
73
|
+
// If the font family is not active, activate the font family with the font variant
|
|
74
|
+
return [ ...initialfonts, { ...font, fontFace: [ face! ] } ];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let newFontFaces = activatedFont.fontFace || [];
|
|
78
|
+
|
|
79
|
+
if ( newFontFaces.find( isFaceActivated ) ) {
|
|
80
|
+
// If the font variant is active, deactivate it
|
|
81
|
+
newFontFaces = newFontFaces.filter(
|
|
82
|
+
( f: FontFace ) => ! isFaceActivated( f )
|
|
83
|
+
);
|
|
84
|
+
} else {
|
|
85
|
+
// If the font variant is not active, activate it
|
|
86
|
+
newFontFaces = [ ...newFontFaces, face! ];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// If there are no more font faces, deactivate the font family
|
|
90
|
+
if ( newFontFaces.length === 0 ) {
|
|
91
|
+
return initialfonts.filter(
|
|
92
|
+
( f: FontFamily ) => ! isFontActivated( f )
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Return updated fonts list with toggled font variant
|
|
97
|
+
return initialfonts.map( ( f: FontFamily ) =>
|
|
98
|
+
isFontActivated( f ) ? { ...f, fontFace: newFontFaces } : f
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const activatedFont = getActivatedFont( initialfonts );
|
|
103
|
+
|
|
104
|
+
if ( ! face ) {
|
|
105
|
+
return toggleEntireFontFamily( activatedFont );
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return toggleFontVariant( activatedFont );
|
|
109
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import type { FontSize } from '@wordpress/global-styles-engine';
|
|
7
|
+
|
|
8
|
+
interface ConfirmDeleteFontSizeDialogProps {
|
|
9
|
+
fontSize: FontSize;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
toggleOpen: () => void;
|
|
12
|
+
handleRemoveFontSize: ( fontSize: FontSize ) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ConfirmDeleteFontSizeDialog( {
|
|
16
|
+
fontSize,
|
|
17
|
+
isOpen,
|
|
18
|
+
toggleOpen,
|
|
19
|
+
handleRemoveFontSize,
|
|
20
|
+
}: ConfirmDeleteFontSizeDialogProps ) {
|
|
21
|
+
const handleConfirm = async () => {
|
|
22
|
+
toggleOpen();
|
|
23
|
+
handleRemoveFontSize( fontSize );
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleCancel = () => {
|
|
27
|
+
toggleOpen();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ConfirmDialog
|
|
32
|
+
isOpen={ isOpen }
|
|
33
|
+
cancelButtonText={ __( 'Cancel' ) }
|
|
34
|
+
confirmButtonText={ __( 'Delete' ) }
|
|
35
|
+
onCancel={ handleCancel }
|
|
36
|
+
onConfirm={ handleConfirm }
|
|
37
|
+
size="medium"
|
|
38
|
+
>
|
|
39
|
+
{ fontSize &&
|
|
40
|
+
sprintf(
|
|
41
|
+
/* translators: %s: Name of the font size preset. */
|
|
42
|
+
__(
|
|
43
|
+
'Are you sure you want to delete "%s" font size preset?'
|
|
44
|
+
),
|
|
45
|
+
fontSize.name
|
|
46
|
+
) }
|
|
47
|
+
</ConfirmDialog>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default ConfirmDeleteFontSizeDialog;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
interface ConfirmResetFontSizesDialogProps {
|
|
8
|
+
text: string;
|
|
9
|
+
confirmButtonText: string;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
toggleOpen: () => void;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ConfirmResetFontSizesDialog( {
|
|
16
|
+
text,
|
|
17
|
+
confirmButtonText,
|
|
18
|
+
isOpen,
|
|
19
|
+
toggleOpen,
|
|
20
|
+
onConfirm,
|
|
21
|
+
}: ConfirmResetFontSizesDialogProps ) {
|
|
22
|
+
const handleConfirm = async () => {
|
|
23
|
+
toggleOpen();
|
|
24
|
+
onConfirm();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handleCancel = () => {
|
|
28
|
+
toggleOpen();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ConfirmDialog
|
|
33
|
+
isOpen={ isOpen }
|
|
34
|
+
cancelButtonText={ __( 'Cancel' ) }
|
|
35
|
+
confirmButtonText={ confirmButtonText }
|
|
36
|
+
onCancel={ handleCancel }
|
|
37
|
+
onConfirm={ handleConfirm }
|
|
38
|
+
size="medium"
|
|
39
|
+
>
|
|
40
|
+
{ text }
|
|
41
|
+
</ConfirmDialog>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default ConfirmResetFontSizesDialog;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
// @ts-expect-error: Not typed yet.
|
|
5
|
+
import { getComputedFluidTypographyValue } from '@wordpress/block-editor';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import type { FontSize } from '@wordpress/global-styles-engine';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { useStyle } from '../hooks';
|
|
13
|
+
|
|
14
|
+
interface FontSizePreviewProps {
|
|
15
|
+
fontSize: FontSize;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function FontSizePreview( { fontSize }: FontSizePreviewProps ) {
|
|
19
|
+
const [ font ] = useStyle< { fontFamily?: string } >( 'typography' );
|
|
20
|
+
|
|
21
|
+
const input =
|
|
22
|
+
typeof fontSize?.fluid === 'object' &&
|
|
23
|
+
fontSize?.fluid?.min &&
|
|
24
|
+
fontSize?.fluid?.max
|
|
25
|
+
? {
|
|
26
|
+
minimumFontSize: fontSize.fluid.min,
|
|
27
|
+
maximumFontSize: fontSize.fluid.max,
|
|
28
|
+
}
|
|
29
|
+
: {
|
|
30
|
+
fontSize: fontSize.size,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const computedFontSize = getComputedFluidTypographyValue( input );
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
className="global-styles-ui-typography-preview"
|
|
37
|
+
style={ {
|
|
38
|
+
fontSize: computedFontSize,
|
|
39
|
+
fontFamily: font?.fontFamily ?? 'serif',
|
|
40
|
+
} }
|
|
41
|
+
>
|
|
42
|
+
{ __( 'Aa' ) }
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default FontSizePreview;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalSpacer as Spacer,
|
|
7
|
+
useNavigator,
|
|
8
|
+
__experimentalView as View,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
11
|
+
privateApis as componentsPrivateApis,
|
|
12
|
+
Button,
|
|
13
|
+
FlexItem,
|
|
14
|
+
ToggleControl,
|
|
15
|
+
} from '@wordpress/components';
|
|
16
|
+
import { moreVertical } from '@wordpress/icons';
|
|
17
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
18
|
+
import type {
|
|
19
|
+
TypographyPreset,
|
|
20
|
+
FluidTypographySettings,
|
|
21
|
+
FontSize,
|
|
22
|
+
FluidTypographyConfig,
|
|
23
|
+
} from '@wordpress/global-styles-engine';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { ScreenHeader } from '../screen-header';
|
|
29
|
+
import FontSizePreview from './font-size-preview';
|
|
30
|
+
import ConfirmDeleteFontSizeDialog from './confirm-delete-font-size-dialog';
|
|
31
|
+
import RenameFontSizeDialog from './rename-font-size-dialog';
|
|
32
|
+
import { SizeControl } from '../size-control';
|
|
33
|
+
import { useSetting } from '../hooks';
|
|
34
|
+
import { unlock } from '../lock-unlock';
|
|
35
|
+
|
|
36
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
37
|
+
|
|
38
|
+
function FontSize() {
|
|
39
|
+
const [ isDeleteConfirmOpen, setIsDeleteConfirmOpen ] = useState( false );
|
|
40
|
+
const [ isRenameDialogOpen, setIsRenameDialogOpen ] = useState( false );
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
params: { origin, slug },
|
|
44
|
+
goBack,
|
|
45
|
+
} = useNavigator();
|
|
46
|
+
|
|
47
|
+
const [ fontSizes, setFontSizes ] = useSetting<
|
|
48
|
+
Record< string, TypographyPreset[] > | undefined
|
|
49
|
+
>( 'typography.fontSizes' );
|
|
50
|
+
const [ globalFluid ] = useSetting<
|
|
51
|
+
boolean | FluidTypographySettings | undefined
|
|
52
|
+
>( 'typography.fluid' );
|
|
53
|
+
|
|
54
|
+
// Get the font sizes from the origin, default to empty array.
|
|
55
|
+
const sizes = fontSizes?.[ origin as string ] ?? [];
|
|
56
|
+
|
|
57
|
+
// Get the font size by slug.
|
|
58
|
+
const fontSize: FontSize | undefined = sizes.find(
|
|
59
|
+
( size ) => size.slug === slug
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Navigate to the font sizes list if the font size is not available.
|
|
63
|
+
useEffect( () => {
|
|
64
|
+
if ( !! slug && ! fontSize ) {
|
|
65
|
+
goBack();
|
|
66
|
+
}
|
|
67
|
+
}, [ slug, fontSize, goBack ] );
|
|
68
|
+
|
|
69
|
+
if ( ! origin || ! slug || ! fontSize ) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Whether the font size is fluid. If not defined, use the global fluid value of the theme.
|
|
74
|
+
const isFluid =
|
|
75
|
+
fontSize?.fluid !== undefined ? !! fontSize.fluid : !! globalFluid;
|
|
76
|
+
|
|
77
|
+
// Whether custom fluid values are used.
|
|
78
|
+
const isCustomFluid = typeof fontSize?.fluid === 'object';
|
|
79
|
+
|
|
80
|
+
const handleNameChange = ( value: string ) => {
|
|
81
|
+
updateFontSize( 'name', value );
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleFontSizeChange = ( value: string | undefined ) => {
|
|
85
|
+
updateFontSize( 'size', value );
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const handleFluidChange = ( value: boolean ) => {
|
|
89
|
+
updateFontSize( 'fluid', value );
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleCustomFluidValues = ( value: boolean ) => {
|
|
93
|
+
if ( value ) {
|
|
94
|
+
// If custom values are used, init the values with the current ones.
|
|
95
|
+
updateFontSize( 'fluid', {
|
|
96
|
+
min: fontSize.size,
|
|
97
|
+
max: fontSize.size,
|
|
98
|
+
} );
|
|
99
|
+
} else {
|
|
100
|
+
// If custom fluid values are disabled, set fluid to true.
|
|
101
|
+
updateFontSize( 'fluid', true );
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const handleMinChange = ( value: string | undefined ) => {
|
|
106
|
+
const fluid: FluidTypographyConfig =
|
|
107
|
+
typeof fontSize.fluid === 'object' ? fontSize.fluid : {};
|
|
108
|
+
updateFontSize( 'fluid', { ...fluid, min: value } );
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const handleMaxChange = ( value: string | undefined ) => {
|
|
112
|
+
const fluid: FluidTypographyConfig =
|
|
113
|
+
typeof fontSize.fluid === 'object' ? fontSize.fluid : {};
|
|
114
|
+
updateFontSize( 'fluid', { ...fluid, max: value } );
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const updateFontSize = ( key: string, value: any ) => {
|
|
118
|
+
const newFontSizes = sizes.map( ( size ) => {
|
|
119
|
+
if ( size.slug === slug ) {
|
|
120
|
+
return { ...size, [ key ]: value }; // Create a new object with updated key
|
|
121
|
+
}
|
|
122
|
+
return size;
|
|
123
|
+
} );
|
|
124
|
+
|
|
125
|
+
setFontSizes( {
|
|
126
|
+
...fontSizes,
|
|
127
|
+
[ origin as string ]: newFontSizes,
|
|
128
|
+
} );
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleRemoveFontSize = () => {
|
|
132
|
+
const newFontSizes = sizes.filter( ( size ) => size.slug !== slug );
|
|
133
|
+
setFontSizes( {
|
|
134
|
+
...fontSizes,
|
|
135
|
+
[ origin as string ]: newFontSizes,
|
|
136
|
+
} );
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const toggleDeleteConfirm = () => {
|
|
140
|
+
setIsDeleteConfirmOpen( ! isDeleteConfirmOpen );
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const toggleRenameDialog = () => {
|
|
144
|
+
setIsRenameDialogOpen( ! isRenameDialogOpen );
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<>
|
|
149
|
+
<ConfirmDeleteFontSizeDialog
|
|
150
|
+
fontSize={ fontSize }
|
|
151
|
+
isOpen={ isDeleteConfirmOpen }
|
|
152
|
+
toggleOpen={ toggleDeleteConfirm }
|
|
153
|
+
handleRemoveFontSize={ handleRemoveFontSize }
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
{ isRenameDialogOpen && (
|
|
157
|
+
<RenameFontSizeDialog
|
|
158
|
+
fontSize={ fontSize }
|
|
159
|
+
toggleOpen={ toggleRenameDialog }
|
|
160
|
+
handleRename={ handleNameChange }
|
|
161
|
+
/>
|
|
162
|
+
) }
|
|
163
|
+
|
|
164
|
+
<VStack spacing={ 4 }>
|
|
165
|
+
<HStack justify="space-between" alignment="flex-start">
|
|
166
|
+
<ScreenHeader
|
|
167
|
+
title={ fontSize.name }
|
|
168
|
+
description={ sprintf(
|
|
169
|
+
/* translators: %s: font size preset name. */
|
|
170
|
+
__( 'Manage the font size %s.' ),
|
|
171
|
+
fontSize.name
|
|
172
|
+
) }
|
|
173
|
+
/>
|
|
174
|
+
{ origin === 'custom' && (
|
|
175
|
+
<FlexItem>
|
|
176
|
+
<Spacer
|
|
177
|
+
marginTop={ 3 }
|
|
178
|
+
marginBottom={ 0 }
|
|
179
|
+
paddingX={ 4 }
|
|
180
|
+
>
|
|
181
|
+
<Menu>
|
|
182
|
+
<Menu.TriggerButton
|
|
183
|
+
render={
|
|
184
|
+
<Button
|
|
185
|
+
size="small"
|
|
186
|
+
icon={ moreVertical }
|
|
187
|
+
label={ __(
|
|
188
|
+
'Font size options'
|
|
189
|
+
) }
|
|
190
|
+
/>
|
|
191
|
+
}
|
|
192
|
+
/>
|
|
193
|
+
<Menu.Popover>
|
|
194
|
+
<Menu.Item
|
|
195
|
+
onClick={ toggleRenameDialog }
|
|
196
|
+
>
|
|
197
|
+
<Menu.ItemLabel>
|
|
198
|
+
{ __( 'Rename' ) }
|
|
199
|
+
</Menu.ItemLabel>
|
|
200
|
+
</Menu.Item>
|
|
201
|
+
<Menu.Item
|
|
202
|
+
onClick={ toggleDeleteConfirm }
|
|
203
|
+
>
|
|
204
|
+
<Menu.ItemLabel>
|
|
205
|
+
{ __( 'Delete' ) }
|
|
206
|
+
</Menu.ItemLabel>
|
|
207
|
+
</Menu.Item>
|
|
208
|
+
</Menu.Popover>
|
|
209
|
+
</Menu>
|
|
210
|
+
</Spacer>
|
|
211
|
+
</FlexItem>
|
|
212
|
+
) }
|
|
213
|
+
</HStack>
|
|
214
|
+
|
|
215
|
+
<View>
|
|
216
|
+
<Spacer
|
|
217
|
+
paddingX={ 4 }
|
|
218
|
+
marginBottom={ 0 }
|
|
219
|
+
paddingBottom={ 6 }
|
|
220
|
+
>
|
|
221
|
+
<VStack spacing={ 4 }>
|
|
222
|
+
<FlexItem>
|
|
223
|
+
<FontSizePreview fontSize={ fontSize } />
|
|
224
|
+
</FlexItem>
|
|
225
|
+
|
|
226
|
+
<SizeControl
|
|
227
|
+
label={ __( 'Size' ) }
|
|
228
|
+
value={
|
|
229
|
+
! isCustomFluid && fontSize.size
|
|
230
|
+
? String( fontSize.size )
|
|
231
|
+
: ''
|
|
232
|
+
}
|
|
233
|
+
onChange={ handleFontSizeChange }
|
|
234
|
+
disabled={ isCustomFluid }
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
<ToggleControl
|
|
238
|
+
label={ __( 'Fluid typography' ) }
|
|
239
|
+
help={ __(
|
|
240
|
+
'Scale the font size dynamically to fit the screen or viewport.'
|
|
241
|
+
) }
|
|
242
|
+
checked={ isFluid }
|
|
243
|
+
onChange={ handleFluidChange }
|
|
244
|
+
__nextHasNoMarginBottom
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
{ isFluid && (
|
|
248
|
+
<ToggleControl
|
|
249
|
+
label={ __( 'Custom fluid values' ) }
|
|
250
|
+
help={ __(
|
|
251
|
+
'Set custom min and max values for the fluid font size.'
|
|
252
|
+
) }
|
|
253
|
+
checked={ isCustomFluid }
|
|
254
|
+
onChange={ handleCustomFluidValues }
|
|
255
|
+
__nextHasNoMarginBottom
|
|
256
|
+
/>
|
|
257
|
+
) }
|
|
258
|
+
|
|
259
|
+
{ isCustomFluid && (
|
|
260
|
+
<>
|
|
261
|
+
<SizeControl
|
|
262
|
+
label={ __( 'Minimum' ) }
|
|
263
|
+
value={
|
|
264
|
+
typeof fontSize?.fluid === 'object'
|
|
265
|
+
? fontSize.fluid?.min
|
|
266
|
+
: undefined
|
|
267
|
+
}
|
|
268
|
+
onChange={ handleMinChange }
|
|
269
|
+
/>
|
|
270
|
+
<SizeControl
|
|
271
|
+
label={ __( 'Maximum' ) }
|
|
272
|
+
value={
|
|
273
|
+
typeof fontSize?.fluid === 'object'
|
|
274
|
+
? fontSize.fluid?.max
|
|
275
|
+
: undefined
|
|
276
|
+
}
|
|
277
|
+
onChange={ handleMaxChange }
|
|
278
|
+
/>
|
|
279
|
+
</>
|
|
280
|
+
) }
|
|
281
|
+
</VStack>
|
|
282
|
+
</Spacer>
|
|
283
|
+
</View>
|
|
284
|
+
</VStack>
|
|
285
|
+
</>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export default FontSize;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalItemGroup as ItemGroup,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
__experimentalHStack as HStack,
|
|
9
|
+
FlexItem,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { Subtitle } from '../subtitle';
|
|
17
|
+
import { NavigationButtonAsItem } from '../navigation-button';
|
|
18
|
+
|
|
19
|
+
function FontSizes() {
|
|
20
|
+
return (
|
|
21
|
+
<VStack spacing={ 2 }>
|
|
22
|
+
<HStack justify="space-between">
|
|
23
|
+
<Subtitle level={ 3 }>{ __( 'Font Sizes' ) }</Subtitle>
|
|
24
|
+
</HStack>
|
|
25
|
+
<ItemGroup isBordered isSeparated>
|
|
26
|
+
<NavigationButtonAsItem path="/typography/font-sizes">
|
|
27
|
+
<HStack direction="row">
|
|
28
|
+
<FlexItem>{ __( 'Font size presets' ) }</FlexItem>
|
|
29
|
+
<Icon icon={ isRTL() ? chevronLeft : chevronRight } />
|
|
30
|
+
</HStack>
|
|
31
|
+
</NavigationButtonAsItem>
|
|
32
|
+
</ItemGroup>
|
|
33
|
+
</VStack>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default FontSizes;
|