@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/font-library-modal/font-demo.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useContext, useEffect, useState, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './context';\nimport {\n\tgetFacePreviewStyle,\n\tgetFamilyPreviewStyle,\n} from './utils/preview-styles';\nimport type { FontFamily, FontFace, FontDemoProps } from './types';\n\nfunction getPreviewUrl( fontFace: FontFace ): string | undefined {\n\tif ( fontFace.preview ) {\n\t\treturn fontFace.preview;\n\t}\n\tif ( fontFace.src ) {\n\t\treturn Array.isArray( fontFace.src ) ? fontFace.src[ 0 ] : fontFace.src;\n\t}\n\treturn undefined;\n}\n\nfunction getDisplayFontFace( font: FontFamily | FontFace ): FontFace {\n\t// if this IS a font face return it\n\tif (\n\t\t( 'fontStyle' in font && font.fontStyle ) ||\n\t\t( 'fontWeight' in font && font.fontWeight )\n\t) {\n\t\treturn font;\n\t}\n\t// if this is a font family with a collection of font faces\n\t// return the first one that is normal and 400 OR just the first one\n\tif ( 'fontFace' in font && font.fontFace && font.fontFace.length ) {\n\t\treturn (\n\t\t\tfont.fontFace.find(\n\t\t\t\t( face ) =>\n\t\t\t\t\tface.fontStyle === 'normal' && face.fontWeight === '400'\n\t\t\t) || font.fontFace[ 0 ]\n\t\t);\n\t}\n\t// This must be a font family with no font faces\n\t// return a fake font face\n\treturn {\n\t\tfontStyle: 'normal',\n\t\tfontWeight: '400',\n\t\tfontFamily: font.fontFamily,\n\t\tfake: true,\n\t};\n}\n\nfunction FontDemo( { font, text }: FontDemoProps ) {\n\tconst ref = useRef< HTMLDivElement >( null );\n\n\tconst fontFace = getDisplayFontFace( font );\n\tconst style = getFamilyPreviewStyle( font );\n\ttext = text || ( 'name' in font ? font.name : '' );\n\tconst customPreviewUrl = font.preview;\n\n\tconst [ isIntersecting, setIsIntersecting ] = useState< boolean >( false );\n\tconst [ isAssetLoaded, setIsAssetLoaded ] = useState< boolean >( false );\n\tconst { loadFontFaceAsset } = useContext( FontLibraryContext );\n\n\tconst previewUrl = customPreviewUrl ?? getPreviewUrl( fontFace );\n\tconst isPreviewImage =\n\t\tpreviewUrl && previewUrl.match( /\\.(png|jpg|jpeg|gif|svg)$/i );\n\n\tconst faceStyles = getFacePreviewStyle( fontFace );\n\tconst textDemoStyle = {\n\t\tfontSize: '18px',\n\t\tlineHeight: 1,\n\t\topacity: isAssetLoaded ? '1' : '0',\n\t\t...style,\n\t\t...faceStyles,\n\t};\n\n\tuseEffect( () => {\n\t\tconst observer = new window.IntersectionObserver( ( [ entry ] ) => {\n\t\t\tsetIsIntersecting( entry.isIntersecting );\n\t\t}, {} );\n\t\tif ( ref.current ) {\n\t\t\tobserver.observe( ref.current );\n\t\t}\n\t\treturn () => observer.disconnect();\n\t}, [ ref ] );\n\n\tuseEffect( () => {\n\t\tconst loadAsset = async () => {\n\t\t\tif ( isIntersecting ) {\n\t\t\t\tif ( ! isPreviewImage && fontFace.src ) {\n\t\t\t\t\tawait loadFontFaceAsset( fontFace );\n\t\t\t\t}\n\t\t\t\tsetIsAssetLoaded( true );\n\t\t\t}\n\t\t};\n\t\tloadAsset();\n\t}, [ fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage ] );\n\n\treturn (\n\t\t<div ref={ ref }>\n\t\t\t{ isPreviewImage ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={ previewUrl }\n\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\talt={ text }\n\t\t\t\t\tclassName=\"font-library-modal__font-variant_demo-image\"\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tstyle={ textDemoStyle }\n\t\t\t\t\tclassName=\"font-library-modal__font-variant_demo-text\"\n\t\t\t\t>\n\t\t\t\t\t{ text }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default FontDemo;\n"],
|
|
5
|
+
"mappings": "AAwGI;AArGJ,SAAS,sBAAsB,YAAY;AAC3C,SAAS,YAAY,WAAW,UAAU,cAAc;AAKxD,SAAS,0BAA0B;AACnC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAGP,SAAS,cAAe,UAAyC;AAChE,MAAK,SAAS,SAAU;AACvB,WAAO,SAAS;AAAA,EACjB;AACA,MAAK,SAAS,KAAM;AACnB,WAAO,MAAM,QAAS,SAAS,GAAI,IAAI,SAAS,IAAK,CAAE,IAAI,SAAS;AAAA,EACrE;AACA,SAAO;AACR;AAEA,SAAS,mBAAoB,MAAwC;AAEpE,MACG,eAAe,QAAQ,KAAK,aAC5B,gBAAgB,QAAQ,KAAK,YAC9B;AACD,WAAO;AAAA,EACR;AAGA,MAAK,cAAc,QAAQ,KAAK,YAAY,KAAK,SAAS,QAAS;AAClE,WACC,KAAK,SAAS;AAAA,MACb,CAAE,SACD,KAAK,cAAc,YAAY,KAAK,eAAe;AAAA,IACrD,KAAK,KAAK,SAAU,CAAE;AAAA,EAExB;AAGA,SAAO;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,YAAY,KAAK;AAAA,IACjB,MAAM;AAAA,EACP;AACD;AAEA,SAAS,SAAU,EAAE,MAAM,KAAK,GAAmB;AAClD,QAAM,MAAM,OAA0B,IAAK;AAE3C,QAAM,WAAW,mBAAoB,IAAK;AAC1C,QAAM,QAAQ,sBAAuB,IAAK;AAC1C,SAAO,SAAU,UAAU,OAAO,KAAK,OAAO;AAC9C,QAAM,mBAAmB,KAAK;AAE9B,QAAM,CAAE,gBAAgB,iBAAkB,IAAI,SAAqB,KAAM;AACzE,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAqB,KAAM;AACvE,QAAM,EAAE,kBAAkB,IAAI,WAAY,kBAAmB;AAE7D,QAAM,aAAa,oBAAoB,cAAe,QAAS;AAC/D,QAAM,iBACL,cAAc,WAAW,MAAO,4BAA6B;AAE9D,QAAM,aAAa,oBAAqB,QAAS;AACjD,QAAM,gBAAgB;AAAA,IACrB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,SAAS,gBAAgB,MAAM;AAAA,IAC/B,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AAEA,YAAW,MAAM;AAChB,UAAM,WAAW,IAAI,OAAO,qBAAsB,CAAE,CAAE,KAAM,MAAO;AAClE,wBAAmB,MAAM,cAAe;AAAA,IACzC,GAAG,CAAC,CAAE;AACN,QAAK,IAAI,SAAU;AAClB,eAAS,QAAS,IAAI,OAAQ;AAAA,IAC/B;AACA,WAAO,MAAM,SAAS,WAAW;AAAA,EAClC,GAAG,CAAE,GAAI,CAAE;AAEX,YAAW,MAAM;AAChB,UAAM,YAAY,YAAY;AAC7B,UAAK,gBAAiB;AACrB,YAAK,CAAE,kBAAkB,SAAS,KAAM;AACvC,gBAAM,kBAAmB,QAAS;AAAA,QACnC;AACA,yBAAkB,IAAK;AAAA,MACxB;AAAA,IACD;AACA,cAAU;AAAA,EACX,GAAG,CAAE,UAAU,gBAAgB,mBAAmB,cAAe,CAAE;AAEnE,SACC,oBAAC,SAAI,KACF,2BACD;AAAA,IAAC;AAAA;AAAA,MACA,KAAM;AAAA,MACN,SAAQ;AAAA,MACR,KAAM;AAAA,MACN,WAAU;AAAA;AAAA,EACX,IAEA;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA,MACR,WAAU;AAAA,MAER;AAAA;AAAA,EACH,GAEF;AAEF;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
CardBody,
|
|
7
|
+
__experimentalHeading as Heading,
|
|
8
|
+
__experimentalText as Text,
|
|
9
|
+
__experimentalSpacer as Spacer
|
|
10
|
+
} from "@wordpress/components";
|
|
11
|
+
function GoogleFontsConfirmDialog() {
|
|
12
|
+
const handleConfirm = () => {
|
|
13
|
+
window.localStorage.setItem(
|
|
14
|
+
"wp-font-library-google-fonts-permission",
|
|
15
|
+
"true"
|
|
16
|
+
);
|
|
17
|
+
window.dispatchEvent(new Event("storage"));
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ jsx("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardBody, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Heading, { level: 2, children: __("Connect to Google Fonts") }),
|
|
21
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 6 }),
|
|
22
|
+
/* @__PURE__ */ jsx(Text, { as: "p", children: __(
|
|
23
|
+
"To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts."
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 3 }),
|
|
26
|
+
/* @__PURE__ */ jsx(Text, { as: "p", children: __(
|
|
27
|
+
"You can alternatively upload files directly on the Upload tab."
|
|
28
|
+
) }),
|
|
29
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 6 }),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
Button,
|
|
32
|
+
{
|
|
33
|
+
__next40pxDefaultSize: true,
|
|
34
|
+
variant: "primary",
|
|
35
|
+
onClick: handleConfirm,
|
|
36
|
+
children: __("Allow access to Google Fonts")
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }) }) });
|
|
40
|
+
}
|
|
41
|
+
var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog;
|
|
42
|
+
export {
|
|
43
|
+
google_fonts_confirm_dialog_default as default
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=google-fonts-confirm-dialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/font-library-modal/google-fonts-confirm-dialog.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tCard,\n\tCardBody,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\nfunction GoogleFontsConfirmDialog(): JSX.Element {\n\tconst handleConfirm = (): void => {\n\t\t// eslint-disable-next-line no-undef\n\t\twindow.localStorage.setItem(\n\t\t\t'wp-font-library-google-fonts-permission',\n\t\t\t'true'\n\t\t);\n\t\twindow.dispatchEvent( new Event( 'storage' ) );\n\t};\n\n\treturn (\n\t\t<div className=\"font-library__google-fonts-confirm\">\n\t\t\t<Card>\n\t\t\t\t<CardBody>\n\t\t\t\t\t<Heading level={ 2 }>\n\t\t\t\t\t\t{ __( 'Connect to Google Fonts' ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t<Spacer margin={ 6 } />\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Spacer margin={ 3 } />\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'You can alternatively upload files directly on the Upload tab.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Spacer margin={ 6 } />\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ handleConfirm }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Allow access to Google Fonts' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</CardBody>\n\t\t\t</Card>\n\t\t</div>\n\t);\n}\n\nexport default GoogleFontsConfirmDialog;\n"],
|
|
5
|
+
"mappings": "AA0BI,SACC,KADD;AAvBJ,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,OAClB;AAEP,SAAS,2BAAwC;AAChD,QAAM,gBAAgB,MAAY;AAEjC,WAAO,aAAa;AAAA,MACnB;AAAA,MACA;AAAA,IACD;AACA,WAAO,cAAe,IAAI,MAAO,SAAU,CAAE;AAAA,EAC9C;AAEA,SACC,oBAAC,SAAI,WAAU,sCACd,8BAAC,QACA,+BAAC,YACA;AAAA,wBAAC,WAAQ,OAAQ,GACd,aAAI,yBAA0B,GACjC;AAAA,IACA,oBAAC,UAAO,QAAS,GAAI;AAAA,IACrB,oBAAC,QAAK,IAAG,KACN;AAAA,MACD;AAAA,IACD,GACD;AAAA,IACA,oBAAC,UAAO,QAAS,GAAI;AAAA,IACrB,oBAAC,QAAK,IAAG,KACN;AAAA,MACD;AAAA,IACD,GACD;AAAA,IACA,oBAAC,UAAO,QAAS,GAAI;AAAA,IACrB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,SAAQ;AAAA,QACR,SAAU;AAAA,QAER,aAAI,8BAA+B;AAAA;AAAA,IACtC;AAAA,KACD,GACD,GACD;AAEF;AAEA,IAAO,sCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __, _x } from "@wordpress/i18n";
|
|
3
|
+
import {
|
|
4
|
+
Modal,
|
|
5
|
+
privateApis as componentsPrivateApis
|
|
6
|
+
} from "@wordpress/components";
|
|
7
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
8
|
+
import { useSelect } from "@wordpress/data";
|
|
9
|
+
import { useContext } from "@wordpress/element";
|
|
10
|
+
import InstalledFonts from "./installed-fonts";
|
|
11
|
+
import FontCollection from "./font-collection";
|
|
12
|
+
import UploadFonts from "./upload-fonts";
|
|
13
|
+
import { FontLibraryContext } from "./context";
|
|
14
|
+
import { unlock } from "../lock-unlock";
|
|
15
|
+
const { Tabs } = unlock(componentsPrivateApis);
|
|
16
|
+
const DEFAULT_TAB = {
|
|
17
|
+
id: "installed-fonts",
|
|
18
|
+
title: _x("Library", "Font library")
|
|
19
|
+
};
|
|
20
|
+
const UPLOAD_TAB = {
|
|
21
|
+
id: "upload-fonts",
|
|
22
|
+
title: _x("Upload", "noun")
|
|
23
|
+
};
|
|
24
|
+
const tabsFromCollections = (collections) => collections.map(({ slug, name }) => ({
|
|
25
|
+
id: slug,
|
|
26
|
+
title: collections.length === 1 && slug === "google-fonts" ? __("Install Fonts") : name
|
|
27
|
+
}));
|
|
28
|
+
function FontLibraryModal({
|
|
29
|
+
onRequestClose,
|
|
30
|
+
defaultTabId = "installed-fonts"
|
|
31
|
+
}) {
|
|
32
|
+
const { collections } = useContext(FontLibraryContext);
|
|
33
|
+
const canUserCreate = useSelect((select) => {
|
|
34
|
+
return select(coreStore).canUser("create", {
|
|
35
|
+
kind: "postType",
|
|
36
|
+
name: "wp_font_family"
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
const tabs = [DEFAULT_TAB];
|
|
40
|
+
if (canUserCreate) {
|
|
41
|
+
tabs.push(UPLOAD_TAB);
|
|
42
|
+
tabs.push(...tabsFromCollections(collections || []));
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
Modal,
|
|
46
|
+
{
|
|
47
|
+
title: __("Fonts"),
|
|
48
|
+
onRequestClose,
|
|
49
|
+
isFullScreen: true,
|
|
50
|
+
className: "font-library-modal",
|
|
51
|
+
children: /* @__PURE__ */ jsxs(Tabs, { defaultTabId, children: [
|
|
52
|
+
/* @__PURE__ */ jsx("div", { className: "font-library-modal__tablist-container", children: /* @__PURE__ */ jsx(Tabs.TabList, { children: tabs.map(({ id, title }) => /* @__PURE__ */ jsx(Tabs.Tab, { tabId: id, children: title }, id)) }) }),
|
|
53
|
+
tabs.map(({ id }) => {
|
|
54
|
+
let contents;
|
|
55
|
+
switch (id) {
|
|
56
|
+
case "upload-fonts":
|
|
57
|
+
contents = /* @__PURE__ */ jsx(UploadFonts, {});
|
|
58
|
+
break;
|
|
59
|
+
case "installed-fonts":
|
|
60
|
+
contents = /* @__PURE__ */ jsx(InstalledFonts, {});
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
contents = /* @__PURE__ */ jsx(FontCollection, { slug: id });
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
Tabs.TabPanel,
|
|
67
|
+
{
|
|
68
|
+
tabId: id,
|
|
69
|
+
focusable: false,
|
|
70
|
+
children: contents
|
|
71
|
+
},
|
|
72
|
+
id
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
] })
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
var font_library_modal_default = FontLibraryModal;
|
|
80
|
+
export {
|
|
81
|
+
font_library_modal_default as default
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/font-library-modal/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InstalledFonts from './installed-fonts';\nimport FontCollection from './font-collection';\nimport UploadFonts from './upload-fonts';\nimport { FontLibraryContext } from './context';\nimport type { FontCollection as FontCollectionType } from './types';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst DEFAULT_TAB = {\n\tid: 'installed-fonts',\n\ttitle: _x( 'Library', 'Font library' ),\n};\n\nconst UPLOAD_TAB = {\n\tid: 'upload-fonts',\n\ttitle: _x( 'Upload', 'noun' ),\n};\n\nconst tabsFromCollections = ( collections: FontCollectionType[] ) =>\n\tcollections.map( ( { slug, name } ) => ( {\n\t\tid: slug,\n\t\ttitle:\n\t\t\tcollections.length === 1 && slug === 'google-fonts'\n\t\t\t\t? __( 'Install Fonts' )\n\t\t\t\t: name,\n\t} ) );\n\nfunction FontLibraryModal( {\n\tonRequestClose,\n\tdefaultTabId = 'installed-fonts',\n}: {\n\tonRequestClose: () => void;\n\tdefaultTabId?: string;\n} ) {\n\tconst { collections } = useContext( FontLibraryContext );\n\tconst canUserCreate = useSelect( ( select ) => {\n\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\tkind: 'postType',\n\t\t\tname: 'wp_font_family',\n\t\t} );\n\t}, [] );\n\n\tconst tabs: { id: string; title: string }[] = [ DEFAULT_TAB ];\n\n\tif ( canUserCreate ) {\n\t\ttabs.push( UPLOAD_TAB );\n\t\ttabs.push( ...tabsFromCollections( collections || [] ) );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Fonts' ) }\n\t\t\tonRequestClose={ onRequestClose }\n\t\t\tisFullScreen\n\t\t\tclassName=\"font-library-modal\"\n\t\t>\n\t\t\t<Tabs defaultTabId={ defaultTabId }>\n\t\t\t\t<div className=\"font-library-modal__tablist-container\">\n\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t{ tabs.map( ( { id, title } ) => (\n\t\t\t\t\t\t\t<Tabs.Tab key={ id } tabId={ id }>\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t</div>\n\t\t\t\t{ tabs.map( ( { id } ) => {\n\t\t\t\t\tlet contents;\n\t\t\t\t\tswitch ( id ) {\n\t\t\t\t\t\tcase 'upload-fonts':\n\t\t\t\t\t\t\tcontents = <UploadFonts />;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'installed-fonts':\n\t\t\t\t\t\t\tcontents = <InstalledFonts />;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tcontents = <FontCollection slug={ id } />;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\ttabId={ id }\n\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contents }\n\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Tabs>\n\t\t</Modal>\n\t);\n}\n\nexport default FontLibraryModal;\n"],
|
|
5
|
+
"mappings": "AAwEG,SAII,KAJJ;AArEH,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAK3B,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,iBAAiB;AACxB,SAAS,0BAA0B;AAEnC,SAAS,cAAc;AAEvB,MAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;AAE/C,MAAM,cAAc;AAAA,EACnB,IAAI;AAAA,EACJ,OAAO,GAAI,WAAW,cAAe;AACtC;AAEA,MAAM,aAAa;AAAA,EAClB,IAAI;AAAA,EACJ,OAAO,GAAI,UAAU,MAAO;AAC7B;AAEA,MAAM,sBAAsB,CAAE,gBAC7B,YAAY,IAAK,CAAE,EAAE,MAAM,KAAK,OAAS;AAAA,EACxC,IAAI;AAAA,EACJ,OACC,YAAY,WAAW,KAAK,SAAS,iBAClC,GAAI,eAAgB,IACpB;AACL,EAAI;AAEL,SAAS,iBAAkB;AAAA,EAC1B;AAAA,EACA,eAAe;AAChB,GAGI;AACH,QAAM,EAAE,YAAY,IAAI,WAAY,kBAAmB;AACvD,QAAM,gBAAgB,UAAW,CAAE,WAAY;AAC9C,WAAO,OAAQ,SAAU,EAAE,QAAS,UAAU;AAAA,MAC7C,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AAEN,QAAM,OAAwC,CAAE,WAAY;AAE5D,MAAK,eAAgB;AACpB,SAAK,KAAM,UAAW;AACtB,SAAK,KAAM,GAAG,oBAAqB,eAAe,CAAC,CAAE,CAAE;AAAA,EACxD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,OAAQ;AAAA,MACpB;AAAA,MACA,cAAY;AAAA,MACZ,WAAU;AAAA,MAEV,+BAAC,QAAK,cACL;AAAA,4BAAC,SAAI,WAAU,yCACd,8BAAC,KAAK,SAAL,EACE,eAAK,IAAK,CAAE,EAAE,IAAI,MAAM,MACzB,oBAAC,KAAK,KAAL,EAAoB,OAAQ,IAC1B,mBADa,EAEhB,CACC,GACH,GACD;AAAA,QACE,KAAK,IAAK,CAAE,EAAE,GAAG,MAAO;AACzB,cAAI;AACJ,kBAAS,IAAK;AAAA,YACb,KAAK;AACJ,yBAAW,oBAAC,eAAY;AACxB;AAAA,YACD,KAAK;AACJ,yBAAW,oBAAC,kBAAe;AAC3B;AAAA,YACD;AACC,yBAAW,oBAAC,kBAAe,MAAO,IAAK;AAAA,UACzC;AACA,iBACC;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cAEA,OAAQ;AAAA,cACR,WAAY;AAAA,cAEV;AAAA;AAAA,YAJI;AAAA,UAKP;AAAA,QAEF,CAAE;AAAA,SACH;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
__experimentalHeading as Heading,
|
|
7
|
+
Navigator,
|
|
8
|
+
useNavigator,
|
|
9
|
+
__experimentalSpacer as Spacer,
|
|
10
|
+
__experimentalText as Text,
|
|
11
|
+
__experimentalVStack as VStack,
|
|
12
|
+
Flex,
|
|
13
|
+
Notice,
|
|
14
|
+
ProgressBar,
|
|
15
|
+
CheckboxControl
|
|
16
|
+
} from "@wordpress/components";
|
|
17
|
+
import { useEntityRecord, store as coreStore } from "@wordpress/core-data";
|
|
18
|
+
import { useSelect } from "@wordpress/data";
|
|
19
|
+
import { useContext, useEffect, useState } from "@wordpress/element";
|
|
20
|
+
import { __, _x, sprintf, isRTL } from "@wordpress/i18n";
|
|
21
|
+
import { chevronLeft, chevronRight } from "@wordpress/icons";
|
|
22
|
+
import { FontLibraryContext } from "./context";
|
|
23
|
+
import FontCard from "./font-card";
|
|
24
|
+
import LibraryFontVariant from "./library-font-variant";
|
|
25
|
+
import { sortFontFaces } from "./utils/sort-font-faces";
|
|
26
|
+
import {
|
|
27
|
+
setUIValuesNeeded,
|
|
28
|
+
loadFontFaceInBrowser,
|
|
29
|
+
unloadFontFaceInBrowser,
|
|
30
|
+
getDisplaySrcFromFontFace
|
|
31
|
+
} from "./utils";
|
|
32
|
+
import { useSetting } from "../hooks";
|
|
33
|
+
function InstalledFonts() {
|
|
34
|
+
const {
|
|
35
|
+
baseCustomFonts,
|
|
36
|
+
libraryFontSelected,
|
|
37
|
+
handleSetLibraryFontSelected,
|
|
38
|
+
refreshLibrary,
|
|
39
|
+
uninstallFontFamily,
|
|
40
|
+
isResolvingLibrary,
|
|
41
|
+
isInstalling,
|
|
42
|
+
saveFontFamilies,
|
|
43
|
+
getFontFacesActivated
|
|
44
|
+
} = useContext(FontLibraryContext);
|
|
45
|
+
const [fontFamilies, setFontFamilies] = useSetting("typography.fontFamilies");
|
|
46
|
+
const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = useState(false);
|
|
47
|
+
const [notice, setNotice] = useState(null);
|
|
48
|
+
const [baseFontFamilies] = useSetting("typography.fontFamilies", void 0, "base");
|
|
49
|
+
const globalStylesId = useSelect((select) => {
|
|
50
|
+
const { __experimentalGetCurrentGlobalStylesId } = select(coreStore);
|
|
51
|
+
return __experimentalGetCurrentGlobalStylesId();
|
|
52
|
+
}, []);
|
|
53
|
+
const globalStyles = useEntityRecord(
|
|
54
|
+
"root",
|
|
55
|
+
"globalStyles",
|
|
56
|
+
globalStylesId
|
|
57
|
+
);
|
|
58
|
+
const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
|
|
59
|
+
const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
|
|
60
|
+
const themeFontsSlugs = new Set(themeFonts.map((f) => f.slug));
|
|
61
|
+
const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(
|
|
62
|
+
baseFontFamilies.theme.filter((f) => !themeFontsSlugs.has(f.slug)).map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name))
|
|
63
|
+
) : [];
|
|
64
|
+
const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id;
|
|
65
|
+
const canUserDelete = useSelect(
|
|
66
|
+
(select) => {
|
|
67
|
+
const { canUser } = select(coreStore);
|
|
68
|
+
return customFontFamilyId && canUser("delete", {
|
|
69
|
+
kind: "postType",
|
|
70
|
+
name: "wp_font_family",
|
|
71
|
+
id: customFontFamilyId
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
[customFontFamilyId]
|
|
75
|
+
);
|
|
76
|
+
const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete;
|
|
77
|
+
const handleUninstallClick = () => {
|
|
78
|
+
setIsConfirmDeleteOpen(true);
|
|
79
|
+
};
|
|
80
|
+
const handleUpdate = async () => {
|
|
81
|
+
setNotice(null);
|
|
82
|
+
try {
|
|
83
|
+
await saveFontFamilies(fontFamilies);
|
|
84
|
+
setNotice({
|
|
85
|
+
type: "success",
|
|
86
|
+
message: __("Font family updated successfully.")
|
|
87
|
+
});
|
|
88
|
+
} catch (error) {
|
|
89
|
+
setNotice({
|
|
90
|
+
type: "error",
|
|
91
|
+
message: sprintf(
|
|
92
|
+
/* translators: %s: error message */
|
|
93
|
+
__("There was an error updating the font family. %s"),
|
|
94
|
+
error.message
|
|
95
|
+
)
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const getFontFacesToDisplay = (font) => {
|
|
100
|
+
if (!font) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
if (!font.fontFace || !font.fontFace.length) {
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
fontFamily: font.fontFamily,
|
|
107
|
+
fontStyle: "normal",
|
|
108
|
+
fontWeight: "400"
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
return sortFontFaces(font.fontFace);
|
|
113
|
+
};
|
|
114
|
+
const getFontCardVariantsText = (font) => {
|
|
115
|
+
const variantsInstalled = font?.fontFace && (font?.fontFace?.length ?? 0) > 0 ? font.fontFace.length : 1;
|
|
116
|
+
const variantsActive = getFontFacesActivated(
|
|
117
|
+
font.slug,
|
|
118
|
+
font.source
|
|
119
|
+
).length;
|
|
120
|
+
return sprintf(
|
|
121
|
+
/* translators: 1: Active font variants, 2: Total font variants. */
|
|
122
|
+
__("%1$d/%2$d variants active"),
|
|
123
|
+
variantsActive,
|
|
124
|
+
variantsInstalled
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
handleSetLibraryFontSelected(libraryFontSelected);
|
|
129
|
+
refreshLibrary();
|
|
130
|
+
}, []);
|
|
131
|
+
const activeFontsCount = libraryFontSelected ? getFontFacesActivated(
|
|
132
|
+
libraryFontSelected.slug,
|
|
133
|
+
libraryFontSelected.source
|
|
134
|
+
).length : 0;
|
|
135
|
+
const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0);
|
|
136
|
+
const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount;
|
|
137
|
+
const isSelectAllChecked = activeFontsCount === selectedFontsCount;
|
|
138
|
+
const toggleSelectAll = () => {
|
|
139
|
+
if (!libraryFontSelected || !libraryFontSelected?.source) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter(
|
|
143
|
+
(f) => f.slug !== libraryFontSelected.slug
|
|
144
|
+
) ?? [];
|
|
145
|
+
const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected];
|
|
146
|
+
setFontFamilies({
|
|
147
|
+
...fontFamilies,
|
|
148
|
+
[libraryFontSelected.source]: newFonts
|
|
149
|
+
});
|
|
150
|
+
if (libraryFontSelected.fontFace) {
|
|
151
|
+
libraryFontSelected.fontFace.forEach((face) => {
|
|
152
|
+
if (isSelectAllChecked) {
|
|
153
|
+
unloadFontFaceInBrowser(face, "all");
|
|
154
|
+
} else {
|
|
155
|
+
const displaySrc = getDisplaySrcFromFontFace(
|
|
156
|
+
face?.src ?? ""
|
|
157
|
+
);
|
|
158
|
+
if (displaySrc) {
|
|
159
|
+
loadFontFaceInBrowser(face, displaySrc, "all");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0;
|
|
166
|
+
return /* @__PURE__ */ jsxs("div", { className: "font-library-modal__tabpanel-layout", children: [
|
|
167
|
+
isResolvingLibrary && /* @__PURE__ */ jsx("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ jsx(ProgressBar, {}) }),
|
|
168
|
+
!isResolvingLibrary && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
169
|
+
/* @__PURE__ */ jsxs(
|
|
170
|
+
Navigator,
|
|
171
|
+
{
|
|
172
|
+
initialPath: libraryFontSelected ? "/fontFamily" : "/",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsx(Navigator.Screen, { path: "/", children: /* @__PURE__ */ jsxs(VStack, { spacing: "8", children: [
|
|
175
|
+
notice && /* @__PURE__ */ jsx(
|
|
176
|
+
Notice,
|
|
177
|
+
{
|
|
178
|
+
status: notice.type,
|
|
179
|
+
onRemove: () => setNotice(null),
|
|
180
|
+
children: notice.message
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
!hasFonts && /* @__PURE__ */ jsx(Text, { as: "p", children: __("No fonts installed.") }),
|
|
184
|
+
baseThemeFonts.length > 0 && /* @__PURE__ */ jsxs(VStack, { children: [
|
|
185
|
+
/* @__PURE__ */ jsx("h2", {
|
|
186
|
+
className: "font-library-modal__fonts-title",
|
|
187
|
+
/* translators: Heading for a list of fonts provided by the theme. */
|
|
188
|
+
children: _x("Theme", "font source")
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
"ul",
|
|
192
|
+
{
|
|
193
|
+
role: "list",
|
|
194
|
+
className: "font-library-modal__fonts-list",
|
|
195
|
+
children: baseThemeFonts.map((font) => /* @__PURE__ */ jsx(
|
|
196
|
+
"li",
|
|
197
|
+
{
|
|
198
|
+
className: "font-library-modal__fonts-list-item",
|
|
199
|
+
children: /* @__PURE__ */ jsx(
|
|
200
|
+
FontCard,
|
|
201
|
+
{
|
|
202
|
+
font,
|
|
203
|
+
navigatorPath: "/fontFamily",
|
|
204
|
+
variantsText: getFontCardVariantsText(
|
|
205
|
+
font
|
|
206
|
+
),
|
|
207
|
+
onClick: () => {
|
|
208
|
+
setNotice(null);
|
|
209
|
+
handleSetLibraryFontSelected(
|
|
210
|
+
font
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
},
|
|
216
|
+
font.slug
|
|
217
|
+
))
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] }),
|
|
221
|
+
baseCustomFonts.length > 0 && /* @__PURE__ */ jsxs(VStack, { children: [
|
|
222
|
+
/* @__PURE__ */ jsx("h2", {
|
|
223
|
+
className: "font-library-modal__fonts-title",
|
|
224
|
+
/* translators: Heading for a list of fonts installed by the user. */
|
|
225
|
+
children: _x("Custom", "font source")
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
"ul",
|
|
229
|
+
{
|
|
230
|
+
role: "list",
|
|
231
|
+
className: "font-library-modal__fonts-list",
|
|
232
|
+
children: baseCustomFonts.map((font) => /* @__PURE__ */ jsx(
|
|
233
|
+
"li",
|
|
234
|
+
{
|
|
235
|
+
className: "font-library-modal__fonts-list-item",
|
|
236
|
+
children: /* @__PURE__ */ jsx(
|
|
237
|
+
FontCard,
|
|
238
|
+
{
|
|
239
|
+
font,
|
|
240
|
+
navigatorPath: "/fontFamily",
|
|
241
|
+
variantsText: getFontCardVariantsText(
|
|
242
|
+
font
|
|
243
|
+
),
|
|
244
|
+
onClick: () => {
|
|
245
|
+
setNotice(null);
|
|
246
|
+
handleSetLibraryFontSelected(
|
|
247
|
+
font
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
font.slug
|
|
254
|
+
))
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] })
|
|
258
|
+
] }) }),
|
|
259
|
+
/* @__PURE__ */ jsxs(Navigator.Screen, { path: "/fontFamily", children: [
|
|
260
|
+
libraryFontSelected && /* @__PURE__ */ jsx(
|
|
261
|
+
ConfirmDeleteDialog,
|
|
262
|
+
{
|
|
263
|
+
font: libraryFontSelected,
|
|
264
|
+
isOpen: isConfirmDeleteOpen,
|
|
265
|
+
setIsOpen: setIsConfirmDeleteOpen,
|
|
266
|
+
setNotice,
|
|
267
|
+
uninstallFontFamily,
|
|
268
|
+
handleSetLibraryFontSelected
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "flex-start", children: [
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
Navigator.BackButton,
|
|
274
|
+
{
|
|
275
|
+
icon: isRTL() ? chevronRight : chevronLeft,
|
|
276
|
+
size: "small",
|
|
277
|
+
onClick: () => {
|
|
278
|
+
handleSetLibraryFontSelected(
|
|
279
|
+
void 0
|
|
280
|
+
);
|
|
281
|
+
setNotice(null);
|
|
282
|
+
},
|
|
283
|
+
label: __("Back")
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
Heading,
|
|
288
|
+
{
|
|
289
|
+
level: 2,
|
|
290
|
+
size: 13,
|
|
291
|
+
className: "global-styles-ui-header",
|
|
292
|
+
children: libraryFontSelected?.name
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
] }),
|
|
296
|
+
notice && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
297
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 1 }),
|
|
298
|
+
/* @__PURE__ */ jsx(
|
|
299
|
+
Notice,
|
|
300
|
+
{
|
|
301
|
+
status: notice.type,
|
|
302
|
+
onRemove: () => setNotice(null),
|
|
303
|
+
children: notice.message
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 1 })
|
|
307
|
+
] }),
|
|
308
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 4 }),
|
|
309
|
+
/* @__PURE__ */ jsx(Text, { children: __(
|
|
310
|
+
"Choose font variants. Keep in mind that too many variants could make your site slower."
|
|
311
|
+
) }),
|
|
312
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 4 }),
|
|
313
|
+
/* @__PURE__ */ jsxs(VStack, { spacing: 0, children: [
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
CheckboxControl,
|
|
316
|
+
{
|
|
317
|
+
className: "font-library-modal__select-all",
|
|
318
|
+
label: __("Select all"),
|
|
319
|
+
checked: isSelectAllChecked,
|
|
320
|
+
onChange: toggleSelectAll,
|
|
321
|
+
indeterminate: isIndeterminate,
|
|
322
|
+
__nextHasNoMarginBottom: true
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ jsx(Spacer, { margin: 8 }),
|
|
326
|
+
/* @__PURE__ */ jsx(
|
|
327
|
+
"ul",
|
|
328
|
+
{
|
|
329
|
+
role: "list",
|
|
330
|
+
className: "font-library-modal__fonts-list",
|
|
331
|
+
children: libraryFontSelected && getFontFacesToDisplay(
|
|
332
|
+
libraryFontSelected
|
|
333
|
+
).map((face, i) => /* @__PURE__ */ jsx(
|
|
334
|
+
"li",
|
|
335
|
+
{
|
|
336
|
+
className: "font-library-modal__fonts-list-item",
|
|
337
|
+
children: /* @__PURE__ */ jsx(
|
|
338
|
+
LibraryFontVariant,
|
|
339
|
+
{
|
|
340
|
+
font: libraryFontSelected,
|
|
341
|
+
face
|
|
342
|
+
},
|
|
343
|
+
`face${i}`
|
|
344
|
+
)
|
|
345
|
+
},
|
|
346
|
+
`face${i}`
|
|
347
|
+
))
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
] })
|
|
351
|
+
] })
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsxs(
|
|
356
|
+
HStack,
|
|
357
|
+
{
|
|
358
|
+
justify: "flex-end",
|
|
359
|
+
className: "font-library-modal__footer",
|
|
360
|
+
children: [
|
|
361
|
+
isInstalling && /* @__PURE__ */ jsx(ProgressBar, {}),
|
|
362
|
+
shouldDisplayDeleteButton && /* @__PURE__ */ jsx(
|
|
363
|
+
Button,
|
|
364
|
+
{
|
|
365
|
+
__next40pxDefaultSize: true,
|
|
366
|
+
isDestructive: true,
|
|
367
|
+
variant: "tertiary",
|
|
368
|
+
onClick: handleUninstallClick,
|
|
369
|
+
children: __("Delete")
|
|
370
|
+
}
|
|
371
|
+
),
|
|
372
|
+
/* @__PURE__ */ jsx(
|
|
373
|
+
Button,
|
|
374
|
+
{
|
|
375
|
+
__next40pxDefaultSize: true,
|
|
376
|
+
variant: "primary",
|
|
377
|
+
onClick: handleUpdate,
|
|
378
|
+
disabled: !fontFamiliesHasChanges,
|
|
379
|
+
accessibleWhenDisabled: true,
|
|
380
|
+
children: __("Update")
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
] })
|
|
387
|
+
] });
|
|
388
|
+
}
|
|
389
|
+
function ConfirmDeleteDialog({
|
|
390
|
+
font,
|
|
391
|
+
isOpen,
|
|
392
|
+
setIsOpen,
|
|
393
|
+
setNotice,
|
|
394
|
+
uninstallFontFamily,
|
|
395
|
+
handleSetLibraryFontSelected
|
|
396
|
+
}) {
|
|
397
|
+
const navigator = useNavigator();
|
|
398
|
+
const handleConfirmUninstall = async () => {
|
|
399
|
+
setNotice(null);
|
|
400
|
+
setIsOpen(false);
|
|
401
|
+
try {
|
|
402
|
+
await uninstallFontFamily(font);
|
|
403
|
+
navigator.goBack();
|
|
404
|
+
handleSetLibraryFontSelected(void 0);
|
|
405
|
+
setNotice({
|
|
406
|
+
type: "success",
|
|
407
|
+
message: __("Font family uninstalled successfully.")
|
|
408
|
+
});
|
|
409
|
+
} catch (error) {
|
|
410
|
+
setNotice({
|
|
411
|
+
type: "error",
|
|
412
|
+
message: __("There was an error uninstalling the font family.") + error.message
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
const handleCancelUninstall = () => {
|
|
417
|
+
setIsOpen(false);
|
|
418
|
+
};
|
|
419
|
+
return /* @__PURE__ */ jsx(
|
|
420
|
+
ConfirmDialog,
|
|
421
|
+
{
|
|
422
|
+
isOpen,
|
|
423
|
+
cancelButtonText: __("Cancel"),
|
|
424
|
+
confirmButtonText: __("Delete"),
|
|
425
|
+
onCancel: handleCancelUninstall,
|
|
426
|
+
onConfirm: handleConfirmUninstall,
|
|
427
|
+
size: "medium",
|
|
428
|
+
children: font && sprintf(
|
|
429
|
+
/* translators: %s: Name of the font. */
|
|
430
|
+
__(
|
|
431
|
+
'Are you sure you want to delete "%s" font and all its variants and assets?'
|
|
432
|
+
),
|
|
433
|
+
font.name
|
|
434
|
+
)
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
var installed_fonts_default = InstalledFonts;
|
|
439
|
+
export {
|
|
440
|
+
installed_fonts_default as default
|
|
441
|
+
};
|
|
442
|
+
//# sourceMappingURL=installed-fonts.js.map
|