@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,82 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
__experimentalInputControl as InputControl,
|
|
4
|
+
__experimentalVStack as VStack,
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
Button,
|
|
7
|
+
Modal
|
|
8
|
+
} from "@wordpress/components";
|
|
9
|
+
import { __ } from "@wordpress/i18n";
|
|
10
|
+
import { useState } from "@wordpress/element";
|
|
11
|
+
function RenameFontSizeDialog({
|
|
12
|
+
fontSize,
|
|
13
|
+
toggleOpen,
|
|
14
|
+
handleRename
|
|
15
|
+
}) {
|
|
16
|
+
const [newName, setNewName] = useState(
|
|
17
|
+
fontSize.name
|
|
18
|
+
);
|
|
19
|
+
const handleConfirm = () => {
|
|
20
|
+
if (newName && newName.trim()) {
|
|
21
|
+
handleRename(newName);
|
|
22
|
+
}
|
|
23
|
+
toggleOpen();
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
Modal,
|
|
27
|
+
{
|
|
28
|
+
onRequestClose: toggleOpen,
|
|
29
|
+
focusOnMount: "firstContentElement",
|
|
30
|
+
title: __("Rename"),
|
|
31
|
+
size: "small",
|
|
32
|
+
children: /* @__PURE__ */ jsx(
|
|
33
|
+
"form",
|
|
34
|
+
{
|
|
35
|
+
onSubmit: (event) => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
handleConfirm();
|
|
38
|
+
toggleOpen();
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ jsxs(VStack, { spacing: "3", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
InputControl,
|
|
43
|
+
{
|
|
44
|
+
__next40pxDefaultSize: true,
|
|
45
|
+
autoComplete: "off",
|
|
46
|
+
value: newName,
|
|
47
|
+
onChange: setNewName,
|
|
48
|
+
label: __("Name"),
|
|
49
|
+
placeholder: __("Font size preset name")
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "right", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
Button,
|
|
55
|
+
{
|
|
56
|
+
__next40pxDefaultSize: true,
|
|
57
|
+
variant: "tertiary",
|
|
58
|
+
onClick: toggleOpen,
|
|
59
|
+
children: __("Cancel")
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Button,
|
|
64
|
+
{
|
|
65
|
+
__next40pxDefaultSize: true,
|
|
66
|
+
variant: "primary",
|
|
67
|
+
type: "submit",
|
|
68
|
+
children: __("Save")
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] })
|
|
72
|
+
] })
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
var rename_font_size_dialog_default = RenameFontSizeDialog;
|
|
79
|
+
export {
|
|
80
|
+
rename_font_size_dialog_default as default
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=rename-font-size-dialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/font-sizes/rename-font-size-dialog.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalInputControl as InputControl,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport type { FontSize } from '@wordpress/global-styles-engine';\n\ninterface RenameFontSizeDialogProps {\n\tfontSize: FontSize;\n\ttoggleOpen: () => void;\n\thandleRename: ( newName: string ) => void;\n}\n\nfunction RenameFontSizeDialog( {\n\tfontSize,\n\ttoggleOpen,\n\thandleRename,\n}: RenameFontSizeDialogProps ) {\n\tconst [ newName, setNewName ] = useState< string | undefined >(\n\t\tfontSize.name\n\t);\n\n\tconst handleConfirm = () => {\n\t\t// If the new name is not empty, call the handleRename function\n\t\tif ( newName && newName.trim() ) {\n\t\t\thandleRename( newName );\n\t\t}\n\t\ttoggleOpen();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\tonRequestClose={ toggleOpen }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleConfirm();\n\t\t\t\t\ttoggleOpen();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tvalue={ newName }\n\t\t\t\t\t\tonChange={ setNewName }\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Font size preset name' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ toggleOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport default RenameFontSizeDialog;\n"],
|
|
5
|
+
"mappings": "AAoDK,cAQA,YARA;AAjDL;AAAA,EACC,8BAA8B;AAAA,EAC9B,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AASzB,SAAS,qBAAsB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,GAA+B;AAC9B,QAAM,CAAE,SAAS,UAAW,IAAI;AAAA,IAC/B,SAAS;AAAA,EACV;AAEA,QAAM,gBAAgB,MAAM;AAE3B,QAAK,WAAW,QAAQ,KAAK,GAAI;AAChC,mBAAc,OAAQ;AAAA,IACvB;AACA,eAAW;AAAA,EACZ;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,gBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,OAAQ,GAAI,QAAS;AAAA,MACrB,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,0BAAc;AACd,uBAAW;AAAA,UACZ;AAAA,UAEA,+BAAC,UAAO,SAAQ,KACf;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,cAAa;AAAA,gBACb,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,OAAQ,GAAI,MAAO;AAAA,gBACnB,aAAc,GAAI,uBAAwB;AAAA;AAAA,YAC3C;AAAA,YACA,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,aAAI,QAAS;AAAA;AAAA,cAChB;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,aAAI,MAAO;AAAA;AAAA,cACd;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Navigator, useNavigator } from "@wordpress/components";
|
|
3
|
+
import { getBlockTypes, store as blocksStore } from "@wordpress/blocks";
|
|
4
|
+
import { useSelect } from "@wordpress/data";
|
|
5
|
+
import { BlockEditorProvider } from "@wordpress/block-editor";
|
|
6
|
+
import { useMemo, useEffect } from "@wordpress/element";
|
|
7
|
+
import { usePrevious } from "@wordpress/compose";
|
|
8
|
+
import {
|
|
9
|
+
generateGlobalStyles,
|
|
10
|
+
mergeGlobalStyles
|
|
11
|
+
} from "@wordpress/global-styles-engine";
|
|
12
|
+
import { GlobalStylesProvider } from "./provider";
|
|
13
|
+
import ScreenRoot from "./screen-root";
|
|
14
|
+
import ScreenBlockList from "./screen-block-list";
|
|
15
|
+
import ScreenBlock from "./screen-block";
|
|
16
|
+
import ScreenTypography from "./screen-typography";
|
|
17
|
+
import ScreenTypographyElement from "./screen-typography-element";
|
|
18
|
+
import ScreenColors from "./screen-colors";
|
|
19
|
+
import ScreenColorPalette from "./screen-color-palette";
|
|
20
|
+
import ScreenBackground from "./screen-background";
|
|
21
|
+
import { ScreenShadows, ScreenShadowsEdit } from "./screen-shadows";
|
|
22
|
+
import ScreenLayout from "./screen-layout";
|
|
23
|
+
import ScreenStyleVariations from "./screen-style-variations";
|
|
24
|
+
import ScreenCSS from "./screen-css";
|
|
25
|
+
import ScreenRevisions from "./screen-revisions";
|
|
26
|
+
import FontSizes from "./font-sizes/font-sizes";
|
|
27
|
+
import FontSize from "./font-sizes/font-size";
|
|
28
|
+
function BlockStylesNavigationScreens({
|
|
29
|
+
parentMenu,
|
|
30
|
+
blockStyles,
|
|
31
|
+
blockName
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Fragment, { children: blockStyles.map((style, index) => /* @__PURE__ */ jsx(
|
|
34
|
+
Navigator.Screen,
|
|
35
|
+
{
|
|
36
|
+
path: parentMenu + "/variations/" + style.name,
|
|
37
|
+
children: /* @__PURE__ */ jsx(ScreenBlock, { name: blockName, variation: style.name })
|
|
38
|
+
},
|
|
39
|
+
index
|
|
40
|
+
)) });
|
|
41
|
+
}
|
|
42
|
+
function ContextScreens({ name, parentMenu = "" }) {
|
|
43
|
+
const blockStyleVariations = useSelect(
|
|
44
|
+
(select) => {
|
|
45
|
+
if (!name) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const { getBlockStyles } = select(blocksStore);
|
|
49
|
+
return getBlockStyles(name);
|
|
50
|
+
},
|
|
51
|
+
[name]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: parentMenu + "/colors/palette", children: /* @__PURE__ */ jsx(ScreenColorPalette, { name }) }),
|
|
55
|
+
!!blockStyleVariations?.length && /* @__PURE__ */ jsx(
|
|
56
|
+
BlockStylesNavigationScreens,
|
|
57
|
+
{
|
|
58
|
+
parentMenu,
|
|
59
|
+
blockStyles: blockStyleVariations,
|
|
60
|
+
blockName: name || ""
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
function GlobalStylesUI({
|
|
66
|
+
value,
|
|
67
|
+
baseValue,
|
|
68
|
+
onChange,
|
|
69
|
+
path,
|
|
70
|
+
onPathChange,
|
|
71
|
+
fontLibraryEnabled = false,
|
|
72
|
+
serverCSS,
|
|
73
|
+
serverSettings
|
|
74
|
+
}) {
|
|
75
|
+
const blocks = getBlockTypes();
|
|
76
|
+
const mergedValue = useMemo(() => {
|
|
77
|
+
return mergeGlobalStyles(baseValue, value);
|
|
78
|
+
}, [baseValue, value]);
|
|
79
|
+
const [globalStylesCSS, globalSettings] = generateGlobalStyles(mergedValue);
|
|
80
|
+
const styles = useMemo(
|
|
81
|
+
() => [...serverCSS ?? [], ...globalStylesCSS ?? []],
|
|
82
|
+
[serverCSS, globalStylesCSS]
|
|
83
|
+
);
|
|
84
|
+
const settings = useMemo(() => {
|
|
85
|
+
return {
|
|
86
|
+
...serverSettings,
|
|
87
|
+
__experimentalFeatures: globalSettings,
|
|
88
|
+
styles
|
|
89
|
+
};
|
|
90
|
+
}, [globalSettings, serverSettings, styles]);
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
GlobalStylesProvider,
|
|
93
|
+
{
|
|
94
|
+
value,
|
|
95
|
+
baseValue,
|
|
96
|
+
onChange,
|
|
97
|
+
fontLibraryEnabled,
|
|
98
|
+
children: /* @__PURE__ */ jsx(BlockEditorProvider, { settings, children: /* @__PURE__ */ jsxs(
|
|
99
|
+
Navigator,
|
|
100
|
+
{
|
|
101
|
+
className: "global-styles-ui-sidebar__navigator-provider",
|
|
102
|
+
initialPath: path || "/",
|
|
103
|
+
children: [
|
|
104
|
+
(path || onPathChange) && /* @__PURE__ */ jsx(
|
|
105
|
+
PathSynchronizer,
|
|
106
|
+
{
|
|
107
|
+
path,
|
|
108
|
+
onPathChange
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/", children: /* @__PURE__ */ jsx(ScreenRoot, {}) }),
|
|
112
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/colors", children: /* @__PURE__ */ jsx(ScreenColors, {}) }),
|
|
113
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography", children: /* @__PURE__ */ jsx(ScreenTypography, {}) }),
|
|
114
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/font-sizes", children: /* @__PURE__ */ jsx(FontSizes, {}) }),
|
|
115
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ jsx(FontSize, {}) }),
|
|
116
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/layout", children: /* @__PURE__ */ jsx(ScreenLayout, {}) }),
|
|
117
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/colors/palette", children: /* @__PURE__ */ jsx(ScreenColorPalette, {}) }),
|
|
118
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/variations", children: /* @__PURE__ */ jsx(ScreenStyleVariations, {}) }),
|
|
119
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/css", children: /* @__PURE__ */ jsx(ScreenCSS, {}) }),
|
|
120
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/revisions/:revisionId?", children: /* @__PURE__ */ jsx(ScreenRevisions, {}) }),
|
|
121
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/shadows", children: /* @__PURE__ */ jsx(ScreenShadows, {}) }),
|
|
122
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ jsx(ScreenShadowsEdit, {}) }),
|
|
123
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/background", children: /* @__PURE__ */ jsx(ScreenBackground, {}) }),
|
|
124
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/text", children: /* @__PURE__ */ jsx(ScreenTypographyElement, { element: "text" }) }),
|
|
125
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/link", children: /* @__PURE__ */ jsx(ScreenTypographyElement, { element: "link" }) }),
|
|
126
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/heading", children: /* @__PURE__ */ jsx(ScreenTypographyElement, { element: "heading" }) }),
|
|
127
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/caption", children: /* @__PURE__ */ jsx(ScreenTypographyElement, { element: "caption" }) }),
|
|
128
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/typography/button", children: /* @__PURE__ */ jsx(ScreenTypographyElement, { element: "button" }) }),
|
|
129
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/blocks", children: /* @__PURE__ */ jsx(ScreenBlockList, {}) }),
|
|
130
|
+
blocks.map((block) => /* @__PURE__ */ jsx(
|
|
131
|
+
Navigator.Screen,
|
|
132
|
+
{
|
|
133
|
+
path: "/blocks/" + encodeURIComponent(block.name),
|
|
134
|
+
children: /* @__PURE__ */ jsx(ScreenBlock, { name: block.name })
|
|
135
|
+
},
|
|
136
|
+
"menu-block-" + block.name
|
|
137
|
+
)),
|
|
138
|
+
/* @__PURE__ */ jsx(ContextScreens, {}),
|
|
139
|
+
blocks.map((block) => /* @__PURE__ */ jsx(
|
|
140
|
+
ContextScreens,
|
|
141
|
+
{
|
|
142
|
+
name: block.name,
|
|
143
|
+
parentMenu: "/blocks/" + encodeURIComponent(block.name)
|
|
144
|
+
},
|
|
145
|
+
"screens-block-" + block.name
|
|
146
|
+
))
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
) })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function PathSynchronizer({
|
|
154
|
+
path,
|
|
155
|
+
onPathChange
|
|
156
|
+
}) {
|
|
157
|
+
const navigator = useNavigator();
|
|
158
|
+
const { path: childPath } = navigator.location;
|
|
159
|
+
const previousParentPath = usePrevious(path);
|
|
160
|
+
const previousChildPath = usePrevious(childPath);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (path && path !== childPath) {
|
|
163
|
+
if (path !== previousParentPath) {
|
|
164
|
+
navigator.goTo(path);
|
|
165
|
+
} else if (childPath !== previousChildPath && onPathChange) {
|
|
166
|
+
onPathChange(childPath ?? "/");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, [
|
|
170
|
+
onPathChange,
|
|
171
|
+
path,
|
|
172
|
+
previousChildPath,
|
|
173
|
+
previousParentPath,
|
|
174
|
+
childPath,
|
|
175
|
+
navigator
|
|
176
|
+
]);
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
GlobalStylesUI
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=global-styles-ui.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/global-styles-ui.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Navigator, useNavigator } from '@wordpress/components';\n// @ts-expect-error: Not typed yet.\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n// @ts-expect-error: Not typed yet.\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tgenerateGlobalStyles,\n\tmergeGlobalStyles,\n} from '@wordpress/global-styles-engine';\nimport type {\n\tGlobalStylesConfig,\n\tBlockType,\n} from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { GlobalStylesProvider } from './provider';\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackground from './screen-background';\nimport { ScreenShadows, ScreenShadowsEdit } from './screen-shadows';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport ScreenCSS from './screen-css';\nimport ScreenRevisions from './screen-revisions';\nimport FontSizes from './font-sizes/font-sizes';\nimport FontSize from './font-sizes/font-size';\ninterface BlockStylesNavigationScreensProps {\n\tparentMenu: string;\n\tblockStyles: any[];\n\tblockName: string;\n}\n\nfunction BlockStylesNavigationScreens( {\n\tparentMenu,\n\tblockStyles,\n\tblockName,\n}: BlockStylesNavigationScreensProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ blockStyles.map( ( style, index ) => (\n\t\t\t\t<Navigator.Screen\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ blockName } variation={ style.name } />\n\t\t\t\t</Navigator.Screen>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\ninterface ContextScreensProps {\n\tname?: string;\n\tparentMenu?: string;\n}\n\nfunction ContextScreens( { name, parentMenu = '' }: ContextScreensProps ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! name ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<Navigator.Screen path={ parentMenu + '/colors/palette' }>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</Navigator.Screen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name || '' }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\ninterface GlobalStylesUIProps {\n\t/** User global styles object (what gets edited) */\n\tvalue: GlobalStylesConfig;\n\t/** Base global styles object (theme default) */\n\tbaseValue: GlobalStylesConfig;\n\t/** Callback when global styles change */\n\tonChange: ( newValue: GlobalStylesConfig ) => void;\n\t/** Current navigation path (optional) */\n\tpath?: string;\n\t/** Callback when navigation path changes (optional) */\n\tonPathChange?: ( path: string ) => void;\n\t/** Whether font library is enabled (optional) */\n\tfontLibraryEnabled?: boolean;\n\t/** Server CSS styles for BlockEditorProvider (optional) */\n\tserverCSS?: { isGlobalStyles?: boolean }[];\n\t/** Server settings for BlockEditorProvider (optional) */\n\tserverSettings?: { __unstableResolvedAssets: Record< string, unknown > };\n}\n\nexport function GlobalStylesUI( {\n\tvalue,\n\tbaseValue,\n\tonChange,\n\tpath,\n\tonPathChange,\n\tfontLibraryEnabled = false,\n\tserverCSS,\n\tserverSettings,\n}: GlobalStylesUIProps ) {\n\tconst blocks = getBlockTypes();\n\n\t// Compute merged value for CSS generation\n\tconst mergedValue = useMemo( () => {\n\t\treturn mergeGlobalStyles( baseValue, value );\n\t}, [ baseValue, value ] );\n\n\tconst [ globalStylesCSS, globalSettings ] =\n\t\tgenerateGlobalStyles( mergedValue );\n\tconst styles = useMemo(\n\t\t() => [ ...( serverCSS ?? [] ), ...( globalStylesCSS ?? [] ) ],\n\t\t[ serverCSS, globalStylesCSS ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\treturn {\n\t\t\t...serverSettings,\n\t\t\t__experimentalFeatures: globalSettings,\n\t\t\tstyles,\n\t\t};\n\t}, [ globalSettings, serverSettings, styles ] );\n\n\treturn (\n\t\t<GlobalStylesProvider\n\t\t\tvalue={ value }\n\t\t\tbaseValue={ baseValue }\n\t\t\tonChange={ onChange }\n\t\t\tfontLibraryEnabled={ fontLibraryEnabled }\n\t\t>\n\t\t\t<BlockEditorProvider settings={ settings }>\n\t\t\t\t<Navigator\n\t\t\t\t\tclassName=\"global-styles-ui-sidebar__navigator-provider\"\n\t\t\t\t\tinitialPath={ path || '/' }\n\t\t\t\t>\n\t\t\t\t\t{ ( path || onPathChange ) && (\n\t\t\t\t\t\t<PathSynchronizer\n\t\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\t\tonPathChange={ onPathChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t\t<ScreenRoot />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/colors\">\n\t\t\t\t\t\t<ScreenColors />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography\">\n\t\t\t\t\t\t<ScreenTypography />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/font-sizes\">\n\t\t\t\t\t\t<FontSizes />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/font-sizes/:origin/:slug\">\n\t\t\t\t\t\t<FontSize />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/layout\">\n\t\t\t\t\t\t<ScreenLayout />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/colors/palette\">\n\t\t\t\t\t\t<ScreenColorPalette />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/variations\">\n\t\t\t\t\t\t<ScreenStyleVariations />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/css\">\n\t\t\t\t\t\t<ScreenCSS />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/revisions/:revisionId?\">\n\t\t\t\t\t\t<ScreenRevisions />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/shadows\">\n\t\t\t\t\t\t<ScreenShadows />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/shadows/edit/:category/:slug\">\n\t\t\t\t\t\t<ScreenShadowsEdit />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/background\">\n\t\t\t\t\t\t<ScreenBackground />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/text\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"text\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/link\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"link\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/heading\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"heading\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/caption\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"caption\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/typography/button\">\n\t\t\t\t\t\t<ScreenTypographyElement element=\"button\" />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t<Navigator.Screen path=\"/blocks\">\n\t\t\t\t\t\t<ScreenBlockList />\n\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t{ blocks.map( ( block: BlockType ) => (\n\t\t\t\t\t\t<Navigator.Screen\n\t\t\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\t\t\tpath={\n\t\t\t\t\t\t\t\t'/blocks/' + encodeURIComponent( block.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t) ) }\n\n\t\t\t\t\t<ContextScreens />\n\n\t\t\t\t\t{ blocks.map( ( block: BlockType ) => (\n\t\t\t\t\t\t<ContextScreens\n\t\t\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t\t\tparentMenu={\n\t\t\t\t\t\t\t\t'/blocks/' + encodeURIComponent( block.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Navigator>\n\t\t\t</BlockEditorProvider>\n\t\t</GlobalStylesProvider>\n\t);\n}\n\n/*\n * Component that handles path synchronization between external path prop and Navigator's internal path.\n */\nfunction PathSynchronizer( {\n\tpath,\n\tonPathChange,\n}: {\n\tpath?: string;\n\tonPathChange?: ( path: string ) => void;\n} ) {\n\tconst navigator = useNavigator();\n\tconst { path: childPath } = navigator.location;\n\tconst previousParentPath = usePrevious( path );\n\tconst previousChildPath = usePrevious( childPath );\n\n\tuseEffect( () => {\n\t\t// Only sync when parent and child paths are out of sync\n\t\tif ( path && path !== childPath ) {\n\t\t\t// If parent path changed, update the Navigator\n\t\t\tif ( path !== previousParentPath ) {\n\t\t\t\tnavigator.goTo( path );\n\t\t\t}\n\t\t\t// If child path changed, notify parent via onPathChange\n\t\t\telse if ( childPath !== previousChildPath && onPathChange ) {\n\t\t\t\tonPathChange( childPath ?? '/' );\n\t\t\t}\n\t\t}\n\t}, [\n\t\tonPathChange,\n\t\tpath,\n\t\tpreviousChildPath,\n\t\tpreviousParentPath,\n\t\tchildPath,\n\t\tnavigator,\n\t] );\n\n\t// This component only handles synchronization logic. It doesn't render anything.\n\t// We use it to run the effect inside the Navigator context.\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useViewportMatch } from "@wordpress/compose";
|
|
3
|
+
import {
|
|
4
|
+
__experimentalVStack as VStack,
|
|
5
|
+
__experimentalPaletteEdit as PaletteEdit,
|
|
6
|
+
__experimentalSpacer as Spacer,
|
|
7
|
+
DuotonePicker
|
|
8
|
+
} from "@wordpress/components";
|
|
9
|
+
import { __ } from "@wordpress/i18n";
|
|
10
|
+
import { Subtitle } from "./subtitle";
|
|
11
|
+
import { useSetting } from "./hooks";
|
|
12
|
+
const mobilePopoverProps = { placement: "bottom-start", offset: 8 };
|
|
13
|
+
const noop = () => {
|
|
14
|
+
};
|
|
15
|
+
function GradientPalettePanel({
|
|
16
|
+
name
|
|
17
|
+
}) {
|
|
18
|
+
const [themeGradients, setThemeGradients] = useSetting(
|
|
19
|
+
"color.gradients.theme",
|
|
20
|
+
name
|
|
21
|
+
);
|
|
22
|
+
const [baseThemeGradients] = useSetting(
|
|
23
|
+
"color.gradients.theme",
|
|
24
|
+
name,
|
|
25
|
+
"base"
|
|
26
|
+
);
|
|
27
|
+
const [defaultGradients, setDefaultGradients] = useSetting(
|
|
28
|
+
"color.gradients.default",
|
|
29
|
+
name
|
|
30
|
+
);
|
|
31
|
+
const [baseDefaultGradients] = useSetting(
|
|
32
|
+
"color.gradients.default",
|
|
33
|
+
name,
|
|
34
|
+
"base"
|
|
35
|
+
);
|
|
36
|
+
const [customGradients, setCustomGradients] = useSetting(
|
|
37
|
+
"color.gradients.custom",
|
|
38
|
+
name
|
|
39
|
+
);
|
|
40
|
+
const [defaultPaletteEnabled] = useSetting(
|
|
41
|
+
"color.defaultGradients",
|
|
42
|
+
name
|
|
43
|
+
);
|
|
44
|
+
const [customDuotone] = useSetting("color.duotone.custom") || [];
|
|
45
|
+
const [defaultDuotone] = useSetting("color.duotone.default") || [];
|
|
46
|
+
const [themeDuotone] = useSetting("color.duotone.theme") || [];
|
|
47
|
+
const [defaultDuotoneEnabled] = useSetting("color.defaultDuotone");
|
|
48
|
+
const duotonePalette = [
|
|
49
|
+
...customDuotone || [],
|
|
50
|
+
...themeDuotone || [],
|
|
51
|
+
...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : []
|
|
52
|
+
];
|
|
53
|
+
const isMobileViewport = useViewportMatch("small", "<");
|
|
54
|
+
const popoverProps = isMobileViewport ? mobilePopoverProps : void 0;
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
56
|
+
VStack,
|
|
57
|
+
{
|
|
58
|
+
className: "global-styles-ui-gradient-palette-panel",
|
|
59
|
+
spacing: 8,
|
|
60
|
+
children: [
|
|
61
|
+
!!themeGradients && !!themeGradients.length && /* @__PURE__ */ jsx(
|
|
62
|
+
PaletteEdit,
|
|
63
|
+
{
|
|
64
|
+
canReset: themeGradients !== baseThemeGradients,
|
|
65
|
+
canOnlyChangeValues: true,
|
|
66
|
+
gradients: themeGradients,
|
|
67
|
+
onChange: setThemeGradients,
|
|
68
|
+
paletteLabel: __("Theme"),
|
|
69
|
+
paletteLabelHeadingLevel: 3,
|
|
70
|
+
popoverProps
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
!!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ jsx(
|
|
74
|
+
PaletteEdit,
|
|
75
|
+
{
|
|
76
|
+
canReset: defaultGradients !== baseDefaultGradients,
|
|
77
|
+
canOnlyChangeValues: true,
|
|
78
|
+
gradients: defaultGradients,
|
|
79
|
+
onChange: setDefaultGradients,
|
|
80
|
+
paletteLabel: __("Default"),
|
|
81
|
+
paletteLabelHeadingLevel: 3,
|
|
82
|
+
popoverProps
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
PaletteEdit,
|
|
87
|
+
{
|
|
88
|
+
gradients: customGradients,
|
|
89
|
+
onChange: setCustomGradients,
|
|
90
|
+
paletteLabel: __("Custom"),
|
|
91
|
+
paletteLabelHeadingLevel: 3,
|
|
92
|
+
slugPrefix: "custom-",
|
|
93
|
+
popoverProps
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
!!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ jsxs("div", { children: [
|
|
97
|
+
/* @__PURE__ */ jsx(Subtitle, { level: 3, children: __("Duotone") }),
|
|
98
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 3 }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
DuotonePicker,
|
|
101
|
+
{
|
|
102
|
+
duotonePalette,
|
|
103
|
+
disableCustomDuotone: true,
|
|
104
|
+
disableCustomColors: true,
|
|
105
|
+
clearable: false,
|
|
106
|
+
onChange: noop,
|
|
107
|
+
colorPalette: []
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
GradientPalettePanel as default
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=gradients-palette-panel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/gradients-palette-panel.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalPaletteEdit as PaletteEdit,\n\t__experimentalSpacer as Spacer,\n\tDuotonePicker,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport type { Gradient } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { Subtitle } from './subtitle';\nimport { useSetting } from './hooks';\n\nconst mobilePopoverProps = { placement: 'bottom-start' as const, offset: 8 };\n\nconst noop = () => {};\n\ninterface GradientPalettePanelProps {\n\tname?: string;\n}\n\nexport default function GradientPalettePanel( {\n\tname,\n}: GradientPalettePanelProps ) {\n\tconst [ themeGradients, setThemeGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.theme',\n\t\tname\n\t);\n\tconst [ baseThemeGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.theme',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ defaultGradients, setDefaultGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.default',\n\t\tname\n\t);\n\tconst [ baseDefaultGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.default',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ customGradients, setCustomGradients ] = useSetting< Gradient[] >(\n\t\t'color.gradients.custom',\n\t\tname\n\t);\n\n\tconst [ defaultPaletteEnabled ] = useSetting< boolean >(\n\t\t'color.defaultGradients',\n\t\tname\n\t);\n\n\tconst [ customDuotone ] = useSetting( 'color.duotone.custom' ) || [];\n\tconst [ defaultDuotone ] = useSetting( 'color.duotone.default' ) || [];\n\tconst [ themeDuotone ] = useSetting( 'color.duotone.theme' ) || [];\n\tconst [ defaultDuotoneEnabled ] = useSetting( 'color.defaultDuotone' );\n\n\tconst duotonePalette = [\n\t\t...( customDuotone || [] ),\n\t\t...( themeDuotone || [] ),\n\t\t...( defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] ),\n\t];\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst popoverProps = isMobileViewport ? mobilePopoverProps : undefined;\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"global-styles-ui-gradient-palette-panel\"\n\t\t\tspacing={ 8 }\n\t\t>\n\t\t\t{ !! themeGradients && !! themeGradients.length && (\n\t\t\t\t<PaletteEdit\n\t\t\t\t\tcanReset={ themeGradients !== baseThemeGradients }\n\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\tgradients={ themeGradients }\n\t\t\t\t\tonChange={ setThemeGradients }\n\t\t\t\t\tpaletteLabel={ __( 'Theme' ) }\n\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! defaultGradients &&\n\t\t\t\t!! defaultGradients.length &&\n\t\t\t\t!! defaultPaletteEnabled && (\n\t\t\t\t\t<PaletteEdit\n\t\t\t\t\t\tcanReset={ defaultGradients !== baseDefaultGradients }\n\t\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\t\tgradients={ defaultGradients }\n\t\t\t\t\t\tonChange={ setDefaultGradients }\n\t\t\t\t\t\tpaletteLabel={ __( 'Default' ) }\n\t\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t<PaletteEdit\n\t\t\t\tgradients={ customGradients }\n\t\t\t\tonChange={ setCustomGradients }\n\t\t\t\tpaletteLabel={ __( 'Custom' ) }\n\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\tslugPrefix=\"custom-\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t/>\n\t\t\t{ !! duotonePalette && !! duotonePalette.length && (\n\t\t\t\t<div>\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Duotone' ) }</Subtitle>\n\t\t\t\t\t<Spacer margin={ 3 } />\n\t\t\t\t\t<DuotonePicker\n\t\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\t\tdisableCustomDuotone\n\t\t\t\t\t\tdisableCustomColors\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tonChange={ noop }\n\t\t\t\t\t\tcolorPalette={ [] }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AA8EI,cAgCA,YAhCA;AA3EJ,SAAS,wBAAwB;AACjC;AAAA,EACC,wBAAwB;AAAA,EACxB,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,UAAU;AAMnB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAE3B,MAAM,qBAAqB,EAAE,WAAW,gBAAyB,QAAQ,EAAE;AAE3E,MAAM,OAAO,MAAM;AAAC;AAML,SAAR,qBAAuC;AAAA,EAC7C;AACD,GAA+B;AAC9B,QAAM,CAAE,gBAAgB,iBAAkB,IAAI;AAAA,IAC7C;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAE,kBAAmB,IAAI;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAE,kBAAkB,mBAAoB,IAAI;AAAA,IACjD;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAE,oBAAqB,IAAI;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAE,iBAAiB,kBAAmB,IAAI;AAAA,IAC/C;AAAA,IACA;AAAA,EACD;AAEA,QAAM,CAAE,qBAAsB,IAAI;AAAA,IACjC;AAAA,IACA;AAAA,EACD;AAEA,QAAM,CAAE,aAAc,IAAI,WAAY,sBAAuB,KAAK,CAAC;AACnE,QAAM,CAAE,cAAe,IAAI,WAAY,uBAAwB,KAAK,CAAC;AACrE,QAAM,CAAE,YAAa,IAAI,WAAY,qBAAsB,KAAK,CAAC;AACjE,QAAM,CAAE,qBAAsB,IAAI,WAAY,sBAAuB;AAErE,QAAM,iBAAiB;AAAA,IACtB,GAAK,iBAAiB,CAAC;AAAA,IACvB,GAAK,gBAAgB,CAAC;AAAA,IACtB,GAAK,kBAAkB,wBAAwB,iBAAiB,CAAC;AAAA,EAClE;AAEA,QAAM,mBAAmB,iBAAkB,SAAS,GAAI;AACxD,QAAM,eAAe,mBAAmB,qBAAqB;AAE7D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,SAAU;AAAA,MAER;AAAA,SAAC,CAAE,kBAAkB,CAAC,CAAE,eAAe,UACxC;AAAA,UAAC;AAAA;AAAA,YACA,UAAW,mBAAmB;AAAA,YAC9B,qBAAmB;AAAA,YACnB,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,cAAe,GAAI,OAAQ;AAAA,YAC3B,0BAA2B;AAAA,YAC3B;AAAA;AAAA,QACD;AAAA,QAEC,CAAC,CAAE,oBACJ,CAAC,CAAE,iBAAiB,UACpB,CAAC,CAAE,yBACF;AAAA,UAAC;AAAA;AAAA,YACA,UAAW,qBAAqB;AAAA,YAChC,qBAAmB;AAAA,YACnB,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,cAAe,GAAI,SAAU;AAAA,YAC7B,0BAA2B;AAAA,YAC3B;AAAA;AAAA,QACD;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,cAAe,GAAI,QAAS;AAAA,YAC5B,0BAA2B;AAAA,YAC3B,YAAW;AAAA,YACX;AAAA;AAAA,QACD;AAAA,QACE,CAAC,CAAE,kBAAkB,CAAC,CAAE,eAAe,UACxC,qBAAC,SACA;AAAA,8BAAC,YAAS,OAAQ,GAAM,aAAI,SAAU,GAAG;AAAA,UACzC,oBAAC,UAAO,QAAS,GAAI;AAAA,UACrB;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA,sBAAoB;AAAA,cACpB,qBAAmB;AAAA,cACnB,WAAY;AAAA,cACZ,UAAW;AAAA,cACX,cAAe,CAAC;AAAA;AAAA,UACjB;AAAA,WACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { __unstableMotion as motion } from "@wordpress/components";
|
|
3
|
+
import { useStylesPreviewColors } from "./preview-hooks";
|
|
4
|
+
function HighlightedColors({
|
|
5
|
+
normalizedColorSwatchSize,
|
|
6
|
+
ratio
|
|
7
|
+
}) {
|
|
8
|
+
const { highlightedColors } = useStylesPreviewColors();
|
|
9
|
+
const scaledSwatchSize = normalizedColorSwatchSize * ratio;
|
|
10
|
+
return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ jsx(
|
|
11
|
+
motion.div,
|
|
12
|
+
{
|
|
13
|
+
style: {
|
|
14
|
+
height: scaledSwatchSize,
|
|
15
|
+
width: scaledSwatchSize,
|
|
16
|
+
background: color,
|
|
17
|
+
borderRadius: scaledSwatchSize / 2
|
|
18
|
+
},
|
|
19
|
+
animate: {
|
|
20
|
+
scale: 1,
|
|
21
|
+
opacity: 1
|
|
22
|
+
},
|
|
23
|
+
initial: {
|
|
24
|
+
scale: 0.1,
|
|
25
|
+
opacity: 0
|
|
26
|
+
},
|
|
27
|
+
transition: {
|
|
28
|
+
delay: index === 1 ? 0.2 : 0.1
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
`${slug}-${index}`
|
|
32
|
+
));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
HighlightedColors as default
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=highlighted-colors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/highlighted-colors.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useStylesPreviewColors } from './preview-hooks';\n\ninterface HighlightedColorsProps {\n\tnormalizedColorSwatchSize: number;\n\tratio: number;\n}\n\nexport default function HighlightedColors( {\n\tnormalizedColorSwatchSize,\n\tratio,\n}: HighlightedColorsProps ) {\n\tconst { highlightedColors } = useStylesPreviewColors();\n\tconst scaledSwatchSize = normalizedColorSwatchSize * ratio;\n\treturn highlightedColors.map( ( { slug, color }, index ) => (\n\t\t<motion.div\n\t\t\tkey={ `${ slug }-${ index }` }\n\t\t\tstyle={ {\n\t\t\t\theight: scaledSwatchSize,\n\t\t\t\twidth: scaledSwatchSize,\n\t\t\t\tbackground: color,\n\t\t\t\tborderRadius: scaledSwatchSize / 2,\n\t\t\t} }\n\t\t\tanimate={ {\n\t\t\t\tscale: 1,\n\t\t\t\topacity: 1,\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tscale: 0.1,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\ttransition={ {\n\t\t\t\tdelay: index === 1 ? 0.2 : 0.1,\n\t\t\t} }\n\t\t/>\n\t) );\n}\n"],
|
|
5
|
+
"mappings": "AAsBE;AAnBF,SAAS,oBAAoB,cAAc;AAK3C,SAAS,8BAA8B;AAOxB,SAAR,kBAAoC;AAAA,EAC1C;AAAA,EACA;AACD,GAA4B;AAC3B,QAAM,EAAE,kBAAkB,IAAI,uBAAuB;AACrD,QAAM,mBAAmB,4BAA4B;AACrD,SAAO,kBAAkB,IAAK,CAAE,EAAE,MAAM,MAAM,GAAG,UAChD;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MAEA,OAAQ;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,cAAc,mBAAmB;AAAA,MAClC;AAAA,MACA,SAAU;AAAA,QACT,OAAO;AAAA,QACP,SAAS;AAAA,MACV;AAAA,MACA,SAAU;AAAA,QACT,OAAO;AAAA,QACP,SAAS;AAAA,MACV;AAAA,MACA,YAAa;AAAA,QACZ,OAAO,UAAU,IAAI,MAAM;AAAA,MAC5B;AAAA;AAAA,IAjBM,GAAI,IAAK,IAAK,KAAM;AAAA,EAkB3B,CACC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { colord, extend } from "colord";
|
|
2
|
+
import a11yPlugin from "colord/plugins/a11y";
|
|
3
|
+
import { useCallback, useContext, useMemo } from "@wordpress/element";
|
|
4
|
+
import { useSelect } from "@wordpress/data";
|
|
5
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
6
|
+
import { __ } from "@wordpress/i18n";
|
|
7
|
+
import {
|
|
8
|
+
getStyle,
|
|
9
|
+
setStyle,
|
|
10
|
+
getSetting,
|
|
11
|
+
setSetting,
|
|
12
|
+
mergeGlobalStyles
|
|
13
|
+
} from "@wordpress/global-styles-engine";
|
|
14
|
+
import { GlobalStylesContext } from "./context";
|
|
15
|
+
import { removePropertiesFromObject, isVariationWithProperties } from "./utils";
|
|
16
|
+
extend([a11yPlugin]);
|
|
17
|
+
function useStyle(path, blockName, readFrom = "merged", shouldDecodeEncode = true) {
|
|
18
|
+
const { user, base, merged, onChange } = useContext(GlobalStylesContext);
|
|
19
|
+
let sourceValue = merged;
|
|
20
|
+
if (readFrom === "base") {
|
|
21
|
+
sourceValue = base;
|
|
22
|
+
} else if (readFrom === "user") {
|
|
23
|
+
sourceValue = user;
|
|
24
|
+
}
|
|
25
|
+
const styleValue = useMemo(
|
|
26
|
+
() => getStyle(sourceValue, path, blockName, shouldDecodeEncode),
|
|
27
|
+
[sourceValue, path, blockName, shouldDecodeEncode]
|
|
28
|
+
);
|
|
29
|
+
const setStyleValue = useCallback(
|
|
30
|
+
(newValue) => {
|
|
31
|
+
const newGlobalStyles = setStyle(
|
|
32
|
+
user,
|
|
33
|
+
path,
|
|
34
|
+
newValue,
|
|
35
|
+
blockName
|
|
36
|
+
);
|
|
37
|
+
onChange(newGlobalStyles);
|
|
38
|
+
},
|
|
39
|
+
[user, onChange, path, blockName]
|
|
40
|
+
);
|
|
41
|
+
return [styleValue, setStyleValue];
|
|
42
|
+
}
|
|
43
|
+
function useSetting(path, blockName, readFrom = "merged") {
|
|
44
|
+
const { user, base, merged, onChange } = useContext(GlobalStylesContext);
|
|
45
|
+
let sourceValue = merged;
|
|
46
|
+
if (readFrom === "base") {
|
|
47
|
+
sourceValue = base;
|
|
48
|
+
} else if (readFrom === "user") {
|
|
49
|
+
sourceValue = user;
|
|
50
|
+
}
|
|
51
|
+
const settingValue = useMemo(
|
|
52
|
+
() => getSetting(sourceValue, path, blockName),
|
|
53
|
+
[sourceValue, path, blockName]
|
|
54
|
+
);
|
|
55
|
+
const setSettingValue = useCallback(
|
|
56
|
+
(newValue) => {
|
|
57
|
+
const newGlobalStyles = setSetting(
|
|
58
|
+
user,
|
|
59
|
+
path,
|
|
60
|
+
newValue,
|
|
61
|
+
blockName
|
|
62
|
+
);
|
|
63
|
+
onChange(newGlobalStyles);
|
|
64
|
+
},
|
|
65
|
+
[user, onChange, path, blockName]
|
|
66
|
+
);
|
|
67
|
+
return [settingValue, setSettingValue];
|
|
68
|
+
}
|
|
69
|
+
const EMPTY_ARRAY = [];
|
|
70
|
+
function hasThemeVariation({
|
|
71
|
+
title,
|
|
72
|
+
settings,
|
|
73
|
+
styles
|
|
74
|
+
}) {
|
|
75
|
+
return title === __("Default") || Object.keys(settings || {}).length > 0 || Object.keys(styles || {}).length > 0;
|
|
76
|
+
}
|
|
77
|
+
function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
|
|
78
|
+
const { variationsFromTheme } = useSelect((select) => {
|
|
79
|
+
const _variationsFromTheme = select(
|
|
80
|
+
coreStore
|
|
81
|
+
).__experimentalGetCurrentThemeGlobalStylesVariations?.();
|
|
82
|
+
return {
|
|
83
|
+
variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
const { user: userVariation } = useContext(GlobalStylesContext);
|
|
87
|
+
return useMemo(() => {
|
|
88
|
+
const clonedUserVariation = structuredClone(userVariation);
|
|
89
|
+
const userVariationWithoutProperties = removePropertiesFromObject(
|
|
90
|
+
clonedUserVariation,
|
|
91
|
+
properties
|
|
92
|
+
);
|
|
93
|
+
userVariationWithoutProperties.title = __("Default");
|
|
94
|
+
const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
|
|
95
|
+
return isVariationWithProperties(variation, properties);
|
|
96
|
+
}).map((variation) => {
|
|
97
|
+
return mergeGlobalStyles(
|
|
98
|
+
userVariationWithoutProperties,
|
|
99
|
+
variation
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
const variationsByProperties = [
|
|
103
|
+
userVariationWithoutProperties,
|
|
104
|
+
...variationsWithPropertiesAndBase
|
|
105
|
+
];
|
|
106
|
+
return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
|
|
107
|
+
}, [properties, userVariation, variationsFromTheme]);
|
|
108
|
+
}
|
|
109
|
+
const propertiesToFilter = ["color"];
|
|
110
|
+
function useColorVariations() {
|
|
111
|
+
return useCurrentMergeThemeStyleVariationsWithUserConfig(
|
|
112
|
+
propertiesToFilter
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function useColorRandomizer(blockName) {
|
|
116
|
+
const [themeColors, setThemeColors] = useSetting(
|
|
117
|
+
"color.palette.theme",
|
|
118
|
+
blockName
|
|
119
|
+
);
|
|
120
|
+
const randomizeColors = useCallback(() => {
|
|
121
|
+
if (!themeColors || !themeColors.length) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const randomRotationValue = Math.floor(Math.random() * 225);
|
|
125
|
+
const newColors = themeColors.map((colorObject) => {
|
|
126
|
+
const { color } = colorObject;
|
|
127
|
+
const newColor = colord(color).rotate(randomRotationValue).toHex();
|
|
128
|
+
return {
|
|
129
|
+
...colorObject,
|
|
130
|
+
color: newColor
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
setThemeColors(newColors);
|
|
134
|
+
}, [themeColors, setThemeColors]);
|
|
135
|
+
return window.__experimentalEnableColorRandomizer ? [randomizeColors] : [];
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
useColorRandomizer,
|
|
139
|
+
useColorVariations,
|
|
140
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig,
|
|
141
|
+
useSetting,
|
|
142
|
+
useStyle
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=hooks.js.map
|