@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
292 lines (279 loc) • 6.3 kB
JavaScript
// packages/editor/src/components/style-book/constants.ts
import { __ } from "@wordpress/i18n";
var STYLE_BOOK_COLOR_GROUPS = [
{
slug: "theme-colors",
title: __("Theme Colors"),
origin: "theme",
type: "colors"
},
{
slug: "theme-gradients",
title: __("Theme Gradients"),
origin: "theme",
type: "gradients"
},
{
slug: "custom-colors",
title: __("Custom Colors"),
origin: "custom",
type: "colors"
},
{
slug: "custom-gradients",
title: __("Custom Gradients"),
origin: "custom",
// User.
type: "gradients"
},
{
slug: "duotones",
title: __("Duotones"),
origin: "theme",
type: "duotones"
},
{
slug: "default-colors",
title: __("Default Colors"),
origin: "default",
type: "colors"
},
{
slug: "default-gradients",
title: __("Default Gradients"),
origin: "default",
type: "gradients"
}
];
var STYLE_BOOK_THEME_SUBCATEGORIES = [
{
slug: "site-identity",
title: __("Site Identity"),
blocks: ["core/site-logo", "core/site-title", "core/site-tagline"]
},
{
slug: "design",
title: __("Design"),
blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"],
exclude: ["core/home-link", "core/navigation-link"]
},
{
slug: "posts",
title: __("Posts"),
blocks: [
"core/post-title",
"core/post-excerpt",
"core/post-author",
"core/post-author-name",
"core/post-author-biography",
"core/post-date",
"core/post-terms",
"core/term-description",
"core/query-title",
"core/query-no-results",
"core/query-pagination",
"core/query-numbers"
]
},
{
slug: "comments",
title: __("Comments"),
blocks: [
"core/comments-title",
"core/comments-pagination",
"core/comments-pagination-numbers",
"core/comments",
"core/comments-author-name",
"core/comment-content",
"core/comment-date",
"core/comment-edit-link",
"core/comment-reply-link",
"core/comment-template",
"core/post-comments-count",
"core/post-comments-link"
]
}
];
var STYLE_BOOK_CATEGORIES = [
{
slug: "overview",
title: __("Overview"),
blocks: []
},
{
slug: "text",
title: __("Text"),
blocks: [
"core/post-content",
"core/home-link",
"core/navigation-link"
]
},
{
slug: "colors",
title: __("Colors"),
blocks: []
},
{
slug: "theme",
title: __("Theme"),
subcategories: STYLE_BOOK_THEME_SUBCATEGORIES
},
{
slug: "media",
title: __("Media"),
blocks: ["core/post-featured-image"]
},
{
slug: "widgets",
title: __("Widgets"),
blocks: []
},
{
slug: "embed",
title: __("Embeds"),
include: []
}
];
var STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [
...STYLE_BOOK_THEME_SUBCATEGORIES,
{
slug: "media",
title: __("Media"),
blocks: ["core/post-featured-image"]
},
{
slug: "widgets",
title: __("Widgets"),
blocks: []
},
{
slug: "embed",
title: __("Embeds"),
include: []
}
];
var STYLE_BOOK_PREVIEW_CATEGORIES = [
{
slug: "overview",
title: __("Overview"),
blocks: []
},
{
slug: "text",
title: __("Text"),
blocks: [
"core/post-content",
"core/home-link",
"core/navigation-link"
]
},
{
slug: "colors",
title: __("Colors"),
blocks: []
},
{
slug: "blocks",
title: __("All Blocks"),
blocks: [],
subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES
}
];
var ROOT_CONTAINER = `
.is-root-container {
display: flow-root;
}
`;
var STYLE_BOOK_IFRAME_STYLES = `
body {
position: relative;
padding: 32px !important;
}
${ROOT_CONTAINER}
.editor-style-book__examples {
max-width: 1200px;
margin: 0 auto;
}
.editor-style-book__example {
max-width: 900px;
border-radius: 2px;
cursor: pointer;
display: flex;
flex-direction: column;
gap: 40px;
padding: 16px;
width: 100%;
box-sizing: border-box;
scroll-margin-top: 32px;
scroll-margin-bottom: 32px;
margin: 0 auto 40px auto;
}
.editor-style-book__example.is-selected {
box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
}
.editor-style-book__example.is-disabled-example {
pointer-events: none;
}
.editor-style-book__example:focus:not(:disabled) {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline: 3px solid transparent;
}
.editor-style-book__duotone-example > div:first-child {
display: flex;
aspect-ratio: 16 / 9;
grid-row: span 1;
grid-column: span 2;
}
.editor-style-book__duotone-example img {
width: 100%;
height: 100%;
object-fit: cover;
}
.editor-style-book__duotone-example > div:not(:first-child) {
height: 20px;
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
}
.editor-style-book__color-example {
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
}
.editor-style-book__subcategory-title,
.editor-style-book__example-title {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
font-weight: normal;
line-height: normal;
margin: 0;
text-align: left;
padding-top: 8px;
border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
color: color-mix( in srgb, currentColor 60%, transparent );
}
.editor-style-book__subcategory-title {
font-size: 16px;
margin-bottom: 40px;
padding-bottom: 8px;
}
.editor-style-book__example-preview {
width: 100%;
}
.editor-style-book__example-preview .block-editor-block-list__insertion-point,
.editor-style-book__example-preview .block-list-appender {
display: none;
}
:where(.is-root-container > .wp-block:first-child) {
margin-top: 0;
}
:where(.is-root-container > .wp-block:last-child) {
margin-bottom: 0;
}
`;
export {
STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES,
STYLE_BOOK_CATEGORIES,
STYLE_BOOK_COLOR_GROUPS,
STYLE_BOOK_IFRAME_STYLES,
STYLE_BOOK_PREVIEW_CATEGORIES,
STYLE_BOOK_THEME_SUBCATEGORIES
};
//# sourceMappingURL=constants.mjs.map