@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,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
privateApis as componentsPrivateApis,
|
|
7
|
+
__experimentalSpacer as Spacer,
|
|
8
|
+
__experimentalView as View,
|
|
9
|
+
__experimentalItemGroup as ItemGroup,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
11
|
+
__experimentalHStack as HStack,
|
|
12
|
+
FlexItem,
|
|
13
|
+
Button,
|
|
14
|
+
} from '@wordpress/components';
|
|
15
|
+
import {
|
|
16
|
+
Icon,
|
|
17
|
+
plus,
|
|
18
|
+
moreVertical,
|
|
19
|
+
chevronLeft,
|
|
20
|
+
chevronRight,
|
|
21
|
+
} from '@wordpress/icons';
|
|
22
|
+
import { useState } from '@wordpress/element';
|
|
23
|
+
import type { FontSize } from '@wordpress/global-styles-engine';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { Subtitle } from '../subtitle';
|
|
29
|
+
import { NavigationButtonAsItem } from '../navigation-button';
|
|
30
|
+
import { getNewIndexFromPresets } from '../utils';
|
|
31
|
+
import { ScreenHeader } from '../screen-header';
|
|
32
|
+
import ConfirmResetFontSizesDialog from './confirm-reset-font-sizes-dialog';
|
|
33
|
+
import { useSetting } from '../hooks';
|
|
34
|
+
import { unlock } from '../lock-unlock';
|
|
35
|
+
|
|
36
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
37
|
+
|
|
38
|
+
interface FontSizeGroupProps {
|
|
39
|
+
label: string;
|
|
40
|
+
origin: string;
|
|
41
|
+
sizes: FontSize[];
|
|
42
|
+
handleAddFontSize: () => void;
|
|
43
|
+
handleResetFontSizes?: () => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function FontSizeGroup( {
|
|
47
|
+
label,
|
|
48
|
+
origin,
|
|
49
|
+
sizes,
|
|
50
|
+
handleAddFontSize,
|
|
51
|
+
handleResetFontSizes,
|
|
52
|
+
}: FontSizeGroupProps ) {
|
|
53
|
+
const [ isResetDialogOpen, setIsResetDialogOpen ] = useState( false );
|
|
54
|
+
|
|
55
|
+
const toggleResetDialog = () => setIsResetDialogOpen( ! isResetDialogOpen );
|
|
56
|
+
|
|
57
|
+
const resetDialogText =
|
|
58
|
+
origin === 'custom'
|
|
59
|
+
? __(
|
|
60
|
+
'Are you sure you want to remove all custom font size presets?'
|
|
61
|
+
)
|
|
62
|
+
: __(
|
|
63
|
+
'Are you sure you want to reset all font size presets to their default values?'
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
{ handleResetFontSizes && isResetDialogOpen && (
|
|
69
|
+
<ConfirmResetFontSizesDialog
|
|
70
|
+
text={ resetDialogText }
|
|
71
|
+
confirmButtonText={
|
|
72
|
+
origin === 'custom' ? __( 'Remove' ) : __( 'Reset' )
|
|
73
|
+
}
|
|
74
|
+
isOpen={ isResetDialogOpen }
|
|
75
|
+
toggleOpen={ toggleResetDialog }
|
|
76
|
+
onConfirm={ handleResetFontSizes }
|
|
77
|
+
/>
|
|
78
|
+
) }
|
|
79
|
+
<VStack spacing={ 4 }>
|
|
80
|
+
<HStack>
|
|
81
|
+
<Subtitle level={ 3 }>{ label }</Subtitle>
|
|
82
|
+
<FlexItem className="global-styles-ui__typography-panel__options-container">
|
|
83
|
+
{ origin === 'custom' && (
|
|
84
|
+
<Button
|
|
85
|
+
label={ __( 'Add font size' ) }
|
|
86
|
+
icon={ plus }
|
|
87
|
+
size="small"
|
|
88
|
+
onClick={ handleAddFontSize }
|
|
89
|
+
/>
|
|
90
|
+
) }
|
|
91
|
+
{ !! handleResetFontSizes && (
|
|
92
|
+
<Menu>
|
|
93
|
+
<Menu.TriggerButton
|
|
94
|
+
render={
|
|
95
|
+
<Button
|
|
96
|
+
size="small"
|
|
97
|
+
icon={ moreVertical }
|
|
98
|
+
label={ __(
|
|
99
|
+
'Font size presets options'
|
|
100
|
+
) }
|
|
101
|
+
/>
|
|
102
|
+
}
|
|
103
|
+
/>
|
|
104
|
+
<Menu.Popover>
|
|
105
|
+
<Menu.Item onClick={ toggleResetDialog }>
|
|
106
|
+
<Menu.ItemLabel>
|
|
107
|
+
{ origin === 'custom'
|
|
108
|
+
? __(
|
|
109
|
+
'Remove font size presets'
|
|
110
|
+
)
|
|
111
|
+
: __(
|
|
112
|
+
'Reset font size presets'
|
|
113
|
+
) }
|
|
114
|
+
</Menu.ItemLabel>
|
|
115
|
+
</Menu.Item>
|
|
116
|
+
</Menu.Popover>
|
|
117
|
+
</Menu>
|
|
118
|
+
) }
|
|
119
|
+
</FlexItem>
|
|
120
|
+
</HStack>
|
|
121
|
+
|
|
122
|
+
{ !! sizes.length && (
|
|
123
|
+
<ItemGroup isBordered isSeparated>
|
|
124
|
+
{ sizes.map( ( size ) => (
|
|
125
|
+
<NavigationButtonAsItem
|
|
126
|
+
key={ size.slug }
|
|
127
|
+
path={ `/typography/font-sizes/${ origin }/${ size.slug }` }
|
|
128
|
+
>
|
|
129
|
+
<HStack>
|
|
130
|
+
<FlexItem className="global-styles-ui-font-size__item">
|
|
131
|
+
{ size.name }
|
|
132
|
+
</FlexItem>
|
|
133
|
+
<FlexItem display="flex">
|
|
134
|
+
<Icon
|
|
135
|
+
icon={
|
|
136
|
+
isRTL()
|
|
137
|
+
? chevronLeft
|
|
138
|
+
: chevronRight
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
</FlexItem>
|
|
142
|
+
</HStack>
|
|
143
|
+
</NavigationButtonAsItem>
|
|
144
|
+
) ) }
|
|
145
|
+
</ItemGroup>
|
|
146
|
+
) }
|
|
147
|
+
</VStack>
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function FontSizes() {
|
|
153
|
+
const [ themeFontSizes, setThemeFontSizes ] = useSetting(
|
|
154
|
+
'typography.fontSizes.theme'
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const [ baseThemeFontSizes ] = useSetting(
|
|
158
|
+
'typography.fontSizes.theme',
|
|
159
|
+
'base'
|
|
160
|
+
);
|
|
161
|
+
const [ defaultFontSizes, setDefaultFontSizes ] = useSetting(
|
|
162
|
+
'typography.fontSizes.default'
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const [ baseDefaultFontSizes ] = useSetting(
|
|
166
|
+
'typography.fontSizes.default',
|
|
167
|
+
'base'
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const [ customFontSizes = [], setCustomFontSizes ] = useSetting(
|
|
171
|
+
'typography.fontSizes.custom'
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const [ defaultFontSizesEnabled ] = useSetting(
|
|
175
|
+
'typography.defaultFontSizes'
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const handleAddFontSize = () => {
|
|
179
|
+
const index = getNewIndexFromPresets( customFontSizes, 'custom-' );
|
|
180
|
+
const newFontSize = {
|
|
181
|
+
/* translators: %d: font size index */
|
|
182
|
+
name: sprintf( __( 'New Font Size %d' ), index ),
|
|
183
|
+
size: '16px',
|
|
184
|
+
slug: `custom-${ index }`,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
setCustomFontSizes( [ ...customFontSizes, newFontSize ] );
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const hasSameSizeValues = ( arr1: FontSize[], arr2: FontSize[] ): boolean =>
|
|
191
|
+
arr1.map( ( item ) => item.size ).join( '' ) ===
|
|
192
|
+
arr2.map( ( item ) => item.size ).join( '' );
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<VStack spacing={ 2 }>
|
|
196
|
+
<ScreenHeader
|
|
197
|
+
title={ __( 'Font size presets' ) }
|
|
198
|
+
description={ __(
|
|
199
|
+
'Create and edit the presets used for font sizes across the site.'
|
|
200
|
+
) }
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
<View>
|
|
204
|
+
<Spacer paddingX={ 4 }>
|
|
205
|
+
<VStack spacing={ 8 }>
|
|
206
|
+
{ !! themeFontSizes?.length && (
|
|
207
|
+
<FontSizeGroup
|
|
208
|
+
label={ __( 'Theme' ) }
|
|
209
|
+
origin="theme"
|
|
210
|
+
sizes={ themeFontSizes }
|
|
211
|
+
handleAddFontSize={ handleAddFontSize }
|
|
212
|
+
handleResetFontSizes={
|
|
213
|
+
hasSameSizeValues(
|
|
214
|
+
themeFontSizes,
|
|
215
|
+
baseThemeFontSizes
|
|
216
|
+
)
|
|
217
|
+
? undefined
|
|
218
|
+
: () =>
|
|
219
|
+
setThemeFontSizes(
|
|
220
|
+
baseThemeFontSizes
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
/>
|
|
224
|
+
) }
|
|
225
|
+
|
|
226
|
+
{ defaultFontSizesEnabled &&
|
|
227
|
+
!! defaultFontSizes?.length && (
|
|
228
|
+
<FontSizeGroup
|
|
229
|
+
label={ __( 'Default' ) }
|
|
230
|
+
origin="default"
|
|
231
|
+
sizes={ defaultFontSizes }
|
|
232
|
+
handleAddFontSize={ handleAddFontSize }
|
|
233
|
+
handleResetFontSizes={
|
|
234
|
+
hasSameSizeValues(
|
|
235
|
+
defaultFontSizes,
|
|
236
|
+
baseDefaultFontSizes
|
|
237
|
+
)
|
|
238
|
+
? undefined
|
|
239
|
+
: () =>
|
|
240
|
+
setDefaultFontSizes(
|
|
241
|
+
baseDefaultFontSizes
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
/>
|
|
245
|
+
) }
|
|
246
|
+
|
|
247
|
+
<FontSizeGroup
|
|
248
|
+
label={ __( 'Custom' ) }
|
|
249
|
+
origin="custom"
|
|
250
|
+
sizes={ customFontSizes }
|
|
251
|
+
handleAddFontSize={ handleAddFontSize }
|
|
252
|
+
handleResetFontSizes={
|
|
253
|
+
customFontSizes.length > 0
|
|
254
|
+
? () => setCustomFontSizes( [] )
|
|
255
|
+
: undefined
|
|
256
|
+
}
|
|
257
|
+
/>
|
|
258
|
+
</VStack>
|
|
259
|
+
</Spacer>
|
|
260
|
+
</View>
|
|
261
|
+
</VStack>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export default FontSizes;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalInputControl as InputControl,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
__experimentalHStack as HStack,
|
|
8
|
+
Button,
|
|
9
|
+
Modal,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { useState } from '@wordpress/element';
|
|
13
|
+
import type { FontSize } from '@wordpress/global-styles-engine';
|
|
14
|
+
|
|
15
|
+
interface RenameFontSizeDialogProps {
|
|
16
|
+
fontSize: FontSize;
|
|
17
|
+
toggleOpen: () => void;
|
|
18
|
+
handleRename: ( newName: string ) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function RenameFontSizeDialog( {
|
|
22
|
+
fontSize,
|
|
23
|
+
toggleOpen,
|
|
24
|
+
handleRename,
|
|
25
|
+
}: RenameFontSizeDialogProps ) {
|
|
26
|
+
const [ newName, setNewName ] = useState< string | undefined >(
|
|
27
|
+
fontSize.name
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const handleConfirm = () => {
|
|
31
|
+
// If the new name is not empty, call the handleRename function
|
|
32
|
+
if ( newName && newName.trim() ) {
|
|
33
|
+
handleRename( newName );
|
|
34
|
+
}
|
|
35
|
+
toggleOpen();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Modal
|
|
40
|
+
onRequestClose={ toggleOpen }
|
|
41
|
+
focusOnMount="firstContentElement"
|
|
42
|
+
title={ __( 'Rename' ) }
|
|
43
|
+
size="small"
|
|
44
|
+
>
|
|
45
|
+
<form
|
|
46
|
+
onSubmit={ ( event ) => {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
handleConfirm();
|
|
49
|
+
toggleOpen();
|
|
50
|
+
} }
|
|
51
|
+
>
|
|
52
|
+
<VStack spacing="3">
|
|
53
|
+
<InputControl
|
|
54
|
+
__next40pxDefaultSize
|
|
55
|
+
autoComplete="off"
|
|
56
|
+
value={ newName }
|
|
57
|
+
onChange={ setNewName }
|
|
58
|
+
label={ __( 'Name' ) }
|
|
59
|
+
placeholder={ __( 'Font size preset name' ) }
|
|
60
|
+
/>
|
|
61
|
+
<HStack justify="right">
|
|
62
|
+
<Button
|
|
63
|
+
__next40pxDefaultSize
|
|
64
|
+
variant="tertiary"
|
|
65
|
+
onClick={ toggleOpen }
|
|
66
|
+
>
|
|
67
|
+
{ __( 'Cancel' ) }
|
|
68
|
+
</Button>
|
|
69
|
+
<Button
|
|
70
|
+
__next40pxDefaultSize
|
|
71
|
+
variant="primary"
|
|
72
|
+
type="submit"
|
|
73
|
+
>
|
|
74
|
+
{ __( 'Save' ) }
|
|
75
|
+
</Button>
|
|
76
|
+
</HStack>
|
|
77
|
+
</VStack>
|
|
78
|
+
</form>
|
|
79
|
+
</Modal>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default RenameFontSizeDialog;
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Navigator, useNavigator } from '@wordpress/components';
|
|
5
|
+
// @ts-expect-error: Not typed yet.
|
|
6
|
+
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
// @ts-expect-error: Not typed yet.
|
|
9
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
10
|
+
import { useMemo, useEffect } from '@wordpress/element';
|
|
11
|
+
import { usePrevious } from '@wordpress/compose';
|
|
12
|
+
import {
|
|
13
|
+
generateGlobalStyles,
|
|
14
|
+
mergeGlobalStyles,
|
|
15
|
+
} from '@wordpress/global-styles-engine';
|
|
16
|
+
import type {
|
|
17
|
+
GlobalStylesConfig,
|
|
18
|
+
BlockType,
|
|
19
|
+
} from '@wordpress/global-styles-engine';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import { GlobalStylesProvider } from './provider';
|
|
25
|
+
import ScreenRoot from './screen-root';
|
|
26
|
+
import ScreenBlockList from './screen-block-list';
|
|
27
|
+
import ScreenBlock from './screen-block';
|
|
28
|
+
import ScreenTypography from './screen-typography';
|
|
29
|
+
import ScreenTypographyElement from './screen-typography-element';
|
|
30
|
+
import ScreenColors from './screen-colors';
|
|
31
|
+
import ScreenColorPalette from './screen-color-palette';
|
|
32
|
+
import ScreenBackground from './screen-background';
|
|
33
|
+
import { ScreenShadows, ScreenShadowsEdit } from './screen-shadows';
|
|
34
|
+
import ScreenLayout from './screen-layout';
|
|
35
|
+
import ScreenStyleVariations from './screen-style-variations';
|
|
36
|
+
import ScreenCSS from './screen-css';
|
|
37
|
+
import ScreenRevisions from './screen-revisions';
|
|
38
|
+
import FontSizes from './font-sizes/font-sizes';
|
|
39
|
+
import FontSize from './font-sizes/font-size';
|
|
40
|
+
interface BlockStylesNavigationScreensProps {
|
|
41
|
+
parentMenu: string;
|
|
42
|
+
blockStyles: any[];
|
|
43
|
+
blockName: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function BlockStylesNavigationScreens( {
|
|
47
|
+
parentMenu,
|
|
48
|
+
blockStyles,
|
|
49
|
+
blockName,
|
|
50
|
+
}: BlockStylesNavigationScreensProps ) {
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
{ blockStyles.map( ( style, index ) => (
|
|
54
|
+
<Navigator.Screen
|
|
55
|
+
key={ index }
|
|
56
|
+
path={ parentMenu + '/variations/' + style.name }
|
|
57
|
+
>
|
|
58
|
+
<ScreenBlock name={ blockName } variation={ style.name } />
|
|
59
|
+
</Navigator.Screen>
|
|
60
|
+
) ) }
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface ContextScreensProps {
|
|
66
|
+
name?: string;
|
|
67
|
+
parentMenu?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) {
|
|
71
|
+
const blockStyleVariations = useSelect(
|
|
72
|
+
( select ) => {
|
|
73
|
+
if ( ! name ) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const { getBlockStyles } = select( blocksStore );
|
|
77
|
+
return getBlockStyles( name );
|
|
78
|
+
},
|
|
79
|
+
[ name ]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<Navigator.Screen path={ parentMenu + '/colors/palette' }>
|
|
85
|
+
<ScreenColorPalette name={ name } />
|
|
86
|
+
</Navigator.Screen>
|
|
87
|
+
|
|
88
|
+
{ !! blockStyleVariations?.length && (
|
|
89
|
+
<BlockStylesNavigationScreens
|
|
90
|
+
parentMenu={ parentMenu }
|
|
91
|
+
blockStyles={ blockStyleVariations }
|
|
92
|
+
blockName={ name || '' }
|
|
93
|
+
/>
|
|
94
|
+
) }
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface GlobalStylesUIProps {
|
|
100
|
+
/** User global styles object (what gets edited) */
|
|
101
|
+
value: GlobalStylesConfig;
|
|
102
|
+
/** Base global styles object (theme default) */
|
|
103
|
+
baseValue: GlobalStylesConfig;
|
|
104
|
+
/** Callback when global styles change */
|
|
105
|
+
onChange: ( newValue: GlobalStylesConfig ) => void;
|
|
106
|
+
/** Current navigation path (optional) */
|
|
107
|
+
path?: string;
|
|
108
|
+
/** Callback when navigation path changes (optional) */
|
|
109
|
+
onPathChange?: ( path: string ) => void;
|
|
110
|
+
/** Whether font library is enabled (optional) */
|
|
111
|
+
fontLibraryEnabled?: boolean;
|
|
112
|
+
/** Server CSS styles for BlockEditorProvider (optional) */
|
|
113
|
+
serverCSS?: { isGlobalStyles?: boolean }[];
|
|
114
|
+
/** Server settings for BlockEditorProvider (optional) */
|
|
115
|
+
serverSettings?: { __unstableResolvedAssets: Record< string, unknown > };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function GlobalStylesUI( {
|
|
119
|
+
value,
|
|
120
|
+
baseValue,
|
|
121
|
+
onChange,
|
|
122
|
+
path,
|
|
123
|
+
onPathChange,
|
|
124
|
+
fontLibraryEnabled = false,
|
|
125
|
+
serverCSS,
|
|
126
|
+
serverSettings,
|
|
127
|
+
}: GlobalStylesUIProps ) {
|
|
128
|
+
const blocks = getBlockTypes();
|
|
129
|
+
|
|
130
|
+
// Compute merged value for CSS generation
|
|
131
|
+
const mergedValue = useMemo( () => {
|
|
132
|
+
return mergeGlobalStyles( baseValue, value );
|
|
133
|
+
}, [ baseValue, value ] );
|
|
134
|
+
|
|
135
|
+
const [ globalStylesCSS, globalSettings ] =
|
|
136
|
+
generateGlobalStyles( mergedValue );
|
|
137
|
+
const styles = useMemo(
|
|
138
|
+
() => [ ...( serverCSS ?? [] ), ...( globalStylesCSS ?? [] ) ],
|
|
139
|
+
[ serverCSS, globalStylesCSS ]
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const settings = useMemo( () => {
|
|
143
|
+
return {
|
|
144
|
+
...serverSettings,
|
|
145
|
+
__experimentalFeatures: globalSettings,
|
|
146
|
+
styles,
|
|
147
|
+
};
|
|
148
|
+
}, [ globalSettings, serverSettings, styles ] );
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<GlobalStylesProvider
|
|
152
|
+
value={ value }
|
|
153
|
+
baseValue={ baseValue }
|
|
154
|
+
onChange={ onChange }
|
|
155
|
+
fontLibraryEnabled={ fontLibraryEnabled }
|
|
156
|
+
>
|
|
157
|
+
<BlockEditorProvider settings={ settings }>
|
|
158
|
+
<Navigator
|
|
159
|
+
className="global-styles-ui-sidebar__navigator-provider"
|
|
160
|
+
initialPath={ path || '/' }
|
|
161
|
+
>
|
|
162
|
+
{ ( path || onPathChange ) && (
|
|
163
|
+
<PathSynchronizer
|
|
164
|
+
path={ path }
|
|
165
|
+
onPathChange={ onPathChange }
|
|
166
|
+
/>
|
|
167
|
+
) }
|
|
168
|
+
<Navigator.Screen path="/">
|
|
169
|
+
<ScreenRoot />
|
|
170
|
+
</Navigator.Screen>
|
|
171
|
+
<Navigator.Screen path="/colors">
|
|
172
|
+
<ScreenColors />
|
|
173
|
+
</Navigator.Screen>
|
|
174
|
+
<Navigator.Screen path="/typography">
|
|
175
|
+
<ScreenTypography />
|
|
176
|
+
</Navigator.Screen>
|
|
177
|
+
<Navigator.Screen path="/typography/font-sizes">
|
|
178
|
+
<FontSizes />
|
|
179
|
+
</Navigator.Screen>
|
|
180
|
+
<Navigator.Screen path="/typography/font-sizes/:origin/:slug">
|
|
181
|
+
<FontSize />
|
|
182
|
+
</Navigator.Screen>
|
|
183
|
+
<Navigator.Screen path="/layout">
|
|
184
|
+
<ScreenLayout />
|
|
185
|
+
</Navigator.Screen>
|
|
186
|
+
<Navigator.Screen path="/colors/palette">
|
|
187
|
+
<ScreenColorPalette />
|
|
188
|
+
</Navigator.Screen>
|
|
189
|
+
<Navigator.Screen path="/variations">
|
|
190
|
+
<ScreenStyleVariations />
|
|
191
|
+
</Navigator.Screen>
|
|
192
|
+
<Navigator.Screen path="/css">
|
|
193
|
+
<ScreenCSS />
|
|
194
|
+
</Navigator.Screen>
|
|
195
|
+
<Navigator.Screen path="/revisions/:revisionId?">
|
|
196
|
+
<ScreenRevisions />
|
|
197
|
+
</Navigator.Screen>
|
|
198
|
+
<Navigator.Screen path="/shadows">
|
|
199
|
+
<ScreenShadows />
|
|
200
|
+
</Navigator.Screen>
|
|
201
|
+
<Navigator.Screen path="/shadows/edit/:category/:slug">
|
|
202
|
+
<ScreenShadowsEdit />
|
|
203
|
+
</Navigator.Screen>
|
|
204
|
+
<Navigator.Screen path="/background">
|
|
205
|
+
<ScreenBackground />
|
|
206
|
+
</Navigator.Screen>
|
|
207
|
+
<Navigator.Screen path="/typography/text">
|
|
208
|
+
<ScreenTypographyElement element="text" />
|
|
209
|
+
</Navigator.Screen>
|
|
210
|
+
<Navigator.Screen path="/typography/link">
|
|
211
|
+
<ScreenTypographyElement element="link" />
|
|
212
|
+
</Navigator.Screen>
|
|
213
|
+
<Navigator.Screen path="/typography/heading">
|
|
214
|
+
<ScreenTypographyElement element="heading" />
|
|
215
|
+
</Navigator.Screen>
|
|
216
|
+
<Navigator.Screen path="/typography/caption">
|
|
217
|
+
<ScreenTypographyElement element="caption" />
|
|
218
|
+
</Navigator.Screen>
|
|
219
|
+
<Navigator.Screen path="/typography/button">
|
|
220
|
+
<ScreenTypographyElement element="button" />
|
|
221
|
+
</Navigator.Screen>
|
|
222
|
+
<Navigator.Screen path="/blocks">
|
|
223
|
+
<ScreenBlockList />
|
|
224
|
+
</Navigator.Screen>
|
|
225
|
+
{ blocks.map( ( block: BlockType ) => (
|
|
226
|
+
<Navigator.Screen
|
|
227
|
+
key={ 'menu-block-' + block.name }
|
|
228
|
+
path={
|
|
229
|
+
'/blocks/' + encodeURIComponent( block.name )
|
|
230
|
+
}
|
|
231
|
+
>
|
|
232
|
+
<ScreenBlock name={ block.name } />
|
|
233
|
+
</Navigator.Screen>
|
|
234
|
+
) ) }
|
|
235
|
+
|
|
236
|
+
<ContextScreens />
|
|
237
|
+
|
|
238
|
+
{ blocks.map( ( block: BlockType ) => (
|
|
239
|
+
<ContextScreens
|
|
240
|
+
key={ 'screens-block-' + block.name }
|
|
241
|
+
name={ block.name }
|
|
242
|
+
parentMenu={
|
|
243
|
+
'/blocks/' + encodeURIComponent( block.name )
|
|
244
|
+
}
|
|
245
|
+
/>
|
|
246
|
+
) ) }
|
|
247
|
+
</Navigator>
|
|
248
|
+
</BlockEditorProvider>
|
|
249
|
+
</GlobalStylesProvider>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/*
|
|
254
|
+
* Component that handles path synchronization between external path prop and Navigator's internal path.
|
|
255
|
+
*/
|
|
256
|
+
function PathSynchronizer( {
|
|
257
|
+
path,
|
|
258
|
+
onPathChange,
|
|
259
|
+
}: {
|
|
260
|
+
path?: string;
|
|
261
|
+
onPathChange?: ( path: string ) => void;
|
|
262
|
+
} ) {
|
|
263
|
+
const navigator = useNavigator();
|
|
264
|
+
const { path: childPath } = navigator.location;
|
|
265
|
+
const previousParentPath = usePrevious( path );
|
|
266
|
+
const previousChildPath = usePrevious( childPath );
|
|
267
|
+
|
|
268
|
+
useEffect( () => {
|
|
269
|
+
// Only sync when parent and child paths are out of sync
|
|
270
|
+
if ( path && path !== childPath ) {
|
|
271
|
+
// If parent path changed, update the Navigator
|
|
272
|
+
if ( path !== previousParentPath ) {
|
|
273
|
+
navigator.goTo( path );
|
|
274
|
+
}
|
|
275
|
+
// If child path changed, notify parent via onPathChange
|
|
276
|
+
else if ( childPath !== previousChildPath && onPathChange ) {
|
|
277
|
+
onPathChange( childPath ?? '/' );
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}, [
|
|
281
|
+
onPathChange,
|
|
282
|
+
path,
|
|
283
|
+
previousChildPath,
|
|
284
|
+
previousParentPath,
|
|
285
|
+
childPath,
|
|
286
|
+
navigator,
|
|
287
|
+
] );
|
|
288
|
+
|
|
289
|
+
// This component only handles synchronization logic. It doesn't render anything.
|
|
290
|
+
// We use it to run the effect inside the Navigator context.
|
|
291
|
+
return null;
|
|
292
|
+
}
|