@wordpress/edit-site 6.32.0 → 6.32.1-next.b8c8708f3.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/build/components/add-new-pattern/index.js +153 -141
- package/build/components/add-new-pattern/index.js.map +7 -1
- package/build/components/add-new-post/index.js +114 -89
- package/build/components/add-new-post/index.js.map +7 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +80 -60
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +7 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +284 -207
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +7 -1
- package/build/components/add-new-template/index.js +309 -248
- package/build/components/add-new-template/index.js.map +7 -1
- package/build/components/add-new-template/utils.js +459 -446
- package/build/components/add-new-template/utils.js.map +7 -1
- package/build/components/app/index.js +72 -63
- package/build/components/app/index.js.map +7 -1
- package/build/components/block-editor/use-editor-iframe-props.js +63 -66
- package/build/components/block-editor/use-editor-iframe-props.js.map +7 -1
- package/build/components/block-editor/use-navigate-to-entity-record.js +34 -22
- package/build/components/block-editor/use-navigate-to-entity-record.js.map +7 -1
- package/build/components/block-editor/use-site-editor-settings.js +64 -51
- package/build/components/block-editor/use-site-editor-settings.js.map +7 -1
- package/build/components/canvas-loader/index.js +41 -56
- package/build/components/canvas-loader/index.js.map +7 -1
- package/build/components/dataviews-actions/index.js +96 -83
- package/build/components/dataviews-actions/index.js.map +7 -1
- package/build/components/editor/index.js +288 -235
- package/build/components/editor/index.js.map +7 -1
- package/build/components/editor/site-preview.js +55 -42
- package/build/components/editor/site-preview.js.map +7 -1
- package/build/components/editor/use-adapt-editor-to-canvas.js +49 -31
- package/build/components/editor/use-adapt-editor-to-canvas.js.map +7 -1
- package/build/components/editor/use-editor-title.js +79 -61
- package/build/components/editor/use-editor-title.js.map +7 -1
- package/build/components/editor/use-resolve-edited-entity.js +112 -140
- package/build/components/editor/use-resolve-edited-entity.js.map +7 -1
- package/build/components/editor-canvas-container/index.js +101 -91
- package/build/components/editor-canvas-container/index.js.map +7 -1
- package/build/components/global-styles/background-panel.js +46 -39
- package/build/components/global-styles/background-panel.js.map +7 -1
- package/build/components/global-styles/block-preview-panel.js +58 -52
- package/build/components/global-styles/block-preview-panel.js.map +7 -1
- package/build/components/global-styles/color-indicator-wrapper.js +47 -26
- package/build/components/global-styles/color-indicator-wrapper.js.map +7 -1
- package/build/components/global-styles/color-palette-panel.js +130 -81
- package/build/components/global-styles/color-palette-panel.js.map +7 -1
- package/build/components/global-styles/confirm-reset-shadow-dialog.js +38 -22
- package/build/components/global-styles/confirm-reset-shadow-dialog.js.map +7 -1
- package/build/components/global-styles/dimensions-panel.js +46 -41
- package/build/components/global-styles/dimensions-panel.js.map +7 -1
- package/build/components/global-styles/font-families.js +106 -102
- package/build/components/global-styles/font-families.js.map +7 -1
- package/build/components/global-styles/font-family-item.js +41 -43
- package/build/components/global-styles/font-family-item.js.map +7 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +55 -39
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +7 -1
- package/build/components/global-styles/font-library-modal/context.js +228 -243
- package/build/components/global-styles/font-library-modal/context.js.map +7 -1
- package/build/components/global-styles/font-library-modal/font-card.js +70 -59
- package/build/components/global-styles/font-library-modal/font-card.js.map +7 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +407 -321
- package/build/components/global-styles/font-library-modal/font-collection.js.map +7 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +54 -50
- package/build/components/global-styles/font-library-modal/font-demo.js.map +7 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +52 -44
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +7 -1
- package/build/components/global-styles/font-library-modal/index.js +90 -87
- package/build/components/global-styles/font-library-modal/index.js.map +7 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +369 -255
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +7 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js +60 -42
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +7 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +64 -49
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +7 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +64 -31
- package/build/components/global-styles/font-library-modal/resolvers.js.map +7 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +133 -145
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/constants.js +45 -24
- package/build/components/global-styles/font-library-modal/utils/constants.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +30 -27
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js +41 -13
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +127 -161
- package/build/components/global-styles/font-library-modal/utils/index.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +25 -18
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +55 -74
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +32 -16
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +7 -1
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js +43 -72
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js.map +7 -1
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +44 -23
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +7 -1
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +38 -22
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -1
- package/build/components/global-styles/font-sizes/font-size-preview.js +42 -35
- package/build/components/global-styles/font-sizes/font-size-preview.js.map +7 -1
- package/build/components/global-styles/font-sizes/font-size.js +207 -170
- package/build/components/global-styles/font-sizes/font-size.js.map +7 -1
- package/build/components/global-styles/font-sizes/font-sizes-count.js +46 -45
- package/build/components/global-styles/font-sizes/font-sizes-count.js.map +7 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +199 -136
- package/build/components/global-styles/font-sizes/font-sizes.js.map +7 -1
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js +81 -58
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js.map +7 -1
- package/build/components/global-styles/gradients-palette-panel.js +140 -85
- package/build/components/global-styles/gradients-palette-panel.js.map +7 -1
- package/build/components/global-styles/header.js +51 -48
- package/build/components/global-styles/header.js.map +7 -1
- package/build/components/global-styles/highlighted-colors.js +48 -40
- package/build/components/global-styles/highlighted-colors.js.map +7 -1
- package/build/components/global-styles/hooks.js +89 -68
- package/build/components/global-styles/hooks.js.map +7 -1
- package/build/components/global-styles/icon-with-current-color.js +50 -25
- package/build/components/global-styles/icon-with-current-color.js.map +7 -1
- package/build/components/global-styles/index.js +36 -11
- package/build/components/global-styles/index.js.map +7 -1
- package/build/components/global-styles/navigation-button.js +41 -42
- package/build/components/global-styles/navigation-button.js.map +7 -1
- package/build/components/global-styles/palette.js +82 -73
- package/build/components/global-styles/palette.js.map +7 -1
- package/build/components/global-styles/preset-colors.js +36 -24
- package/build/components/global-styles/preset-colors.js.map +7 -1
- package/build/components/global-styles/preview-colors.js +68 -46
- package/build/components/global-styles/preview-colors.js.map +7 -1
- package/build/components/global-styles/preview-styles.js +182 -136
- package/build/components/global-styles/preview-styles.js.map +7 -1
- package/build/components/global-styles/preview-typography.js +65 -44
- package/build/components/global-styles/preview-typography.js.map +7 -1
- package/build/components/global-styles/preview-wrapper.js +70 -85
- package/build/components/global-styles/preview-wrapper.js.map +7 -1
- package/build/components/global-styles/root-menu.js +53 -52
- package/build/components/global-styles/root-menu.js.map +7 -1
- package/build/components/global-styles/screen-background.js +54 -35
- package/build/components/global-styles/screen-background.js.map +7 -1
- package/build/components/global-styles/screen-block-list.js +129 -118
- package/build/components/global-styles/screen-block-list.js.map +7 -1
- package/build/components/global-styles/screen-block.js +185 -182
- package/build/components/global-styles/screen-block.js.map +7 -1
- package/build/components/global-styles/screen-color-palette.js +61 -56
- package/build/components/global-styles/screen-color-palette.js.map +7 -1
- package/build/components/global-styles/screen-colors.js +64 -40
- package/build/components/global-styles/screen-colors.js.map +7 -1
- package/build/components/global-styles/screen-css.js +80 -50
- package/build/components/global-styles/screen-css.js.map +7 -1
- package/build/components/global-styles/screen-layout.js +45 -32
- package/build/components/global-styles/screen-layout.js.map +7 -1
- package/build/components/global-styles/screen-revisions/index.js +144 -116
- package/build/components/global-styles/screen-revisions/index.js.map +7 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +165 -166
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +7 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +93 -81
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +7 -1
- package/build/components/global-styles/screen-root.js +93 -84
- package/build/components/global-styles/screen-root.js.map +7 -1
- package/build/components/global-styles/screen-shadows.js +43 -16
- package/build/components/global-styles/screen-shadows.js.map +7 -1
- package/build/components/global-styles/screen-style-variations.js +64 -44
- package/build/components/global-styles/screen-style-variations.js.map +7 -1
- package/build/components/global-styles/screen-typography-element.js +146 -93
- package/build/components/global-styles/screen-typography-element.js.map +7 -1
- package/build/components/global-styles/screen-typography.js +64 -40
- package/build/components/global-styles/screen-typography.js.map +7 -1
- package/build/components/global-styles/shadow-utils.js +75 -180
- package/build/components/global-styles/shadow-utils.js.map +7 -1
- package/build/components/global-styles/shadows-edit-panel.js +433 -358
- package/build/components/global-styles/shadows-edit-panel.js.map +7 -1
- package/build/components/global-styles/shadows-panel.js +178 -131
- package/build/components/global-styles/shadows-panel.js.map +7 -1
- package/build/components/global-styles/size-control/index.js +66 -76
- package/build/components/global-styles/size-control/index.js.map +7 -1
- package/build/components/global-styles/style-variations-container.js +114 -102
- package/build/components/global-styles/style-variations-container.js.map +7 -1
- package/build/components/global-styles/subtitle.js +34 -21
- package/build/components/global-styles/subtitle.js.map +7 -1
- package/build/components/global-styles/typeset.js +73 -75
- package/build/components/global-styles/typeset.js.map +7 -1
- package/build/components/global-styles/typography-elements.js +109 -86
- package/build/components/global-styles/typography-elements.js.map +7 -1
- package/build/components/global-styles/typography-example.js +66 -65
- package/build/components/global-styles/typography-example.js.map +7 -1
- package/build/components/global-styles/typography-panel.js +57 -39
- package/build/components/global-styles/typography-panel.js.map +7 -1
- package/build/components/global-styles/typography-preview.js +73 -53
- package/build/components/global-styles/typography-preview.js.map +7 -1
- package/build/components/global-styles/ui.js +282 -314
- package/build/components/global-styles/ui.js.map +7 -1
- package/build/components/global-styles/utils.js +45 -31
- package/build/components/global-styles/utils.js.map +7 -1
- package/build/components/global-styles/variations/variation.js +90 -74
- package/build/components/global-styles/variations/variation.js.map +7 -1
- package/build/components/global-styles/variations/variations-color.js +52 -41
- package/build/components/global-styles/variations/variations-color.js.map +7 -1
- package/build/components/global-styles/variations/variations-panel.js +61 -51
- package/build/components/global-styles/variations/variations-panel.js.map +7 -1
- package/build/components/global-styles/variations/variations-typography.js +69 -49
- package/build/components/global-styles/variations/variations-typography.js.map +7 -1
- package/build/components/global-styles-renderer/index.js +39 -33
- package/build/components/global-styles-renderer/index.js.map +7 -1
- package/build/components/global-styles-sidebar/default-sidebar.js +53 -40
- package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -1
- package/build/components/global-styles-sidebar/index.js +164 -141
- package/build/components/global-styles-sidebar/index.js.map +7 -1
- package/build/components/layout/animation.js +53 -78
- package/build/components/layout/animation.js.map +7 -1
- package/build/components/layout/hooks.js +40 -35
- package/build/components/layout/hooks.js.map +7 -1
- package/build/components/layout/index.js +220 -199
- package/build/components/layout/index.js.map +7 -1
- package/build/components/media/index.js +31 -26
- package/build/components/media/index.js.map +7 -1
- package/build/components/more-menu/index.js +45 -28
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/more-menu/site-export.js +69 -44
- package/build/components/more-menu/site-export.js.map +7 -1
- package/build/components/more-menu/welcome-guide-menu-item.js +29 -21
- package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build/components/page-patterns/actions.js +82 -0
- package/build/components/page-patterns/actions.js.map +7 -0
- package/build/components/page-patterns/delete-category-menu-item.js +94 -82
- package/build/components/page-patterns/delete-category-menu-item.js.map +7 -1
- package/build/components/page-patterns/fields.js +135 -123
- package/build/components/page-patterns/fields.js.map +7 -1
- package/build/components/page-patterns/index.js +182 -148
- package/build/components/page-patterns/index.js.map +7 -1
- package/build/components/page-patterns/rename-category-menu-item.js +67 -62
- package/build/components/page-patterns/rename-category-menu-item.js.map +7 -1
- package/build/components/page-patterns/search-items.js +65 -89
- package/build/components/page-patterns/search-items.js.map +7 -1
- package/build/components/page-patterns/use-pattern-settings.js +45 -35
- package/build/components/page-patterns/use-pattern-settings.js.map +7 -1
- package/build/components/page-patterns/use-patterns.js +266 -200
- package/build/components/page-patterns/use-patterns.js.map +7 -1
- package/build/components/page-patterns/utils.js +27 -7
- package/build/components/page-patterns/utils.js.map +7 -1
- package/build/components/page-templates/fields.js +165 -159
- package/build/components/page-templates/fields.js.map +7 -1
- package/build/components/page-templates/hooks.js +66 -64
- package/build/components/page-templates/hooks.js.map +7 -1
- package/build/components/page-templates/index.js +211 -207
- package/build/components/page-templates/index.js.map +7 -1
- package/build/components/page-templates/view-utils.js +67 -0
- package/build/components/page-templates/view-utils.js.map +7 -0
- package/build/components/pagination/index.js +119 -82
- package/build/components/pagination/index.js.map +7 -1
- package/build/components/plugin-template-setting-panel/index.js +49 -56
- package/build/components/plugin-template-setting-panel/index.js.map +7 -1
- package/build/components/post-edit/index.js +171 -149
- package/build/components/post-edit/index.js.map +7 -1
- package/build/components/post-list/index.js +230 -301
- package/build/components/post-list/index.js.map +7 -1
- package/build/components/post-list/view-utils.js +167 -0
- package/build/components/post-list/view-utils.js.map +7 -0
- package/build/components/posts-app/index.js +44 -32
- package/build/components/posts-app/index.js.map +7 -1
- package/build/components/posts-app-routes/index.js +36 -25
- package/build/components/posts-app-routes/index.js.map +7 -1
- package/build/components/posts-app-routes/post-item.js +54 -35
- package/build/components/posts-app-routes/post-item.js.map +7 -1
- package/build/components/posts-app-routes/posts.js +91 -76
- package/build/components/posts-app-routes/posts.js.map +7 -1
- package/build/components/resizable-frame/index.js +200 -224
- package/build/components/resizable-frame/index.js.map +7 -1
- package/build/components/revisions/index.js +102 -71
- package/build/components/revisions/index.js.map +7 -1
- package/build/components/routes/use-title.js +45 -35
- package/build/components/routes/use-title.js.map +7 -1
- package/build/components/save-button/index.js +113 -111
- package/build/components/save-button/index.js.map +7 -1
- package/build/components/save-hub/index.js +52 -40
- package/build/components/save-hub/index.js.map +7 -1
- package/build/components/save-keyboard-shortcut/index.js +46 -52
- package/build/components/save-keyboard-shortcut/index.js.map +7 -1
- package/build/components/save-panel/index.js +155 -136
- package/build/components/save-panel/index.js.map +7 -1
- package/build/components/sidebar/index.js +81 -79
- package/build/components/sidebar/index.js.map +7 -1
- package/build/components/sidebar-button/index.js +43 -22
- package/build/components/sidebar-button/index.js.map +7 -1
- package/build/components/sidebar-dataviews/dataview-item.js +68 -55
- package/build/components/sidebar-dataviews/dataview-item.js.map +7 -1
- package/build/components/sidebar-dataviews/index.js +68 -54
- package/build/components/sidebar-dataviews/index.js.map +7 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +125 -111
- package/build/components/sidebar-global-styles-wrapper/index.js.map +7 -1
- package/build/components/sidebar-navigation-item/index.js +79 -62
- package/build/components/sidebar-navigation-item/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen/index.js +129 -104
- package/build/components/sidebar-navigation-screen/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +63 -53
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +50 -33
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +7 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +94 -81
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-main/index.js +141 -90
- package/build/components/sidebar-navigation-screen-main/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +40 -29
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +124 -91
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +116 -83
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +57 -48
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +80 -66
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +64 -38
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +125 -96
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +33 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +30 -16
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +119 -105
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +130 -121
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +7 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +106 -88
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +44 -21
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +129 -106
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +36 -25
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +81 -70
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +42 -32
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +7 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +41 -28
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +7 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +95 -76
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +7 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +48 -27
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +7 -1
- package/build/components/sidebar-navigation-screen-unsupported/index.js +28 -20
- package/build/components/sidebar-navigation-screen-unsupported/index.js.map +7 -1
- package/build/components/site-editor-routes/home.js +50 -32
- package/build/components/site-editor-routes/home.js.map +7 -1
- package/build/components/site-editor-routes/index.js +62 -36
- package/build/components/site-editor-routes/index.js.map +7 -1
- package/build/components/site-editor-routes/navigation-item.js +55 -49
- package/build/components/site-editor-routes/navigation-item.js.map +7 -1
- package/build/components/site-editor-routes/navigation.js +55 -49
- package/build/components/site-editor-routes/navigation.js.map +7 -1
- package/build/components/site-editor-routes/notfound.js +54 -34
- package/build/components/site-editor-routes/notfound.js.map +7 -1
- package/build/components/site-editor-routes/page-item.js +58 -41
- package/build/components/site-editor-routes/page-item.js.map +7 -1
- package/build/components/site-editor-routes/pages.js +96 -86
- package/build/components/site-editor-routes/pages.js.map +7 -1
- package/build/components/site-editor-routes/pattern-item.js +48 -26
- package/build/components/site-editor-routes/pattern-item.js.map +7 -1
- package/build/components/site-editor-routes/patterns.js +51 -36
- package/build/components/site-editor-routes/patterns.js.map +7 -1
- package/build/components/site-editor-routes/stylebook.js +60 -43
- package/build/components/site-editor-routes/stylebook.js.map +7 -1
- package/build/components/site-editor-routes/styles.js +58 -46
- package/build/components/site-editor-routes/styles.js.map +7 -1
- package/build/components/site-editor-routes/template-item.js +54 -34
- package/build/components/site-editor-routes/template-item.js.map +7 -1
- package/build/components/site-editor-routes/template-part-item.js +45 -21
- package/build/components/site-editor-routes/template-part-item.js.map +7 -1
- package/build/components/site-editor-routes/templates.js +69 -44
- package/build/components/site-editor-routes/templates.js.map +7 -1
- package/build/components/site-editor-routes/utils.js +27 -13
- package/build/components/site-editor-routes/utils.js.map +7 -1
- package/build/components/site-hub/index.js +233 -222
- package/build/components/site-hub/index.js.map +7 -1
- package/build/components/site-icon/index.js +61 -49
- package/build/components/site-icon/index.js.map +7 -1
- package/build/components/style-book/categories.js +61 -52
- package/build/components/style-book/categories.js.map +7 -1
- package/build/components/style-book/color-examples.js +54 -40
- package/build/components/style-book/color-examples.js.map +7 -1
- package/build/components/style-book/constants.js +218 -144
- package/build/components/style-book/constants.js.map +7 -1
- package/build/components/style-book/duotone-examples.js +54 -40
- package/build/components/style-book/duotone-examples.js.map +7 -1
- package/build/components/style-book/examples.js +145 -120
- package/build/components/style-book/examples.js.map +7 -1
- package/build/components/style-book/index.js +454 -409
- package/build/components/style-book/index.js.map +7 -1
- package/build/components/style-book/types.js +16 -5
- package/build/components/style-book/types.js.map +7 -1
- package/build/components/welcome-guide/editor.js +87 -60
- package/build/components/welcome-guide/editor.js.map +7 -1
- package/build/components/welcome-guide/image.js +34 -22
- package/build/components/welcome-guide/image.js.map +7 -1
- package/build/components/welcome-guide/index.js +44 -21
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/components/welcome-guide/page.js +76 -52
- package/build/components/welcome-guide/page.js.map +7 -1
- package/build/components/welcome-guide/styles.js +135 -102
- package/build/components/welcome-guide/styles.js.map +7 -1
- package/build/components/welcome-guide/template.js +71 -59
- package/build/components/welcome-guide/template.js.map +7 -1
- package/build/deprecated.js +56 -46
- package/build/deprecated.js.map +7 -1
- package/build/hooks/commands/use-common-commands.js +117 -119
- package/build/hooks/commands/use-common-commands.js.map +7 -1
- package/build/hooks/commands/use-set-command-context.js +40 -50
- package/build/hooks/commands/use-set-command-context.js.map +7 -1
- package/build/hooks/index.js +2 -3
- package/build/hooks/index.js.map +7 -1
- package/build/hooks/push-changes-to-global-styles/index.js +236 -251
- package/build/hooks/push-changes-to-global-styles/index.js.map +7 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +78 -111
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +7 -1
- package/build/index.js +87 -112
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -14
- package/build/lock-unlock.js.map +7 -1
- package/build/posts.js +67 -63
- package/build/posts.js.map +7 -1
- package/build/store/actions.js +199 -365
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -11
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +52 -30
- package/build/store/index.js.map +7 -1
- package/build/store/private-actions.js +34 -19
- package/build/store/private-actions.js.map +7 -1
- package/build/store/private-selectors.js +28 -13
- package/build/store/private-selectors.js.map +7 -1
- package/build/store/reducer.js +42 -57
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +205 -301
- package/build/store/selectors.js.map +7 -1
- package/build/utils/constants.js +94 -53
- package/build/utils/constants.js.map +7 -1
- package/build/utils/get-filtered-template-parts.js +36 -42
- package/build/utils/get-filtered-template-parts.js.map +7 -1
- package/build/utils/is-previewing-theme.js +31 -13
- package/build/utils/is-previewing-theme.js.map +7 -1
- package/build/utils/is-template-removable.js +24 -17
- package/build/utils/is-template-removable.js.map +7 -1
- package/build/utils/is-template-revertable.js +24 -19
- package/build/utils/is-template-revertable.js.map +7 -1
- package/build/utils/set-nested-value.js +24 -25
- package/build/utils/set-nested-value.js.map +7 -1
- package/build/utils/template-part-create.js +1 -1
- package/build/utils/template-part-create.js.map +7 -1
- package/build/utils/use-activate-theme.js +40 -45
- package/build/utils/use-activate-theme.js.map +7 -1
- package/build/utils/use-actual-current-theme.js +47 -25
- package/build/utils/use-actual-current-theme.js.map +7 -1
- package/build-module/components/add-new-pattern/index.js +133 -127
- package/build-module/components/add-new-pattern/index.js.map +7 -1
- package/build-module/components/add-new-post/index.js +100 -82
- package/build-module/components/add-new-post/index.js.map +7 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +63 -51
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +7 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +269 -196
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +7 -1
- package/build-module/components/add-new-template/index.js +289 -219
- package/build-module/components/add-new-template/index.js.map +7 -1
- package/build-module/components/add-new-template/utils.js +430 -432
- package/build-module/components/add-new-template/utils.js.map +7 -1
- package/build-module/components/app/index.js +41 -51
- package/build-module/components/app/index.js.map +7 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +33 -58
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +7 -1
- package/build-module/components/block-editor/use-navigate-to-entity-record.js +17 -18
- package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +7 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +28 -41
- package/build-module/components/block-editor/use-site-editor-settings.js.map +7 -1
- package/build-module/components/canvas-loader/index.js +25 -50
- package/build-module/components/canvas-loader/index.js.map +7 -1
- package/build-module/components/dataviews-actions/index.js +75 -78
- package/build-module/components/dataviews-actions/index.js.map +7 -1
- package/build-module/components/editor/index.js +261 -220
- package/build-module/components/editor/index.js.map +7 -1
- package/build-module/components/editor/site-preview.js +38 -38
- package/build-module/components/editor/site-preview.js.map +7 -1
- package/build-module/components/editor/use-adapt-editor-to-canvas.js +25 -24
- package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +7 -1
- package/build-module/components/editor/use-editor-title.js +49 -53
- package/build-module/components/editor/use-editor-title.js.map +7 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +89 -129
- package/build-module/components/editor/use-resolve-edited-entity.js.map +7 -1
- package/build-module/components/editor-canvas-container/index.js +79 -80
- package/build-module/components/editor-canvas-container/index.js.map +7 -1
- package/build-module/components/global-styles/background-panel.js +25 -35
- package/build-module/components/global-styles/background-panel.js.map +7 -1
- package/build-module/components/global-styles/block-preview-panel.js +36 -43
- package/build-module/components/global-styles/block-preview-panel.js.map +7 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +19 -20
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +7 -1
- package/build-module/components/global-styles/color-palette-panel.js +105 -74
- package/build-module/components/global-styles/color-palette-panel.js.map +7 -1
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js +20 -17
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js.map +7 -1
- package/build-module/components/global-styles/dimensions-panel.js +26 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +7 -1
- package/build-module/components/global-styles/font-families.js +86 -93
- package/build-module/components/global-styles/font-families.js.map +7 -1
- package/build-module/components/global-styles/font-family-item.js +26 -37
- package/build-module/components/global-styles/font-family-item.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +26 -32
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/context.js +203 -224
- package/build-module/components/global-styles/font-library-modal/context.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +48 -52
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +397 -302
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +32 -38
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +41 -39
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/index.js +65 -81
- package/build-module/components/global-styles/font-library-modal/index.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +354 -243
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/library-font-details.js +35 -36
- package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +35 -42
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +27 -20
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +111 -135
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/constants.js +21 -19
- package/build-module/components/global-styles/font-library-modal/utils/constants.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +13 -24
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js +20 -10
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +102 -154
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +8 -14
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +34 -71
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +11 -13
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +7 -1
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js +22 -69
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +26 -18
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +20 -17
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/font-size-preview.js +26 -29
- package/build-module/components/global-styles/font-sizes/font-size-preview.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +185 -160
- package/build-module/components/global-styles/font-sizes/font-size.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js +23 -39
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/font-sizes.js +184 -128
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +7 -1
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js +68 -52
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js.map +7 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +117 -79
- package/build-module/components/global-styles/gradients-palette-panel.js.map +7 -1
- package/build-module/components/global-styles/header.js +40 -43
- package/build-module/components/global-styles/header.js.map +7 -1
- package/build-module/components/global-styles/highlighted-colors.js +31 -36
- package/build-module/components/global-styles/highlighted-colors.js.map +7 -1
- package/build-module/components/global-styles/hooks.js +56 -61
- package/build-module/components/global-styles/hooks.js.map +7 -1
- package/build-module/components/global-styles/icon-with-current-color.js +18 -19
- package/build-module/components/global-styles/icon-with-current-color.js.map +7 -1
- package/build-module/components/global-styles/index.js +5 -2
- package/build-module/components/global-styles/index.js.map +7 -1
- package/build-module/components/global-styles/navigation-button.js +23 -37
- package/build-module/components/global-styles/navigation-button.js.map +7 -1
- package/build-module/components/global-styles/palette.js +61 -67
- package/build-module/components/global-styles/palette.js.map +7 -1
- package/build-module/components/global-styles/preset-colors.js +19 -20
- package/build-module/components/global-styles/preset-colors.js.map +7 -1
- package/build-module/components/global-styles/preview-colors.js +43 -40
- package/build-module/components/global-styles/preview-colors.js.map +7 -1
- package/build-module/components/global-styles/preview-styles.js +158 -130
- package/build-module/components/global-styles/preview-styles.js.map +7 -1
- package/build-module/components/global-styles/preview-typography.js +37 -38
- package/build-module/components/global-styles/preview-typography.js.map +7 -1
- package/build-module/components/global-styles/preview-wrapper.js +51 -75
- package/build-module/components/global-styles/preview-wrapper.js.map +7 -1
- package/build-module/components/global-styles/root-menu.js +38 -44
- package/build-module/components/global-styles/root-menu.js.map +7 -1
- package/build-module/components/global-styles/screen-background.js +26 -29
- package/build-module/components/global-styles/screen-background.js.map +7 -1
- package/build-module/components/global-styles/screen-block-list.js +105 -105
- package/build-module/components/global-styles/screen-block-list.js.map +7 -1
- package/build-module/components/global-styles/screen-block.js +156 -169
- package/build-module/components/global-styles/screen-block.js.map +7 -1
- package/build-module/components/global-styles/screen-color-palette.js +33 -50
- package/build-module/components/global-styles/screen-color-palette.js.map +7 -1
- package/build-module/components/global-styles/screen-colors.js +35 -33
- package/build-module/components/global-styles/screen-colors.js.map +7 -1
- package/build-module/components/global-styles/screen-css.js +52 -44
- package/build-module/components/global-styles/screen-css.js.map +7 -1
- package/build-module/components/global-styles/screen-layout.js +17 -26
- package/build-module/components/global-styles/screen-layout.js.map +7 -1
- package/build-module/components/global-styles/screen-revisions/index.js +117 -105
- package/build-module/components/global-styles/screen-revisions/index.js.map +7 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +145 -158
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +7 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +74 -75
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +7 -1
- package/build-module/components/global-styles/screen-root.js +74 -77
- package/build-module/components/global-styles/screen-root.js.map +7 -1
- package/build-module/components/global-styles/screen-shadows.js +12 -11
- package/build-module/components/global-styles/screen-shadows.js.map +7 -1
- package/build-module/components/global-styles/screen-style-variations.js +38 -37
- package/build-module/components/global-styles/screen-style-variations.js.map +7 -1
- package/build-module/components/global-styles/screen-typography-element.js +122 -87
- package/build-module/components/global-styles/screen-typography-element.js.map +7 -1
- package/build-module/components/global-styles/screen-typography.js +36 -34
- package/build-module/components/global-styles/screen-typography.js.map +7 -1
- package/build-module/components/global-styles/shadow-utils.js +53 -176
- package/build-module/components/global-styles/shadow-utils.js.map +7 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +426 -344
- package/build-module/components/global-styles/shadows-edit-panel.js.map +7 -1
- package/build-module/components/global-styles/shadows-panel.js +159 -124
- package/build-module/components/global-styles/shadows-panel.js.map +7 -1
- package/build-module/components/global-styles/size-control/index.js +57 -70
- package/build-module/components/global-styles/size-control/index.js.map +7 -1
- package/build-module/components/global-styles/style-variations-container.js +85 -95
- package/build-module/components/global-styles/style-variations-container.js.map +7 -1
- package/build-module/components/global-styles/subtitle.js +16 -16
- package/build-module/components/global-styles/subtitle.js.map +7 -1
- package/build-module/components/global-styles/typeset.js +50 -65
- package/build-module/components/global-styles/typeset.js.map +7 -1
- package/build-module/components/global-styles/typography-elements.js +86 -80
- package/build-module/components/global-styles/typography-elements.js.map +7 -1
- package/build-module/components/global-styles/typography-example.js +45 -57
- package/build-module/components/global-styles/typography-example.js.map +7 -1
- package/build-module/components/global-styles/typography-panel.js +38 -33
- package/build-module/components/global-styles/typography-panel.js.map +7 -1
- package/build-module/components/global-styles/typography-preview.js +55 -48
- package/build-module/components/global-styles/typography-preview.js.map +7 -1
- package/build-module/components/global-styles/ui.js +252 -295
- package/build-module/components/global-styles/ui.js.map +7 -1
- package/build-module/components/global-styles/utils.js +24 -28
- package/build-module/components/global-styles/utils.js.map +7 -1
- package/build-module/components/global-styles/variations/variation.js +59 -65
- package/build-module/components/global-styles/variations/variation.js.map +7 -1
- package/build-module/components/global-styles/variations/variations-color.js +26 -34
- package/build-module/components/global-styles/variations/variations-color.js.map +7 -1
- package/build-module/components/global-styles/variations/variations-panel.js +39 -46
- package/build-module/components/global-styles/variations/variations-panel.js.map +7 -1
- package/build-module/components/global-styles/variations/variations-typography.js +43 -42
- package/build-module/components/global-styles/variations/variations-typography.js.map +7 -1
- package/build-module/components/global-styles-renderer/index.js +16 -27
- package/build-module/components/global-styles-renderer/index.js.map +7 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js +36 -36
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -1
- package/build-module/components/global-styles-sidebar/index.js +137 -133
- package/build-module/components/global-styles-sidebar/index.js.map +7 -1
- package/build-module/components/layout/animation.js +31 -69
- package/build-module/components/layout/animation.js.map +7 -1
- package/build-module/components/layout/hooks.js +16 -28
- package/build-module/components/layout/hooks.js.map +7 -1
- package/build-module/components/layout/index.js +199 -183
- package/build-module/components/layout/index.js.map +7 -1
- package/build-module/components/media/index.js +13 -21
- package/build-module/components/media/index.js.map +7 -1
- package/build-module/components/more-menu/index.js +18 -23
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/more-menu/site-export.js +41 -38
- package/build-module/components/more-menu/site-export.js.map +7 -1
- package/build-module/components/more-menu/welcome-guide-menu-item.js +12 -17
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build-module/components/page-patterns/actions.js +52 -0
- package/build-module/components/page-patterns/actions.js.map +7 -0
- package/build-module/components/page-patterns/delete-category-menu-item.js +78 -76
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +7 -1
- package/build-module/components/page-patterns/fields.js +103 -112
- package/build-module/components/page-patterns/fields.js.map +7 -1
- package/build-module/components/page-patterns/index.js +144 -120
- package/build-module/components/page-patterns/index.js.map +7 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +37 -53
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +7 -1
- package/build-module/components/page-patterns/search-items.js +43 -77
- package/build-module/components/page-patterns/search-items.js.map +7 -1
- package/build-module/components/page-patterns/use-pattern-settings.js +27 -30
- package/build-module/components/page-patterns/use-pattern-settings.js.map +7 -1
- package/build-module/components/page-patterns/use-patterns.js +249 -192
- package/build-module/components/page-patterns/use-patterns.js.map +7 -1
- package/build-module/components/page-patterns/utils.js +5 -2
- package/build-module/components/page-patterns/utils.js.map +7 -1
- package/build-module/components/page-templates/fields.js +132 -147
- package/build-module/components/page-templates/fields.js.map +7 -1
- package/build-module/components/page-templates/hooks.js +44 -55
- package/build-module/components/page-templates/hooks.js.map +7 -1
- package/build-module/components/page-templates/index.js +189 -194
- package/build-module/components/page-templates/index.js.map +7 -1
- package/build-module/components/page-templates/view-utils.js +42 -0
- package/build-module/components/page-templates/view-utils.js.map +7 -0
- package/build-module/components/pagination/index.js +96 -77
- package/build-module/components/pagination/index.js.map +7 -1
- package/build-module/components/plugin-template-setting-panel/index.js +21 -50
- package/build-module/components/plugin-template-setting-panel/index.js.map +7 -1
- package/build-module/components/post-edit/index.js +136 -140
- package/build-module/components/post-edit/index.js.map +7 -1
- package/build-module/components/post-list/index.js +205 -291
- package/build-module/components/post-list/index.js.map +7 -1
- package/build-module/components/post-list/view-utils.js +149 -0
- package/build-module/components/post-list/view-utils.js.map +7 -0
- package/build-module/components/posts-app/index.js +15 -25
- package/build-module/components/posts-app/index.js.map +7 -1
- package/build-module/components/posts-app-routes/index.js +12 -18
- package/build-module/components/posts-app-routes/index.js.map +7 -1
- package/build-module/components/posts-app-routes/post-item.js +22 -29
- package/build-module/components/posts-app-routes/post-item.js.map +7 -1
- package/build-module/components/posts-app-routes/posts.js +59 -70
- package/build-module/components/posts-app-routes/posts.js.map +7 -1
- package/build-module/components/resizable-frame/index.js +169 -211
- package/build-module/components/resizable-frame/index.js.map +7 -1
- package/build-module/components/revisions/index.js +78 -64
- package/build-module/components/revisions/index.js.map +7 -1
- package/build-module/components/routes/use-title.js +25 -28
- package/build-module/components/routes/use-title.js.map +7 -1
- package/build-module/components/save-button/index.js +99 -104
- package/build-module/components/save-button/index.js.map +7 -1
- package/build-module/components/save-hub/index.js +23 -33
- package/build-module/components/save-hub/index.js.map +7 -1
- package/build-module/components/save-keyboard-shortcut/index.js +31 -47
- package/build-module/components/save-keyboard-shortcut/index.js.map +7 -1
- package/build-module/components/save-panel/index.js +125 -124
- package/build-module/components/save-panel/index.js.map +7 -1
- package/build-module/components/sidebar/index.js +47 -65
- package/build-module/components/sidebar/index.js.map +7 -1
- package/build-module/components/sidebar-button/index.js +16 -17
- package/build-module/components/sidebar-button/index.js.map +7 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +41 -50
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +7 -1
- package/build-module/components/sidebar-dataviews/index.js +40 -48
- package/build-module/components/sidebar-dataviews/index.js.map +7 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +100 -104
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-item/index.js +56 -57
- package/build-module/components/sidebar-navigation-item/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen/index.js +108 -98
- package/build-module/components/sidebar-navigation-screen/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +36 -48
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +23 -28
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +61 -73
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +108 -82
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +22 -24
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +92 -84
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +87 -76
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +28 -41
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +67 -60
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +37 -32
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +107 -91
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +14 -14
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +8 -12
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +89 -98
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +113 -117
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +82 -82
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +17 -16
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +108 -99
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +19 -21
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +53 -59
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +27 -27
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +24 -24
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +67 -70
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +20 -21
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +7 -1
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js +11 -16
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js.map +7 -1
- package/build-module/components/site-editor-routes/home.js +18 -26
- package/build-module/components/site-editor-routes/home.js.map +7 -1
- package/build-module/components/site-editor-routes/index.js +39 -30
- package/build-module/components/site-editor-routes/index.js.map +7 -1
- package/build-module/components/site-editor-routes/navigation-item.js +23 -43
- package/build-module/components/site-editor-routes/navigation-item.js.map +7 -1
- package/build-module/components/site-editor-routes/navigation.js +23 -43
- package/build-module/components/site-editor-routes/navigation.js.map +7 -1
- package/build-module/components/site-editor-routes/notfound.js +22 -28
- package/build-module/components/site-editor-routes/notfound.js.map +7 -1
- package/build-module/components/site-editor-routes/page-item.js +26 -35
- package/build-module/components/site-editor-routes/page-item.js.map +7 -1
- package/build-module/components/site-editor-routes/pages.js +64 -80
- package/build-module/components/site-editor-routes/pages.js.map +7 -1
- package/build-module/components/site-editor-routes/pattern-item.js +16 -20
- package/build-module/components/site-editor-routes/pattern-item.js.map +7 -1
- package/build-module/components/site-editor-routes/patterns.js +19 -30
- package/build-module/components/site-editor-routes/patterns.js.map +7 -1
- package/build-module/components/site-editor-routes/stylebook.js +28 -37
- package/build-module/components/site-editor-routes/stylebook.js.map +7 -1
- package/build-module/components/site-editor-routes/styles.js +26 -40
- package/build-module/components/site-editor-routes/styles.js.map +7 -1
- package/build-module/components/site-editor-routes/template-item.js +21 -28
- package/build-module/components/site-editor-routes/template-item.js.map +7 -1
- package/build-module/components/site-editor-routes/template-part-item.js +13 -15
- package/build-module/components/site-editor-routes/template-part-item.js.map +7 -1
- package/build-module/components/site-editor-routes/templates.js +37 -38
- package/build-module/components/site-editor-routes/templates.js.map +7 -1
- package/build-module/components/site-editor-routes/utils.js +6 -10
- package/build-module/components/site-editor-routes/utils.js.map +7 -1
- package/build-module/components/site-hub/index.js +204 -215
- package/build-module/components/site-hub/index.js.map +7 -1
- package/build-module/components/site-icon/index.js +33 -43
- package/build-module/components/site-icon/index.js.map +7 -1
- package/build-module/components/style-book/categories.js +41 -48
- package/build-module/components/style-book/categories.js.map +7 -1
- package/build-module/components/style-book/color-examples.js +29 -37
- package/build-module/components/style-book/color-examples.js.map +7 -1
- package/build-module/components/style-book/constants.js +191 -140
- package/build-module/components/style-book/constants.js.map +7 -1
- package/build-module/components/style-book/duotone-examples.js +36 -35
- package/build-module/components/style-book/duotone-examples.js.map +7 -1
- package/build-module/components/style-book/examples.js +114 -116
- package/build-module/components/style-book/examples.js.map +7 -1
- package/build-module/components/style-book/index.js +431 -384
- package/build-module/components/style-book/index.js.map +7 -1
- package/build-module/components/style-book/types.js +1 -2
- package/build-module/components/style-book/types.js.map +7 -1
- package/build-module/components/welcome-guide/editor.js +59 -54
- package/build-module/components/welcome-guide/editor.js.map +7 -1
- package/build-module/components/welcome-guide/image.js +16 -18
- package/build-module/components/welcome-guide/image.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +16 -15
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/components/welcome-guide/page.js +59 -48
- package/build-module/components/welcome-guide/page.js.map +7 -1
- package/build-module/components/welcome-guide/styles.js +108 -97
- package/build-module/components/welcome-guide/styles.js.map +7 -1
- package/build-module/components/welcome-guide/template.js +54 -55
- package/build-module/components/welcome-guide/template.js.map +7 -1
- package/build-module/deprecated.js +28 -40
- package/build-module/deprecated.js.map +7 -1
- package/build-module/hooks/commands/use-common-commands.js +89 -108
- package/build-module/hooks/commands/use-common-commands.js.map +7 -1
- package/build-module/hooks/commands/use-set-command-context.js +21 -44
- package/build-module/hooks/commands/use-set-command-context.js.map +7 -1
- package/build-module/hooks/index.js +2 -5
- package/build-module/hooks/index.js.map +7 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +218 -243
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +56 -105
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +7 -1
- package/build-module/index.js +55 -69
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/posts.js +38 -54
- package/build-module/posts.js.map +7 -1
- package/build-module/store/actions.js +140 -320
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -7
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +15 -18
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/private-actions.js +12 -14
- package/build-module/store/private-actions.js.map +7 -1
- package/build-module/store/private-selectors.js +7 -10
- package/build-module/store/private-selectors.js.map +7 -1
- package/build-module/store/reducer.js +21 -53
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +151 -278
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils/constants.js +53 -44
- package/build-module/utils/constants.js.map +7 -1
- package/build-module/utils/get-filtered-template-parts.js +18 -37
- package/build-module/utils/get-filtered-template-parts.js.map +7 -1
- package/build-module/utils/is-previewing-theme.js +10 -9
- package/build-module/utils/is-previewing-theme.js.map +7 -1
- package/build-module/utils/is-template-removable.js +6 -13
- package/build-module/utils/is-template-removable.js.map +7 -1
- package/build-module/utils/is-template-revertable.js +6 -15
- package/build-module/utils/is-template-revertable.js.map +7 -1
- package/build-module/utils/set-nested-value.js +7 -22
- package/build-module/utils/set-nested-value.js.map +7 -1
- package/build-module/utils/template-part-create.js +1 -2
- package/build-module/utils/template-part-create.js.map +7 -1
- package/build-module/utils/use-activate-theme.js +21 -40
- package/build-module/utils/use-activate-theme.js.map +7 -1
- package/build-module/utils/use-actual-current-theme.js +13 -17
- package/build-module/utils/use-actual-current-theme.js.map +7 -1
- package/build-style/posts-rtl.css +484 -214
- package/build-style/posts.css +484 -214
- package/build-style/style-rtl.css +629 -271
- package/build-style/style.css +629 -271
- package/package.json +52 -42
- package/src/components/add-new-template/index.js +5 -3
- package/src/components/add-new-template/style.scss +4 -0
- package/src/components/dataviews-actions/index.js +16 -9
- package/src/components/editor/style.scss +3 -0
- package/src/components/editor/use-resolve-edited-entity.js +4 -18
- package/src/components/editor-canvas-container/style.scss +4 -1
- package/src/components/global-styles/font-library-modal/style.scss +4 -0
- package/src/components/global-styles/screen-revisions/style.scss +4 -0
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/global-styles/variations/style.scss +3 -0
- package/src/components/global-styles-sidebar/style.scss +3 -0
- package/src/components/layout/index.js +2 -1
- package/src/components/layout/style.scss +5 -0
- package/src/components/page-patterns/actions.js +54 -0
- package/src/components/page-patterns/index.js +79 -32
- package/src/components/page-patterns/style.scss +4 -0
- package/src/components/page-templates/fields.js +22 -1
- package/src/components/page-templates/index.js +71 -104
- package/src/components/page-templates/style.scss +4 -0
- package/src/components/page-templates/view-utils.js +41 -0
- package/src/components/pagination/style.scss +2 -0
- package/src/components/post-edit/index.js +4 -3
- package/src/components/post-edit/style.scss +3 -6
- package/src/components/post-list/index.js +76 -188
- package/src/components/post-list/style.scss +3 -0
- package/src/components/post-list/view-utils.js +155 -0
- package/src/components/posts-app-routes/posts.js +29 -16
- package/src/components/resizable-frame/style.scss +3 -0
- package/src/components/save-hub/style.scss +3 -0
- package/src/components/save-panel/index.js +2 -2
- package/src/components/save-panel/style.scss +2 -0
- package/src/components/sidebar/style.scss +4 -0
- package/src/components/sidebar-button/style.scss +2 -0
- package/src/components/sidebar-dataviews/dataview-item.js +5 -11
- package/src/components/sidebar-dataviews/index.js +17 -17
- package/src/components/sidebar-dataviews/style.scss +2 -16
- package/src/components/sidebar-global-styles-wrapper/index.js +16 -21
- package/src/components/sidebar-global-styles-wrapper/style.scss +4 -30
- package/src/components/sidebar-navigation-item/style.scss +3 -0
- package/src/components/sidebar-navigation-screen/style.scss +5 -0
- package/src/components/sidebar-navigation-screen-main/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-templates-browse/style.scss +2 -0
- package/src/components/site-editor-routes/pages.js +29 -16
- package/src/components/site-editor-routes/templates.js +21 -4
- package/src/components/site-hub/style.scss +3 -0
- package/src/components/site-icon/style.scss +3 -0
- package/src/components/style-book/style.scss +3 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/posts.scss +14 -11
- package/src/style.scss +42 -39
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/page/header.js +0 -45
- package/build/components/page/header.js.map +0 -1
- package/build/components/page/index.js +0 -50
- package/build/components/page/index.js.map +0 -1
- package/build/components/page-patterns/header.js +0 -96
- package/build/components/page-patterns/header.js.map +0 -1
- package/build/components/sidebar-dataviews/add-new-view.js +0 -137
- package/build/components/sidebar-dataviews/add-new-view.js.map +0 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +0 -211
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +0 -1
- package/build/components/sidebar-dataviews/default-views.js +0 -141
- package/build/components/sidebar-dataviews/default-views.js.map +0 -1
- package/build-module/components/page/header.js +0 -40
- package/build-module/components/page/header.js.map +0 -1
- package/build-module/components/page/index.js +0 -42
- package/build-module/components/page/index.js.map +0 -1
- package/build-module/components/page-patterns/header.js +0 -88
- package/build-module/components/page-patterns/header.js.map +0 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +0 -129
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +0 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +0 -202
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +0 -1
- package/build-module/components/sidebar-dataviews/default-views.js +0 -133
- package/build-module/components/sidebar-dataviews/default-views.js.map +0 -1
- package/src/components/page/header.js +0 -44
- package/src/components/page/index.js +0 -43
- package/src/components/page/style.scss +0 -56
- package/src/components/page-patterns/header.js +0 -120
- package/src/components/sidebar-dataviews/add-new-view.js +0 -143
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +0 -233
- package/src/components/sidebar-dataviews/default-views.js +0 -168
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var fonts_outline_exports = {};
|
|
20
|
+
__export(fonts_outline_exports, {
|
|
21
|
+
getFontsOutline: () => getFontsOutline,
|
|
22
|
+
isFontFontFaceInOutline: () => isFontFontFaceInOutline
|
|
5
23
|
});
|
|
6
|
-
exports
|
|
7
|
-
exports.isFontFontFaceInOutline = isFontFontFaceInOutline;
|
|
24
|
+
module.exports = __toCommonJS(fonts_outline_exports);
|
|
8
25
|
function getFontsOutline(fonts) {
|
|
9
|
-
return fonts.reduce(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
return fonts.reduce(
|
|
27
|
+
(acc, font) => ({
|
|
28
|
+
...acc,
|
|
29
|
+
[font.slug]: (font?.fontFace || []).reduce(
|
|
30
|
+
(faces, face) => ({
|
|
31
|
+
...faces,
|
|
32
|
+
[`${face.fontStyle}-${face.fontWeight}`]: true
|
|
33
|
+
}),
|
|
34
|
+
{}
|
|
35
|
+
)
|
|
36
|
+
}),
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
16
39
|
}
|
|
17
40
|
function isFontFontFaceInOutline(slug, face, outline) {
|
|
18
41
|
if (!face) {
|
|
@@ -20,4 +43,9 @@ function isFontFontFaceInOutline(slug, face, outline) {
|
|
|
20
43
|
}
|
|
21
44
|
return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`];
|
|
22
45
|
}
|
|
23
|
-
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
getFontsOutline,
|
|
49
|
+
isFontFontFaceInOutline
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=fonts-outline.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/global-styles/font-library-modal/utils/fonts-outline.js"],
|
|
4
|
+
"sourcesContent": ["export function getFontsOutline( fonts ) {\n\treturn fonts.reduce(\n\t\t( acc, font ) => ( {\n\t\t\t...acc,\n\t\t\t[ font.slug ]: ( font?.fontFace || [] ).reduce(\n\t\t\t\t( faces, face ) => ( {\n\t\t\t\t\t...faces,\n\t\t\t\t\t[ `${ face.fontStyle }-${ face.fontWeight }` ]: true,\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t} ),\n\t\t{}\n\t);\n}\n\nexport function isFontFontFaceInOutline( slug, face, outline ) {\n\tif ( ! face ) {\n\t\treturn !! outline[ slug ];\n\t}\n\treturn !! outline[ slug ]?.[ `${ face.fontStyle }-${ face.fontWeight }` ];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,gBAAiB,OAAQ;AACxC,SAAO,MAAM;AAAA,IACZ,CAAE,KAAK,UAAY;AAAA,MAClB,GAAG;AAAA,MACH,CAAE,KAAK,IAAK,IAAK,MAAM,YAAY,CAAC,GAAI;AAAA,QACvC,CAAE,OAAO,UAAY;AAAA,UACpB,GAAG;AAAA,UACH,CAAE,GAAI,KAAK,SAAU,IAAK,KAAK,UAAW,EAAG,GAAG;AAAA,QACjD;AAAA,QACA,CAAC;AAAA,MACF;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AACD;AAEO,SAAS,wBAAyB,MAAM,MAAM,SAAU;AAC9D,MAAK,CAAE,MAAO;AACb,WAAO,CAAC,CAAE,QAAS,IAAK;AAAA,EACzB;AACA,SAAO,CAAC,CAAE,QAAS,IAAK,IAAK,GAAI,KAAK,SAAU,IAAK,KAAK,UAAW,EAAG;AACzE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
batchInstallFontFaces: () => batchInstallFontFaces,
|
|
22
|
+
checkFontFaceInstalled: () => checkFontFaceInstalled,
|
|
23
|
+
downloadFontFaceAssets: () => downloadFontFaceAssets,
|
|
24
|
+
getDisplaySrcFromFontFace: () => getDisplaySrcFromFontFace,
|
|
25
|
+
getFontFaceVariantName: () => getFontFaceVariantName,
|
|
26
|
+
isUrlEncoded: () => isUrlEncoded,
|
|
27
|
+
loadFontFaceInBrowser: () => loadFontFaceInBrowser,
|
|
28
|
+
makeFontFacesFormData: () => makeFontFacesFormData,
|
|
29
|
+
makeFontFamilyFormData: () => makeFontFamilyFormData,
|
|
30
|
+
mergeFontFaces: () => mergeFontFaces,
|
|
31
|
+
mergeFontFamilies: () => mergeFontFamilies,
|
|
32
|
+
setUIValuesNeeded: () => setUIValuesNeeded,
|
|
33
|
+
unloadFontFaceInBrowser: () => unloadFontFaceInBrowser
|
|
5
34
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.makeFontFamilyFormData = makeFontFamilyFormData;
|
|
15
|
-
exports.mergeFontFaces = mergeFontFaces;
|
|
16
|
-
exports.mergeFontFamilies = mergeFontFamilies;
|
|
17
|
-
exports.setUIValuesNeeded = setUIValuesNeeded;
|
|
18
|
-
exports.unloadFontFaceInBrowser = unloadFontFaceInBrowser;
|
|
19
|
-
var _components = require("@wordpress/components");
|
|
20
|
-
var _constants = require("./constants");
|
|
21
|
-
var _lockUnlock = require("../../../../lock-unlock");
|
|
22
|
-
var _resolvers = require("../resolvers");
|
|
23
|
-
var _previewStyles = require("./preview-styles");
|
|
24
|
-
/**
|
|
25
|
-
* WordPress dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Internal dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Browser dependencies
|
|
34
|
-
*/
|
|
35
|
-
const {
|
|
36
|
-
File
|
|
37
|
-
} = window;
|
|
38
|
-
const {
|
|
39
|
-
kebabCase
|
|
40
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
35
|
+
module.exports = __toCommonJS(utils_exports);
|
|
36
|
+
var import_components = require("@wordpress/components");
|
|
37
|
+
var import_constants = require("./constants");
|
|
38
|
+
var import_lock_unlock = require("../../../../lock-unlock");
|
|
39
|
+
var import_resolvers = require("../resolvers");
|
|
40
|
+
var import_preview_styles = require("./preview-styles");
|
|
41
|
+
const { File } = window;
|
|
42
|
+
const { kebabCase } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
41
43
|
function setUIValuesNeeded(font, extraValues = {}) {
|
|
42
44
|
if (!font.name && (font.fontFamily || font.slug)) {
|
|
43
45
|
font.name = font.fontFamily || font.slug;
|
|
@@ -48,119 +50,95 @@ function setUIValuesNeeded(font, extraValues = {}) {
|
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
function isUrlEncoded(url) {
|
|
51
|
-
if (typeof url !==
|
|
53
|
+
if (typeof url !== "string") {
|
|
52
54
|
return false;
|
|
53
55
|
}
|
|
54
56
|
return url !== decodeURIComponent(url);
|
|
55
57
|
}
|
|
56
58
|
function getFontFaceVariantName(face) {
|
|
57
|
-
const weightName =
|
|
58
|
-
const styleName = face.fontStyle ===
|
|
59
|
+
const weightName = import_constants.FONT_WEIGHTS[face.fontWeight] || face.fontWeight;
|
|
60
|
+
const styleName = face.fontStyle === "normal" ? "" : import_constants.FONT_STYLES[face.fontStyle] || face.fontStyle;
|
|
59
61
|
return `${weightName} ${styleName}`;
|
|
60
62
|
}
|
|
61
63
|
function mergeFontFaces(existing = [], incoming = []) {
|
|
62
|
-
const map = new Map();
|
|
64
|
+
const map = /* @__PURE__ */ new Map();
|
|
63
65
|
for (const face of existing) {
|
|
64
66
|
map.set(`${face.fontWeight}${face.fontStyle}`, face);
|
|
65
67
|
}
|
|
66
68
|
for (const face of incoming) {
|
|
67
|
-
// This will overwrite if the src already exists, keeping it unique.
|
|
68
69
|
map.set(`${face.fontWeight}${face.fontStyle}`, face);
|
|
69
70
|
}
|
|
70
71
|
return Array.from(map.values());
|
|
71
72
|
}
|
|
72
73
|
function mergeFontFamilies(existing = [], incoming = []) {
|
|
73
|
-
const map = new Map();
|
|
74
|
-
// Add the existing array to the map.
|
|
74
|
+
const map = /* @__PURE__ */ new Map();
|
|
75
75
|
for (const font of existing) {
|
|
76
|
-
map.set(font.slug, {
|
|
77
|
-
...font
|
|
78
|
-
});
|
|
76
|
+
map.set(font.slug, { ...font });
|
|
79
77
|
}
|
|
80
|
-
// Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged.
|
|
81
78
|
for (const font of incoming) {
|
|
82
79
|
if (map.has(font.slug)) {
|
|
83
|
-
const {
|
|
84
|
-
fontFace: incomingFontFaces,
|
|
85
|
-
...restIncoming
|
|
86
|
-
} = font;
|
|
80
|
+
const { fontFace: incomingFontFaces, ...restIncoming } = font;
|
|
87
81
|
const existingFont = map.get(font.slug);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
const mergedFontFaces = mergeFontFaces(
|
|
83
|
+
existingFont.fontFace,
|
|
84
|
+
incomingFontFaces
|
|
85
|
+
);
|
|
91
86
|
map.set(font.slug, {
|
|
92
87
|
...restIncoming,
|
|
93
88
|
fontFace: mergedFontFaces
|
|
94
89
|
});
|
|
95
90
|
} else {
|
|
96
|
-
map.set(font.slug, {
|
|
97
|
-
...font
|
|
98
|
-
});
|
|
91
|
+
map.set(font.slug, { ...font });
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
94
|
return Array.from(map.values());
|
|
102
95
|
}
|
|
103
|
-
|
|
104
|
-
/*
|
|
105
|
-
* Loads the font face from a URL and adds it to the browser.
|
|
106
|
-
* It also adds it to the iframe document.
|
|
107
|
-
*/
|
|
108
|
-
async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') {
|
|
96
|
+
async function loadFontFaceInBrowser(fontFace, source, addTo = "all") {
|
|
109
97
|
let dataSource;
|
|
110
|
-
if (typeof source ===
|
|
98
|
+
if (typeof source === "string") {
|
|
111
99
|
dataSource = `url(${source})`;
|
|
112
|
-
// eslint-disable-next-line no-undef
|
|
113
100
|
} else if (source instanceof File) {
|
|
114
101
|
dataSource = await source.arrayBuffer();
|
|
115
102
|
} else {
|
|
116
103
|
return;
|
|
117
104
|
}
|
|
118
|
-
const newFont = new window.FontFace(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
const newFont = new window.FontFace(
|
|
106
|
+
(0, import_preview_styles.formatFontFaceName)(fontFace.fontFamily),
|
|
107
|
+
dataSource,
|
|
108
|
+
{
|
|
109
|
+
style: fontFace.fontStyle,
|
|
110
|
+
weight: fontFace.fontWeight
|
|
111
|
+
}
|
|
112
|
+
);
|
|
122
113
|
const loadedFace = await newFont.load();
|
|
123
|
-
if (addTo ===
|
|
114
|
+
if (addTo === "document" || addTo === "all") {
|
|
124
115
|
document.fonts.add(loadedFace);
|
|
125
116
|
}
|
|
126
|
-
if (addTo ===
|
|
127
|
-
const iframeDocument = document.querySelector(
|
|
117
|
+
if (addTo === "iframe" || addTo === "all") {
|
|
118
|
+
const iframeDocument = document.querySelector(
|
|
119
|
+
'iframe[name="editor-canvas"]'
|
|
120
|
+
).contentDocument;
|
|
128
121
|
iframeDocument.fonts.add(loadedFace);
|
|
129
122
|
}
|
|
130
123
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
* Note that Font faces that were added to the set using the CSS @font-face rule
|
|
137
|
-
* remain connected to the corresponding CSS, and cannot be deleted.
|
|
138
|
-
*
|
|
139
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.
|
|
140
|
-
*/
|
|
141
|
-
function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') {
|
|
142
|
-
const unloadFontFace = fonts => {
|
|
143
|
-
fonts.forEach(f => {
|
|
144
|
-
if (f.family === (0, _previewStyles.formatFontFaceName)(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) {
|
|
124
|
+
function unloadFontFaceInBrowser(fontFace, removeFrom = "all") {
|
|
125
|
+
const unloadFontFace = (fonts) => {
|
|
126
|
+
fonts.forEach((f) => {
|
|
127
|
+
if (f.family === (0, import_preview_styles.formatFontFaceName)(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) {
|
|
145
128
|
fonts.delete(f);
|
|
146
129
|
}
|
|
147
130
|
});
|
|
148
131
|
};
|
|
149
|
-
if (removeFrom ===
|
|
132
|
+
if (removeFrom === "document" || removeFrom === "all") {
|
|
150
133
|
unloadFontFace(document.fonts);
|
|
151
134
|
}
|
|
152
|
-
if (removeFrom ===
|
|
153
|
-
const iframeDocument = document.querySelector(
|
|
135
|
+
if (removeFrom === "iframe" || removeFrom === "all") {
|
|
136
|
+
const iframeDocument = document.querySelector(
|
|
137
|
+
'iframe[name="editor-canvas"]'
|
|
138
|
+
).contentDocument;
|
|
154
139
|
unloadFontFace(iframeDocument.fonts);
|
|
155
140
|
}
|
|
156
141
|
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Retrieves the display source from a font face src.
|
|
160
|
-
*
|
|
161
|
-
* @param {string|string[]} input - The font face src.
|
|
162
|
-
* @return {string|undefined} The display source or undefined if the input is invalid.
|
|
163
|
-
*/
|
|
164
142
|
function getDisplaySrcFromFontFace(input) {
|
|
165
143
|
if (!input) {
|
|
166
144
|
return;
|
|
@@ -171,8 +149,7 @@ function getDisplaySrcFromFontFace(input) {
|
|
|
171
149
|
} else {
|
|
172
150
|
src = input;
|
|
173
151
|
}
|
|
174
|
-
|
|
175
|
-
if (src.startsWith('file:.')) {
|
|
152
|
+
if (src.startsWith("file:.")) {
|
|
176
153
|
return;
|
|
177
154
|
}
|
|
178
155
|
if (!isUrlEncoded(src)) {
|
|
@@ -182,41 +159,35 @@ function getDisplaySrcFromFontFace(input) {
|
|
|
182
159
|
}
|
|
183
160
|
function makeFontFamilyFormData(fontFamily) {
|
|
184
161
|
const formData = new FormData();
|
|
185
|
-
const {
|
|
186
|
-
fontFace,
|
|
187
|
-
category,
|
|
188
|
-
...familyWithValidParameters
|
|
189
|
-
} = fontFamily;
|
|
162
|
+
const { fontFace, category, ...familyWithValidParameters } = fontFamily;
|
|
190
163
|
const fontFamilySettings = {
|
|
191
164
|
...familyWithValidParameters,
|
|
192
165
|
slug: kebabCase(fontFamily.slug)
|
|
193
166
|
};
|
|
194
|
-
formData.append(
|
|
167
|
+
formData.append(
|
|
168
|
+
"font_family_settings",
|
|
169
|
+
JSON.stringify(fontFamilySettings)
|
|
170
|
+
);
|
|
195
171
|
return formData;
|
|
196
172
|
}
|
|
197
173
|
function makeFontFacesFormData(font) {
|
|
198
174
|
if (font?.fontFace) {
|
|
199
175
|
const fontFacesFormData = font.fontFace.map((item, faceIndex) => {
|
|
200
|
-
const face = {
|
|
201
|
-
...item
|
|
202
|
-
};
|
|
176
|
+
const face = { ...item };
|
|
203
177
|
const formData = new FormData();
|
|
204
178
|
if (face.file) {
|
|
205
|
-
// Normalize to an array, since face.file may be a single file or an array of files.
|
|
206
179
|
const files = Array.isArray(face.file) ? face.file : [face.file];
|
|
207
180
|
const src = [];
|
|
208
181
|
files.forEach((file, key) => {
|
|
209
|
-
// Slugified file name because the it might contain spaces or characters treated differently on the server.
|
|
210
182
|
const fileId = `file-${faceIndex}-${key}`;
|
|
211
|
-
// Add the files to the formData
|
|
212
183
|
formData.append(fileId, file, file.name);
|
|
213
184
|
src.push(fileId);
|
|
214
185
|
});
|
|
215
186
|
face.src = src.length === 1 ? src[0] : src;
|
|
216
187
|
delete face.file;
|
|
217
|
-
formData.append(
|
|
188
|
+
formData.append("font_face_settings", JSON.stringify(face));
|
|
218
189
|
} else {
|
|
219
|
-
formData.append(
|
|
190
|
+
formData.append("font_face_settings", JSON.stringify(face));
|
|
220
191
|
}
|
|
221
192
|
return formData;
|
|
222
193
|
});
|
|
@@ -225,23 +196,15 @@ function makeFontFacesFormData(font) {
|
|
|
225
196
|
}
|
|
226
197
|
async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|
227
198
|
const responses = [];
|
|
228
|
-
|
|
229
|
-
/*
|
|
230
|
-
* Uses the same response format as Promise.allSettled, but executes requests in sequence to work
|
|
231
|
-
* around a race condition that can cause an error when the fonts directory doesn't exist yet.
|
|
232
|
-
*/
|
|
233
199
|
for (const faceData of fontFacesData) {
|
|
234
200
|
try {
|
|
235
|
-
const response = await (0,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
201
|
+
const response = await (0, import_resolvers.fetchInstallFontFace)(
|
|
202
|
+
fontFamilyId,
|
|
203
|
+
faceData
|
|
204
|
+
);
|
|
205
|
+
responses.push({ status: "fulfilled", value: response });
|
|
240
206
|
} catch (error) {
|
|
241
|
-
responses.push({
|
|
242
|
-
status: 'rejected',
|
|
243
|
-
reason: error
|
|
244
|
-
});
|
|
207
|
+
responses.push({ status: "rejected", reason: error });
|
|
245
208
|
}
|
|
246
209
|
}
|
|
247
210
|
const results = {
|
|
@@ -249,7 +212,7 @@ async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|
|
249
212
|
successes: []
|
|
250
213
|
};
|
|
251
214
|
responses.forEach((result, index) => {
|
|
252
|
-
if (result.status ===
|
|
215
|
+
if (result.status === "fulfilled") {
|
|
253
216
|
const response = result.value;
|
|
254
217
|
if (response.id) {
|
|
255
218
|
results.successes.push(response);
|
|
@@ -260,7 +223,6 @@ async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|
|
260
223
|
});
|
|
261
224
|
}
|
|
262
225
|
} else {
|
|
263
|
-
// Handle network errors or other fetch-related errors
|
|
264
226
|
results.errors.push({
|
|
265
227
|
data: fontFacesData[index],
|
|
266
228
|
message: result.reason.message
|
|
@@ -269,43 +231,47 @@ async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|
|
269
231
|
});
|
|
270
232
|
return results;
|
|
271
233
|
}
|
|
272
|
-
|
|
273
|
-
/*
|
|
274
|
-
* Downloads a font face asset from a URL to the client and returns a File object.
|
|
275
|
-
*/
|
|
276
234
|
async function downloadFontFaceAssets(src) {
|
|
277
|
-
// Normalize to an array, since `src` could be a string or array.
|
|
278
235
|
src = Array.isArray(src) ? src : [src];
|
|
279
|
-
const files = await Promise.all(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
236
|
+
const files = await Promise.all(
|
|
237
|
+
src.map(async (url) => {
|
|
238
|
+
return fetch(new Request(url)).then((response) => {
|
|
239
|
+
if (!response.ok) {
|
|
240
|
+
throw new Error(
|
|
241
|
+
`Error downloading font face asset from ${url}. Server responded with status: ${response.status}`
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
return response.blob();
|
|
245
|
+
}).then((blob) => {
|
|
246
|
+
const filename = url.split("/").pop();
|
|
247
|
+
const file = new File([blob], filename, {
|
|
248
|
+
type: blob.type
|
|
249
|
+
});
|
|
250
|
+
return file;
|
|
289
251
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}));
|
|
293
|
-
|
|
294
|
-
// If we only have one file return it (not the array). Otherwise return all of them in the array.
|
|
252
|
+
})
|
|
253
|
+
);
|
|
295
254
|
return files.length === 1 ? files[0] : files;
|
|
296
255
|
}
|
|
297
|
-
|
|
298
|
-
/*
|
|
299
|
-
* Determine if a given Font Face is present in a given collection.
|
|
300
|
-
* We determine that a font face has been installed by comparing the fontWeight and fontStyle
|
|
301
|
-
*
|
|
302
|
-
* @param {Object} fontFace The Font Face to seek
|
|
303
|
-
* @param {Array} collection The Collection to seek in
|
|
304
|
-
* @returns True if the font face is found in the collection. Otherwise False.
|
|
305
|
-
*/
|
|
306
256
|
function checkFontFaceInstalled(fontFace, collection) {
|
|
307
|
-
return -1 !== collection.findIndex(collectionFontFace => {
|
|
257
|
+
return -1 !== collection.findIndex((collectionFontFace) => {
|
|
308
258
|
return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle;
|
|
309
259
|
});
|
|
310
260
|
}
|
|
311
|
-
|
|
261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
262
|
+
0 && (module.exports = {
|
|
263
|
+
batchInstallFontFaces,
|
|
264
|
+
checkFontFaceInstalled,
|
|
265
|
+
downloadFontFaceAssets,
|
|
266
|
+
getDisplaySrcFromFontFace,
|
|
267
|
+
getFontFaceVariantName,
|
|
268
|
+
isUrlEncoded,
|
|
269
|
+
loadFontFaceInBrowser,
|
|
270
|
+
makeFontFacesFormData,
|
|
271
|
+
makeFontFamilyFormData,
|
|
272
|
+
mergeFontFaces,
|
|
273
|
+
mergeFontFamilies,
|
|
274
|
+
setUIValuesNeeded,
|
|
275
|
+
unloadFontFaceInBrowser
|
|
276
|
+
});
|
|
277
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_constants","_lockUnlock","_resolvers","_previewStyles","File","window","kebabCase","unlock","componentsPrivateApis","setUIValuesNeeded","font","extraValues","name","fontFamily","slug","isUrlEncoded","url","decodeURIComponent","getFontFaceVariantName","face","weightName","FONT_WEIGHTS","fontWeight","styleName","fontStyle","FONT_STYLES","mergeFontFaces","existing","incoming","map","Map","set","Array","from","values","mergeFontFamilies","has","fontFace","incomingFontFaces","restIncoming","existingFont","get","mergedFontFaces","loadFontFaceInBrowser","source","addTo","dataSource","arrayBuffer","newFont","FontFace","formatFontFaceName","style","weight","loadedFace","load","document","fonts","add","iframeDocument","querySelector","contentDocument","unloadFontFaceInBrowser","removeFrom","unloadFontFace","forEach","f","family","delete","getDisplaySrcFromFontFace","input","src","isArray","startsWith","encodeURI","makeFontFamilyFormData","formData","FormData","category","familyWithValidParameters","fontFamilySettings","append","JSON","stringify","makeFontFacesFormData","fontFacesFormData","item","faceIndex","file","files","key","fileId","push","length","batchInstallFontFaces","fontFamilyId","fontFacesData","responses","faceData","response","fetchInstallFontFace","status","value","error","reason","results","errors","successes","result","index","id","data","message","downloadFontFaceAssets","Promise","all","fetch","Request","then","ok","Error","blob","filename","split","pop","type","checkFontFaceInstalled","collection","findIndex","collectionFontFace"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/utils/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { FONT_WEIGHTS, FONT_STYLES } from './constants';\nimport { unlock } from '../../../../lock-unlock';\nimport { fetchInstallFontFace } from '../resolvers';\nimport { formatFontFaceName } from './preview-styles';\n\n/**\n * Browser dependencies\n */\nconst { File } = window;\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nexport function setUIValuesNeeded( font, extraValues = {} ) {\n\tif ( ! font.name && ( font.fontFamily || font.slug ) ) {\n\t\tfont.name = font.fontFamily || font.slug;\n\t}\n\treturn {\n\t\t...font,\n\t\t...extraValues,\n\t};\n}\n\nexport function isUrlEncoded( url ) {\n\tif ( typeof url !== 'string' ) {\n\t\treturn false;\n\t}\n\treturn url !== decodeURIComponent( url );\n}\n\nexport function getFontFaceVariantName( face ) {\n\tconst weightName = FONT_WEIGHTS[ face.fontWeight ] || face.fontWeight;\n\tconst styleName =\n\t\tface.fontStyle === 'normal'\n\t\t\t? ''\n\t\t\t: FONT_STYLES[ face.fontStyle ] || face.fontStyle;\n\treturn `${ weightName } ${ styleName }`;\n}\n\nexport function mergeFontFaces( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\tfor ( const face of existing ) {\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\tfor ( const face of incoming ) {\n\t\t// This will overwrite if the src already exists, keeping it unique.\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\treturn Array.from( map.values() );\n}\n\nexport function mergeFontFamilies( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\t// Add the existing array to the map.\n\tfor ( const font of existing ) {\n\t\tmap.set( font.slug, { ...font } );\n\t}\n\t// Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged.\n\tfor ( const font of incoming ) {\n\t\tif ( map.has( font.slug ) ) {\n\t\t\tconst { fontFace: incomingFontFaces, ...restIncoming } = font;\n\t\t\tconst existingFont = map.get( font.slug );\n\t\t\t// Merge the fontFaces existing with the incoming fontFaces.\n\t\t\tconst mergedFontFaces = mergeFontFaces(\n\t\t\t\texistingFont.fontFace,\n\t\t\t\tincomingFontFaces\n\t\t\t);\n\t\t\t// Except for the fontFace key all the other keys are overwritten with the incoming values.\n\t\t\tmap.set( font.slug, {\n\t\t\t\t...restIncoming,\n\t\t\t\tfontFace: mergedFontFaces,\n\t\t\t} );\n\t\t} else {\n\t\t\tmap.set( font.slug, { ...font } );\n\t\t}\n\t}\n\treturn Array.from( map.values() );\n}\n\n/*\n * Loads the font face from a URL and adds it to the browser.\n * It also adds it to the iframe document.\n */\nexport async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {\n\tlet dataSource;\n\n\tif ( typeof source === 'string' ) {\n\t\tdataSource = `url(${ source })`;\n\t\t// eslint-disable-next-line no-undef\n\t} else if ( source instanceof File ) {\n\t\tdataSource = await source.arrayBuffer();\n\t} else {\n\t\treturn;\n\t}\n\n\tconst newFont = new window.FontFace(\n\t\tformatFontFaceName( fontFace.fontFamily ),\n\t\tdataSource,\n\t\t{\n\t\t\tstyle: fontFace.fontStyle,\n\t\t\tweight: fontFace.fontWeight,\n\t\t}\n\t);\n\n\tconst loadedFace = await newFont.load();\n\n\tif ( addTo === 'document' || addTo === 'all' ) {\n\t\tdocument.fonts.add( loadedFace );\n\t}\n\n\tif ( addTo === 'iframe' || addTo === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tiframeDocument.fonts.add( loadedFace );\n\t}\n}\n\n/*\n * Unloads the font face and remove it from the browser.\n * It also removes it from the iframe document.\n *\n * Note that Font faces that were added to the set using the CSS @font-face rule\n * remain connected to the corresponding CSS, and cannot be deleted.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.\n */\nexport function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {\n\tconst unloadFontFace = ( fonts ) => {\n\t\tfonts.forEach( ( f ) => {\n\t\t\tif (\n\t\t\t\tf.family === formatFontFaceName( fontFace?.fontFamily ) &&\n\t\t\t\tf.weight === fontFace?.fontWeight &&\n\t\t\t\tf.style === fontFace?.fontStyle\n\t\t\t) {\n\t\t\t\tfonts.delete( f );\n\t\t\t}\n\t\t} );\n\t};\n\n\tif ( removeFrom === 'document' || removeFrom === 'all' ) {\n\t\tunloadFontFace( document.fonts );\n\t}\n\n\tif ( removeFrom === 'iframe' || removeFrom === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tunloadFontFace( iframeDocument.fonts );\n\t}\n}\n\n/**\n * Retrieves the display source from a font face src.\n *\n * @param {string|string[]} input - The font face src.\n * @return {string|undefined} The display source or undefined if the input is invalid.\n */\nexport function getDisplaySrcFromFontFace( input ) {\n\tif ( ! input ) {\n\t\treturn;\n\t}\n\n\tlet src;\n\tif ( Array.isArray( input ) ) {\n\t\tsrc = input[ 0 ];\n\t} else {\n\t\tsrc = input;\n\t}\n\t// It's expected theme fonts will already be loaded in the browser.\n\tif ( src.startsWith( 'file:.' ) ) {\n\t\treturn;\n\t}\n\tif ( ! isUrlEncoded( src ) ) {\n\t\tsrc = encodeURI( src );\n\t}\n\treturn src;\n}\n\nexport function makeFontFamilyFormData( fontFamily ) {\n\tconst formData = new FormData();\n\n\tconst { fontFace, category, ...familyWithValidParameters } = fontFamily;\n\tconst fontFamilySettings = {\n\t\t...familyWithValidParameters,\n\t\tslug: kebabCase( fontFamily.slug ),\n\t};\n\n\tformData.append(\n\t\t'font_family_settings',\n\t\tJSON.stringify( fontFamilySettings )\n\t);\n\treturn formData;\n}\n\nexport function makeFontFacesFormData( font ) {\n\tif ( font?.fontFace ) {\n\t\tconst fontFacesFormData = font.fontFace.map( ( item, faceIndex ) => {\n\t\t\tconst face = { ...item };\n\t\t\tconst formData = new FormData();\n\t\t\tif ( face.file ) {\n\t\t\t\t// Normalize to an array, since face.file may be a single file or an array of files.\n\t\t\t\tconst files = Array.isArray( face.file )\n\t\t\t\t\t? face.file\n\t\t\t\t\t: [ face.file ];\n\t\t\t\tconst src = [];\n\n\t\t\t\tfiles.forEach( ( file, key ) => {\n\t\t\t\t\t// Slugified file name because the it might contain spaces or characters treated differently on the server.\n\t\t\t\t\tconst fileId = `file-${ faceIndex }-${ key }`;\n\t\t\t\t\t// Add the files to the formData\n\t\t\t\t\tformData.append( fileId, file, file.name );\n\t\t\t\t\tsrc.push( fileId );\n\t\t\t\t} );\n\n\t\t\t\tface.src = src.length === 1 ? src[ 0 ] : src;\n\t\t\t\tdelete face.file;\n\n\t\t\t\tformData.append( 'font_face_settings', JSON.stringify( face ) );\n\t\t\t} else {\n\t\t\t\tformData.append( 'font_face_settings', JSON.stringify( face ) );\n\t\t\t}\n\t\t\treturn formData;\n\t\t} );\n\n\t\treturn fontFacesFormData;\n\t}\n}\n\nexport async function batchInstallFontFaces( fontFamilyId, fontFacesData ) {\n\tconst responses = [];\n\n\t/*\n\t * Uses the same response format as Promise.allSettled, but executes requests in sequence to work\n\t * around a race condition that can cause an error when the fonts directory doesn't exist yet.\n\t */\n\tfor ( const faceData of fontFacesData ) {\n\t\ttry {\n\t\t\tconst response = await fetchInstallFontFace(\n\t\t\t\tfontFamilyId,\n\t\t\t\tfaceData\n\t\t\t);\n\t\t\tresponses.push( { status: 'fulfilled', value: response } );\n\t\t} catch ( error ) {\n\t\t\tresponses.push( { status: 'rejected', reason: error } );\n\t\t}\n\t}\n\n\tconst results = {\n\t\terrors: [],\n\t\tsuccesses: [],\n\t};\n\n\tresponses.forEach( ( result, index ) => {\n\t\tif ( result.status === 'fulfilled' ) {\n\t\t\tconst response = result.value;\n\t\t\tif ( response.id ) {\n\t\t\t\tresults.successes.push( response );\n\t\t\t} else {\n\t\t\t\tresults.errors.push( {\n\t\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\t\tmessage: `Error: ${ response.message }`,\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Handle network errors or other fetch-related errors\n\t\t\tresults.errors.push( {\n\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\tmessage: result.reason.message,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn results;\n}\n\n/*\n * Downloads a font face asset from a URL to the client and returns a File object.\n */\nexport async function downloadFontFaceAssets( src ) {\n\t// Normalize to an array, since `src` could be a string or array.\n\tsrc = Array.isArray( src ) ? src : [ src ];\n\n\tconst files = await Promise.all(\n\t\tsrc.map( async ( url ) => {\n\t\t\treturn fetch( new Request( url ) )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response.ok ) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Error downloading font face asset from ${ url }. Server responded with status: ${ response.status }`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn response.blob();\n\t\t\t\t} )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tconst filename = url.split( '/' ).pop();\n\t\t\t\t\tconst file = new File( [ blob ], filename, {\n\t\t\t\t\t\ttype: blob.type,\n\t\t\t\t\t} );\n\t\t\t\t\treturn file;\n\t\t\t\t} );\n\t\t} )\n\t);\n\n\t// If we only have one file return it (not the array). Otherwise return all of them in the array.\n\treturn files.length === 1 ? files[ 0 ] : files;\n}\n\n/*\n * Determine if a given Font Face is present in a given collection.\n * We determine that a font face has been installed by comparing the fontWeight and fontStyle\n *\n * @param {Object} fontFace The Font Face to seek\n * @param {Array} collection The Collection to seek in\n * @returns True if the font face is found in the collection. Otherwise False.\n */\nexport function checkFontFaceInstalled( fontFace, collection ) {\n\treturn (\n\t\t-1 !==\n\t\tcollection.findIndex( ( collectionFontFace ) => {\n\t\t\treturn (\n\t\t\t\tcollectionFontFace.fontWeight === fontFace.fontWeight &&\n\t\t\t\tcollectionFontFace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CG,IAAI,EAAEJ,IAAI,CAACI;MACZ,CAAE,CAAC;MACH,OAAOrC,IAAI;IACZ,CAAE,CAAC;EACL,CAAE,CACH,CAAC;;EAED;EACA,OAAOC,KAAK,CAACI,MAAM,KAAK,CAAC,GAAGJ,KAAK,CAAE,CAAC,CAAE,GAAGA,KAAK;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASqC,sBAAsBA,CAAExF,QAAQ,EAAEyF,UAAU,EAAG;EAC9D,OACC,CAAC,CAAC,KACFA,UAAU,CAACC,SAAS,CAAIC,kBAAkB,IAAM;IAC/C,OACCA,kBAAkB,CAAC1G,UAAU,KAAKe,QAAQ,CAACf,UAAU,IACrD0G,kBAAkB,CAACxG,SAAS,KAAKa,QAAQ,CAACb,SAAS;EAErD,CAAE,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/global-styles/font-library-modal/utils/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { FONT_WEIGHTS, FONT_STYLES } from './constants';\nimport { unlock } from '../../../../lock-unlock';\nimport { fetchInstallFontFace } from '../resolvers';\nimport { formatFontFaceName } from './preview-styles';\n\n/**\n * Browser dependencies\n */\nconst { File } = window;\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nexport function setUIValuesNeeded( font, extraValues = {} ) {\n\tif ( ! font.name && ( font.fontFamily || font.slug ) ) {\n\t\tfont.name = font.fontFamily || font.slug;\n\t}\n\treturn {\n\t\t...font,\n\t\t...extraValues,\n\t};\n}\n\nexport function isUrlEncoded( url ) {\n\tif ( typeof url !== 'string' ) {\n\t\treturn false;\n\t}\n\treturn url !== decodeURIComponent( url );\n}\n\nexport function getFontFaceVariantName( face ) {\n\tconst weightName = FONT_WEIGHTS[ face.fontWeight ] || face.fontWeight;\n\tconst styleName =\n\t\tface.fontStyle === 'normal'\n\t\t\t? ''\n\t\t\t: FONT_STYLES[ face.fontStyle ] || face.fontStyle;\n\treturn `${ weightName } ${ styleName }`;\n}\n\nexport function mergeFontFaces( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\tfor ( const face of existing ) {\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\tfor ( const face of incoming ) {\n\t\t// This will overwrite if the src already exists, keeping it unique.\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\treturn Array.from( map.values() );\n}\n\nexport function mergeFontFamilies( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\t// Add the existing array to the map.\n\tfor ( const font of existing ) {\n\t\tmap.set( font.slug, { ...font } );\n\t}\n\t// Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged.\n\tfor ( const font of incoming ) {\n\t\tif ( map.has( font.slug ) ) {\n\t\t\tconst { fontFace: incomingFontFaces, ...restIncoming } = font;\n\t\t\tconst existingFont = map.get( font.slug );\n\t\t\t// Merge the fontFaces existing with the incoming fontFaces.\n\t\t\tconst mergedFontFaces = mergeFontFaces(\n\t\t\t\texistingFont.fontFace,\n\t\t\t\tincomingFontFaces\n\t\t\t);\n\t\t\t// Except for the fontFace key all the other keys are overwritten with the incoming values.\n\t\t\tmap.set( font.slug, {\n\t\t\t\t...restIncoming,\n\t\t\t\tfontFace: mergedFontFaces,\n\t\t\t} );\n\t\t} else {\n\t\t\tmap.set( font.slug, { ...font } );\n\t\t}\n\t}\n\treturn Array.from( map.values() );\n}\n\n/*\n * Loads the font face from a URL and adds it to the browser.\n * It also adds it to the iframe document.\n */\nexport async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {\n\tlet dataSource;\n\n\tif ( typeof source === 'string' ) {\n\t\tdataSource = `url(${ source })`;\n\t\t// eslint-disable-next-line no-undef\n\t} else if ( source instanceof File ) {\n\t\tdataSource = await source.arrayBuffer();\n\t} else {\n\t\treturn;\n\t}\n\n\tconst newFont = new window.FontFace(\n\t\tformatFontFaceName( fontFace.fontFamily ),\n\t\tdataSource,\n\t\t{\n\t\t\tstyle: fontFace.fontStyle,\n\t\t\tweight: fontFace.fontWeight,\n\t\t}\n\t);\n\n\tconst loadedFace = await newFont.load();\n\n\tif ( addTo === 'document' || addTo === 'all' ) {\n\t\tdocument.fonts.add( loadedFace );\n\t}\n\n\tif ( addTo === 'iframe' || addTo === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tiframeDocument.fonts.add( loadedFace );\n\t}\n}\n\n/*\n * Unloads the font face and remove it from the browser.\n * It also removes it from the iframe document.\n *\n * Note that Font faces that were added to the set using the CSS @font-face rule\n * remain connected to the corresponding CSS, and cannot be deleted.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.\n */\nexport function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {\n\tconst unloadFontFace = ( fonts ) => {\n\t\tfonts.forEach( ( f ) => {\n\t\t\tif (\n\t\t\t\tf.family === formatFontFaceName( fontFace?.fontFamily ) &&\n\t\t\t\tf.weight === fontFace?.fontWeight &&\n\t\t\t\tf.style === fontFace?.fontStyle\n\t\t\t) {\n\t\t\t\tfonts.delete( f );\n\t\t\t}\n\t\t} );\n\t};\n\n\tif ( removeFrom === 'document' || removeFrom === 'all' ) {\n\t\tunloadFontFace( document.fonts );\n\t}\n\n\tif ( removeFrom === 'iframe' || removeFrom === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tunloadFontFace( iframeDocument.fonts );\n\t}\n}\n\n/**\n * Retrieves the display source from a font face src.\n *\n * @param {string|string[]} input - The font face src.\n * @return {string|undefined} The display source or undefined if the input is invalid.\n */\nexport function getDisplaySrcFromFontFace( input ) {\n\tif ( ! input ) {\n\t\treturn;\n\t}\n\n\tlet src;\n\tif ( Array.isArray( input ) ) {\n\t\tsrc = input[ 0 ];\n\t} else {\n\t\tsrc = input;\n\t}\n\t// It's expected theme fonts will already be loaded in the browser.\n\tif ( src.startsWith( 'file:.' ) ) {\n\t\treturn;\n\t}\n\tif ( ! isUrlEncoded( src ) ) {\n\t\tsrc = encodeURI( src );\n\t}\n\treturn src;\n}\n\nexport function makeFontFamilyFormData( fontFamily ) {\n\tconst formData = new FormData();\n\n\tconst { fontFace, category, ...familyWithValidParameters } = fontFamily;\n\tconst fontFamilySettings = {\n\t\t...familyWithValidParameters,\n\t\tslug: kebabCase( fontFamily.slug ),\n\t};\n\n\tformData.append(\n\t\t'font_family_settings',\n\t\tJSON.stringify( fontFamilySettings )\n\t);\n\treturn formData;\n}\n\nexport function makeFontFacesFormData( font ) {\n\tif ( font?.fontFace ) {\n\t\tconst fontFacesFormData = font.fontFace.map( ( item, faceIndex ) => {\n\t\t\tconst face = { ...item };\n\t\t\tconst formData = new FormData();\n\t\t\tif ( face.file ) {\n\t\t\t\t// Normalize to an array, since face.file may be a single file or an array of files.\n\t\t\t\tconst files = Array.isArray( face.file )\n\t\t\t\t\t? face.file\n\t\t\t\t\t: [ face.file ];\n\t\t\t\tconst src = [];\n\n\t\t\t\tfiles.forEach( ( file, key ) => {\n\t\t\t\t\t// Slugified file name because the it might contain spaces or characters treated differently on the server.\n\t\t\t\t\tconst fileId = `file-${ faceIndex }-${ key }`;\n\t\t\t\t\t// Add the files to the formData\n\t\t\t\t\tformData.append( fileId, file, file.name );\n\t\t\t\t\tsrc.push( fileId );\n\t\t\t\t} );\n\n\t\t\t\tface.src = src.length === 1 ? src[ 0 ] : src;\n\t\t\t\tdelete face.file;\n\n\t\t\t\tformData.append( 'font_face_settings', JSON.stringify( face ) );\n\t\t\t} else {\n\t\t\t\tformData.append( 'font_face_settings', JSON.stringify( face ) );\n\t\t\t}\n\t\t\treturn formData;\n\t\t} );\n\n\t\treturn fontFacesFormData;\n\t}\n}\n\nexport async function batchInstallFontFaces( fontFamilyId, fontFacesData ) {\n\tconst responses = [];\n\n\t/*\n\t * Uses the same response format as Promise.allSettled, but executes requests in sequence to work\n\t * around a race condition that can cause an error when the fonts directory doesn't exist yet.\n\t */\n\tfor ( const faceData of fontFacesData ) {\n\t\ttry {\n\t\t\tconst response = await fetchInstallFontFace(\n\t\t\t\tfontFamilyId,\n\t\t\t\tfaceData\n\t\t\t);\n\t\t\tresponses.push( { status: 'fulfilled', value: response } );\n\t\t} catch ( error ) {\n\t\t\tresponses.push( { status: 'rejected', reason: error } );\n\t\t}\n\t}\n\n\tconst results = {\n\t\terrors: [],\n\t\tsuccesses: [],\n\t};\n\n\tresponses.forEach( ( result, index ) => {\n\t\tif ( result.status === 'fulfilled' ) {\n\t\t\tconst response = result.value;\n\t\t\tif ( response.id ) {\n\t\t\t\tresults.successes.push( response );\n\t\t\t} else {\n\t\t\t\tresults.errors.push( {\n\t\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\t\tmessage: `Error: ${ response.message }`,\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Handle network errors or other fetch-related errors\n\t\t\tresults.errors.push( {\n\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\tmessage: result.reason.message,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn results;\n}\n\n/*\n * Downloads a font face asset from a URL to the client and returns a File object.\n */\nexport async function downloadFontFaceAssets( src ) {\n\t// Normalize to an array, since `src` could be a string or array.\n\tsrc = Array.isArray( src ) ? src : [ src ];\n\n\tconst files = await Promise.all(\n\t\tsrc.map( async ( url ) => {\n\t\t\treturn fetch( new Request( url ) )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response.ok ) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Error downloading font face asset from ${ url }. Server responded with status: ${ response.status }`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn response.blob();\n\t\t\t\t} )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tconst filename = url.split( '/' ).pop();\n\t\t\t\t\tconst file = new File( [ blob ], filename, {\n\t\t\t\t\t\ttype: blob.type,\n\t\t\t\t\t} );\n\t\t\t\t\treturn file;\n\t\t\t\t} );\n\t\t} )\n\t);\n\n\t// If we only have one file return it (not the array). Otherwise return all of them in the array.\n\treturn files.length === 1 ? files[ 0 ] : files;\n}\n\n/*\n * Determine if a given Font Face is present in a given collection.\n * We determine that a font face has been installed by comparing the fontWeight and fontStyle\n *\n * @param {Object} fontFace The Font Face to seek\n * @param {Array} collection The Collection to seek in\n * @returns True if the font face is found in the collection. Otherwise False.\n */\nexport function checkFontFaceInstalled( fontFace, collection ) {\n\treturn (\n\t\t-1 !==\n\t\tcollection.findIndex( ( collectionFontFace ) => {\n\t\t\treturn (\n\t\t\t\tcollectionFontFace.fontWeight === fontFace.fontWeight &&\n\t\t\t\tcollectionFontFace.fontStyle === fontFace.fontStyle\n\t\t\t);\n\t\t} )\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AAKrD,uBAA0C;AAC1C,yBAAuB;AACvB,uBAAqC;AACrC,4BAAmC;AAKnC,MAAM,EAAE,KAAK,IAAI;AACjB,MAAM,EAAE,UAAU,QAAI,2BAAQ,kBAAAA,WAAsB;AAE7C,SAAS,kBAAmB,MAAM,cAAc,CAAC,GAAI;AAC3D,MAAK,CAAE,KAAK,SAAU,KAAK,cAAc,KAAK,OAAS;AACtD,SAAK,OAAO,KAAK,cAAc,KAAK;AAAA,EACrC;AACA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AACD;AAEO,SAAS,aAAc,KAAM;AACnC,MAAK,OAAO,QAAQ,UAAW;AAC9B,WAAO;AAAA,EACR;AACA,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O,GAAI,EAAE,IAAI;AACtC,cAAM,OAAO,IAAI,KAAM,CAAE,IAAK,GAAG,UAAU;AAAA,UAC1C,MAAM,KAAK;AAAA,QACZ,CAAE;AACF,eAAO;AAAA,MACR,CAAE;AAAA,IACJ,CAAE;AAAA,EACH;AAGA,SAAO,MAAM,WAAW,IAAI,MAAO,CAAE,IAAI;AAC1C;AAUO,SAAS,uBAAwB,UAAU,YAAa;AAC9D,SACC,OACA,WAAW,UAAW,CAAE,uBAAwB;AAC/C,WACC,mBAAmB,eAAe,SAAS,cAC3C,mBAAmB,cAAc,SAAS;AAAA,EAE5C,CAAE;AAEJ;",
|
|
6
|
+
"names": ["componentsPrivateApis"]
|
|
7
|
+
}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var make_families_from_faces_exports = {};
|
|
20
|
+
__export(make_families_from_faces_exports, {
|
|
21
|
+
default: () => makeFamiliesFromFaces
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
kebabCase
|
|
19
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
23
|
+
module.exports = __toCommonJS(make_families_from_faces_exports);
|
|
24
|
+
var import_components = require("@wordpress/components");
|
|
25
|
+
var import_lock_unlock = require("../../../../lock-unlock");
|
|
26
|
+
const { kebabCase } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
20
27
|
function makeFamiliesFromFaces(fontFaces) {
|
|
21
28
|
const fontFamiliesObject = fontFaces.reduce((acc, item) => {
|
|
22
29
|
if (!acc[item.fontFamily]) {
|
|
@@ -32,4 +39,4 @@ function makeFamiliesFromFaces(fontFaces) {
|
|
|
32
39
|
}, {});
|
|
33
40
|
return Object.values(fontFamiliesObject);
|
|
34
41
|
}
|
|
35
|
-
//# sourceMappingURL=make-families-from-faces.js.map
|
|
42
|
+
//# sourceMappingURL=make-families-from-faces.js.map
|