@wordpress/editor 14.33.3 → 14.34.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/CHANGELOG.md +2 -0
- package/build/components/collab-sidebar/comment-author-info.js +26 -14
- package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build/components/document-bar/index.js +16 -3
- package/build/components/document-bar/index.js.map +2 -2
- package/build/components/editor/index.js +23 -4
- package/build/components/editor/index.js.map +3 -3
- package/build/components/editor-interface/index.js +15 -10
- package/build/components/editor-interface/index.js.map +3 -3
- package/build/components/entities-saved-states/entity-type-list.js +19 -15
- package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
- package/build/components/global-styles/block-link.js +70 -0
- package/build/components/global-styles/block-link.js.map +7 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +7 -0
- package/build/components/global-styles/hooks.js +176 -0
- package/build/components/global-styles/hooks.js.map +7 -0
- package/build/components/global-styles/index.js +138 -0
- package/build/components/global-styles/index.js.map +7 -0
- package/build/components/global-styles/menu.js +95 -0
- package/build/components/global-styles/menu.js.map +7 -0
- package/build/components/global-styles-provider/index.js +3 -49
- package/build/components/global-styles-provider/index.js.map +3 -3
- package/build/components/global-styles-renderer/index.js +55 -0
- package/build/components/global-styles-renderer/index.js.map +7 -0
- package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
- package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build/components/global-styles-sidebar/index.js +182 -0
- package/build/components/global-styles-sidebar/index.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
- package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build/components/header/index.js +12 -9
- package/build/components/header/index.js.map +2 -2
- package/build/components/post-featured-image/index.js +32 -1
- package/build/components/post-featured-image/index.js.map +3 -3
- package/build/components/provider/index.js +0 -2
- package/build/components/provider/index.js.map +3 -3
- package/build/components/style-book/categories.js +86 -0
- package/build/components/style-book/categories.js.map +7 -0
- package/build/components/style-book/color-examples.js +64 -0
- package/build/components/style-book/color-examples.js.map +7 -0
- package/build/components/style-book/constants.js +319 -0
- package/build/components/style-book/constants.js.map +7 -0
- package/build/components/style-book/duotone-examples.js +68 -0
- package/build/components/style-book/duotone-examples.js.map +7 -0
- package/build/components/style-book/examples.js +237 -0
- package/build/components/style-book/examples.js.map +7 -0
- package/build/components/style-book/index.js +627 -0
- package/build/components/style-book/index.js.map +7 -0
- package/build/components/style-book/types.js +17 -0
- package/build/components/style-book/types.js.map +7 -0
- package/build/components/styles-canvas/index.js +138 -0
- package/build/components/styles-canvas/index.js.map +7 -0
- package/build/components/styles-canvas/revisions.js +121 -0
- package/build/components/styles-canvas/revisions.js.map +7 -0
- package/build/components/styles-canvas/style-book.js +68 -0
- package/build/components/styles-canvas/style-book.js.map +7 -0
- package/build/components/visual-editor/index.js +4 -3
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +2 -2
- package/build/hooks/media-upload.js +15 -4
- package/build/hooks/media-upload.js.map +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js +322 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build/hooks/use-global-styles-output.js +74 -0
- package/build/hooks/use-global-styles-output.js.map +7 -0
- package/build/private-apis.js +10 -5
- package/build/private-apis.js.map +3 -3
- package/build/store/private-actions.js +23 -0
- package/build/store/private-actions.js.map +2 -2
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +24 -0
- package/build/store/reducer.js.map +2 -2
- package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
- package/build/utils/set-nested-value.js.map +7 -0
- package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
- package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build-module/components/document-bar/index.js +16 -3
- package/build-module/components/document-bar/index.js.map +2 -2
- package/build-module/components/editor/index.js +23 -4
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/editor-interface/index.js +15 -10
- package/build-module/components/editor-interface/index.js.map +2 -2
- package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
- package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
- package/build-module/components/global-styles/block-link.js +46 -0
- package/build-module/components/global-styles/block-link.js.map +7 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +7 -0
- package/build-module/components/global-styles/hooks.js +154 -0
- package/build-module/components/global-styles/hooks.js.map +7 -0
- package/build-module/components/global-styles/index.js +112 -0
- package/build-module/components/global-styles/index.js.map +7 -0
- package/build-module/components/global-styles/menu.js +71 -0
- package/build-module/components/global-styles/menu.js.map +7 -0
- package/build-module/components/global-styles-provider/index.js +3 -37
- package/build-module/components/global-styles-provider/index.js.map +2 -2
- package/build-module/components/global-styles-renderer/index.js +31 -0
- package/build-module/components/global-styles-renderer/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build-module/components/global-styles-sidebar/index.js +152 -0
- package/build-module/components/global-styles-sidebar/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build-module/components/header/index.js +12 -9
- package/build-module/components/header/index.js.map +2 -2
- package/build-module/components/post-featured-image/index.js +35 -3
- package/build-module/components/post-featured-image/index.js.map +2 -2
- package/build-module/components/provider/index.js +0 -2
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/style-book/categories.js +64 -0
- package/build-module/components/style-book/categories.js.map +7 -0
- package/build-module/components/style-book/color-examples.js +37 -0
- package/build-module/components/style-book/color-examples.js.map +7 -0
- package/build-module/components/style-book/constants.js +290 -0
- package/build-module/components/style-book/constants.js.map +7 -0
- package/build-module/components/style-book/duotone-examples.js +48 -0
- package/build-module/components/style-book/duotone-examples.js.map +7 -0
- package/build-module/components/style-book/examples.js +208 -0
- package/build-module/components/style-book/examples.js.map +7 -0
- package/build-module/components/style-book/index.js +618 -0
- package/build-module/components/style-book/index.js.map +7 -0
- package/build-module/components/style-book/types.js +1 -0
- package/build-module/components/style-book/types.js.map +7 -0
- package/build-module/components/styles-canvas/index.js +104 -0
- package/build-module/components/styles-canvas/index.js.map +7 -0
- package/build-module/components/styles-canvas/revisions.js +107 -0
- package/build-module/components/styles-canvas/revisions.js.map +7 -0
- package/build-module/components/styles-canvas/style-book.js +38 -0
- package/build-module/components/styles-canvas/style-book.js.map +7 -0
- package/build-module/components/visual-editor/index.js +4 -3
- package/build-module/components/visual-editor/index.js.map +2 -2
- package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +2 -2
- package/build-module/hooks/media-upload.js +19 -5
- package/build-module/hooks/media-upload.js.map +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build-module/hooks/use-global-styles-output.js +49 -0
- package/build-module/hooks/use-global-styles-output.js.map +7 -0
- package/build-module/private-apis.js +10 -8
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-actions.js +20 -0
- package/build-module/store/private-actions.js.map +2 -2
- package/build-module/store/private-selectors.js +8 -0
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +22 -0
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/utils/set-nested-value.js +23 -0
- package/build-module/utils/set-nested-value.js.map +7 -0
- package/build-style/style-rtl.css +3017 -11
- package/build-style/style.css +3018 -11
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/editor/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts +1 -3
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/global-styles/block-link.d.ts +12 -0
- package/build-types/components/global-styles/block-link.d.ts.map +1 -0
- package/build-types/components/global-styles/header.d.ts +7 -0
- package/build-types/components/global-styles/header.d.ts.map +1 -0
- package/build-types/components/global-styles/hooks.d.ts +24 -0
- package/build-types/components/global-styles/hooks.d.ts.map +1 -0
- package/build-types/components/global-styles/index.d.ts +6 -0
- package/build-types/components/global-styles/index.d.ts.map +1 -0
- package/build-types/components/global-styles/menu.d.ts +13 -0
- package/build-types/components/global-styles/menu.d.ts.map +1 -0
- package/build-types/components/global-styles-provider/index.d.ts +1 -5
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/global-styles-renderer/index.d.ts +4 -0
- package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +1 -3
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/style-book/categories.d.ts +18 -0
- package/build-types/components/style-book/categories.d.ts.map +1 -0
- package/build-types/components/style-book/color-examples.d.ts +7 -0
- package/build-types/components/style-book/color-examples.d.ts.map +1 -0
- package/build-types/components/style-book/constants.d.ts +11 -0
- package/build-types/components/style-book/constants.d.ts.map +1 -0
- package/build-types/components/style-book/duotone-examples.d.ts +9 -0
- package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
- package/build-types/components/style-book/examples.d.ts +12 -0
- package/build-types/components/style-book/examples.d.ts.map +1 -0
- package/build-types/components/style-book/index.d.ts +31 -0
- package/build-types/components/style-book/index.d.ts.map +1 -0
- package/build-types/components/style-book/types.d.ts +72 -0
- package/build-types/components/style-book/types.d.ts.map +1 -0
- package/build-types/components/styles-canvas/index.d.ts +16 -0
- package/build-types/components/styles-canvas/index.d.ts.map +1 -0
- package/build-types/components/styles-canvas/revisions.d.ts +5 -0
- package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
- package/build-types/components/styles-canvas/style-book.d.ts +6 -0
- package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts +1 -2
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
- package/build-types/hooks/use-global-styles-output.d.ts +18 -0
- package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +20 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +14 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +20 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/set-nested-value.d.ts +20 -0
- package/build-types/utils/set-nested-value.d.ts.map +1 -0
- package/package.json +40 -40
- package/src/components/collab-sidebar/comment-author-info.js +32 -25
- package/src/components/collab-sidebar/style.scss +1 -1
- package/src/components/document-bar/index.js +18 -3
- package/src/components/editor/index.js +25 -1
- package/src/components/editor-help/style.scss +1 -1
- package/src/components/editor-interface/index.js +40 -39
- package/src/components/entities-saved-states/entity-type-list.js +19 -17
- package/src/components/global-styles/block-link.js +65 -0
- package/src/components/global-styles/header.js +48 -0
- package/src/components/global-styles/hooks.js +216 -0
- package/src/components/global-styles/index.js +125 -0
- package/src/components/global-styles/menu.js +101 -0
- package/src/components/global-styles/style.scss +11 -0
- package/src/components/global-styles-provider/index.js +3 -45
- package/src/components/global-styles-renderer/index.js +39 -0
- package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
- package/src/components/global-styles-sidebar/index.js +177 -0
- package/src/components/global-styles-sidebar/style.scss +119 -0
- package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
- package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
- package/src/components/header/index.js +11 -6
- package/src/components/post-featured-image/index.js +44 -1
- package/src/components/post-last-revision/style.scss +1 -1
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/provider/index.js +0 -2
- package/src/components/style-book/categories.ts +97 -0
- package/src/components/style-book/color-examples.tsx +56 -0
- package/src/components/style-book/constants.ts +308 -0
- package/src/components/style-book/duotone-examples.tsx +56 -0
- package/src/components/style-book/examples.tsx +273 -0
- package/src/components/style-book/index.js +794 -0
- package/src/components/style-book/style.scss +44 -0
- package/src/components/style-book/test/categories.js +166 -0
- package/src/components/style-book/types.ts +80 -0
- package/src/components/styles-canvas/index.js +126 -0
- package/src/components/styles-canvas/revisions.js +144 -0
- package/src/components/styles-canvas/style-book.js +57 -0
- package/src/components/styles-canvas/style.scss +40 -0
- package/src/components/visual-editor/index.js +2 -1
- package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/media-upload.js +25 -5
- package/src/hooks/push-changes-to-global-styles/index.js +391 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/hooks/use-global-styles-output.js +76 -0
- package/src/private-apis.js +10 -8
- package/src/store/private-actions.js +37 -0
- package/src/store/private-selectors.js +20 -0
- package/src/store/reducer.js +36 -0
- package/src/style.scss +7 -1
- package/src/utils/set-nested-value.js +39 -0
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +0 -186
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
- package/build/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -161
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
- package/build-module/components/editor-interface/content-slot-fill.js +0 -9
- package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +0 -2
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +0 -1
- package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
- package/src/components/block-settings-menu/content-only-settings-menu.js +0 -185
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +0 -4
- package/src/components/block-settings-menu/style.scss +0 -6
- package/src/components/editor-interface/content-slot-fill.js +0 -10
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
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 categories_exports = {};
|
|
20
|
+
__export(categories_exports, {
|
|
21
|
+
getExamplesByCategory: () => getExamplesByCategory,
|
|
22
|
+
getTopLevelStyleBookCategories: () => getTopLevelStyleBookCategories
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(categories_exports);
|
|
25
|
+
var import_blocks = require("@wordpress/blocks");
|
|
26
|
+
var import_constants = require("./constants");
|
|
27
|
+
function getExamplesByCategory(categoryDefinition, examples) {
|
|
28
|
+
if (!categoryDefinition?.slug || !examples?.length) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const categories = categoryDefinition?.subcategories ?? [];
|
|
32
|
+
if (categories.length) {
|
|
33
|
+
return categories.reduce(
|
|
34
|
+
(acc, subcategoryDefinition) => {
|
|
35
|
+
const subcategoryExamples = getExamplesByCategory(
|
|
36
|
+
subcategoryDefinition,
|
|
37
|
+
examples
|
|
38
|
+
);
|
|
39
|
+
if (subcategoryExamples) {
|
|
40
|
+
if (!acc.subcategories) {
|
|
41
|
+
acc.subcategories = [];
|
|
42
|
+
}
|
|
43
|
+
acc.subcategories = [
|
|
44
|
+
...acc.subcategories,
|
|
45
|
+
subcategoryExamples
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
return acc;
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: categoryDefinition.title,
|
|
52
|
+
slug: categoryDefinition.slug
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const blocksToInclude = categoryDefinition?.blocks || [];
|
|
57
|
+
const blocksToExclude = categoryDefinition?.exclude || [];
|
|
58
|
+
const categoryExamples = examples.filter((example) => {
|
|
59
|
+
return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name));
|
|
60
|
+
});
|
|
61
|
+
if (!categoryExamples.length) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
title: categoryDefinition.title,
|
|
66
|
+
slug: categoryDefinition.slug,
|
|
67
|
+
examples: categoryExamples
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getTopLevelStyleBookCategories() {
|
|
71
|
+
const reservedCategories = [
|
|
72
|
+
...import_constants.STYLE_BOOK_THEME_SUBCATEGORIES,
|
|
73
|
+
...import_constants.STYLE_BOOK_CATEGORIES
|
|
74
|
+
].map(({ slug }) => slug);
|
|
75
|
+
const extraCategories = (0, import_blocks.getCategories)();
|
|
76
|
+
const extraCategoriesFiltered = extraCategories.filter(
|
|
77
|
+
({ slug }) => !reservedCategories.includes(slug)
|
|
78
|
+
);
|
|
79
|
+
return [...import_constants.STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered];
|
|
80
|
+
}
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
getExamplesByCategory,
|
|
84
|
+
getTopLevelStyleBookCategories
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=categories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/style-book/categories.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\n// @wordpress/blocks imports are not typed.\n// @ts-expect-error\nimport { getCategories } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tBlockExample,\n\tStyleBookCategory,\n\tCategoryExamples,\n} from './types';\nimport {\n\tSTYLE_BOOK_CATEGORIES,\n\tSTYLE_BOOK_THEME_SUBCATEGORIES,\n} from './constants';\n\n/**\n * Returns category examples for a given category definition and list of examples.\n * @param {StyleBookCategory} categoryDefinition The category definition.\n * @param {BlockExample[]} examples An array of block examples.\n * @return {CategoryExamples|undefined} An object containing the category examples.\n */\nexport function getExamplesByCategory(\n\tcategoryDefinition: StyleBookCategory,\n\texamples: BlockExample[]\n): CategoryExamples | undefined {\n\tif ( ! categoryDefinition?.slug || ! examples?.length ) {\n\t\treturn;\n\t}\n\tconst categories: CategoryExamples[] =\n\t\tcategoryDefinition?.subcategories ?? [];\n\tif ( categories.length ) {\n\t\treturn categories.reduce(\n\t\t\t( acc, subcategoryDefinition ) => {\n\t\t\t\tconst subcategoryExamples = getExamplesByCategory(\n\t\t\t\t\tsubcategoryDefinition,\n\t\t\t\t\texamples\n\t\t\t\t);\n\t\t\t\tif ( subcategoryExamples ) {\n\t\t\t\t\tif ( ! acc.subcategories ) {\n\t\t\t\t\t\tacc.subcategories = [];\n\t\t\t\t\t}\n\t\t\t\t\tacc.subcategories = [\n\t\t\t\t\t\t...acc.subcategories,\n\t\t\t\t\t\tsubcategoryExamples,\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: categoryDefinition.title,\n\t\t\t\tslug: categoryDefinition.slug,\n\t\t\t}\n\t\t);\n\t}\n\n\tconst blocksToInclude = categoryDefinition?.blocks || [];\n\tconst blocksToExclude = categoryDefinition?.exclude || [];\n\tconst categoryExamples = examples.filter( ( example ) => {\n\t\treturn (\n\t\t\t! blocksToExclude.includes( example.name ) &&\n\t\t\t( example.category === categoryDefinition.slug ||\n\t\t\t\tblocksToInclude.includes( example.name ) )\n\t\t);\n\t} );\n\n\tif ( ! categoryExamples.length ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\ttitle: categoryDefinition.title,\n\t\tslug: categoryDefinition.slug,\n\t\texamples: categoryExamples,\n\t};\n}\n\n/**\n * Returns category examples for a given category definition and list of examples.\n *\n * @return {StyleBookCategory[]} An array of top-level category definitions.\n */\nexport function getTopLevelStyleBookCategories(): StyleBookCategory[] {\n\tconst reservedCategories = [\n\t\t...STYLE_BOOK_THEME_SUBCATEGORIES,\n\t\t...STYLE_BOOK_CATEGORIES,\n\t].map( ( { slug } ) => slug );\n\tconst extraCategories: StyleBookCategory[] = getCategories();\n\tconst extraCategoriesFiltered = extraCategories.filter(\n\t\t( { slug } ) => ! reservedCategories.includes( slug )\n\t);\n\treturn [ ...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered ];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAA8B;AAU9B,uBAGO;AAQA,SAAS,sBACf,oBACA,UAC+B;AAC/B,MAAK,CAAE,oBAAoB,QAAQ,CAAE,UAAU,QAAS;AACvD;AAAA,EACD;AACA,QAAM,aACL,oBAAoB,iBAAiB,CAAC;AACvC,MAAK,WAAW,QAAS;AACxB,WAAO,WAAW;AAAA,MACjB,CAAE,KAAK,0BAA2B;AACjC,cAAM,sBAAsB;AAAA,UAC3B;AAAA,UACA;AAAA,QACD;AACA,YAAK,qBAAsB;AAC1B,cAAK,CAAE,IAAI,eAAgB;AAC1B,gBAAI,gBAAgB,CAAC;AAAA,UACtB;AACA,cAAI,gBAAgB;AAAA,YACnB,GAAG,IAAI;AAAA,YACP;AAAA,UACD;AAAA,QACD;AACA,eAAO;AAAA,MACR;AAAA,MACA;AAAA,QACC,OAAO,mBAAmB;AAAA,QAC1B,MAAM,mBAAmB;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AAEA,QAAM,kBAAkB,oBAAoB,UAAU,CAAC;AACvD,QAAM,kBAAkB,oBAAoB,WAAW,CAAC;AACxD,QAAM,mBAAmB,SAAS,OAAQ,CAAE,YAAa;AACxD,WACC,CAAE,gBAAgB,SAAU,QAAQ,IAAK,MACvC,QAAQ,aAAa,mBAAmB,QACzC,gBAAgB,SAAU,QAAQ,IAAK;AAAA,EAE1C,CAAE;AAEF,MAAK,CAAE,iBAAiB,QAAS;AAChC;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO,mBAAmB;AAAA,IAC1B,MAAM,mBAAmB;AAAA,IACzB,UAAU;AAAA,EACX;AACD;AAOO,SAAS,iCAAsD;AACrE,QAAM,qBAAqB;AAAA,IAC1B,GAAG;AAAA,IACH,GAAG;AAAA,EACJ,EAAE,IAAK,CAAE,EAAE,KAAK,MAAO,IAAK;AAC5B,QAAM,sBAAuC,6BAAc;AAC3D,QAAM,0BAA0B,gBAAgB;AAAA,IAC/C,CAAE,EAAE,KAAK,MAAO,CAAE,mBAAmB,SAAU,IAAK;AAAA,EACrD;AACA,SAAO,CAAE,GAAG,wCAAuB,GAAG,uBAAwB;AAC/D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var color_examples_exports = {};
|
|
30
|
+
__export(color_examples_exports, {
|
|
31
|
+
default: () => color_examples_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(color_examples_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
36
|
+
var import_components = require("@wordpress/components");
|
|
37
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
38
|
+
const ColorExamples = ({
|
|
39
|
+
colors,
|
|
40
|
+
type,
|
|
41
|
+
templateColumns = "1fr 1fr",
|
|
42
|
+
itemHeight = "52px"
|
|
43
|
+
}) => {
|
|
44
|
+
if (!colors) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => {
|
|
48
|
+
const className = type === "gradients" ? (0, import_block_editor.__experimentalGetGradientClass)(color.slug) : (0, import_block_editor.getColorClassName)("background-color", color.slug);
|
|
49
|
+
const classes = (0, import_clsx.default)(
|
|
50
|
+
"editor-style-book__color-example",
|
|
51
|
+
className
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: classes,
|
|
57
|
+
style: { height: itemHeight }
|
|
58
|
+
},
|
|
59
|
+
color.slug
|
|
60
|
+
);
|
|
61
|
+
}) });
|
|
62
|
+
};
|
|
63
|
+
var color_examples_default = ColorExamples;
|
|
64
|
+
//# sourceMappingURL=color-examples.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/style-book/color-examples.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport {\n\tgetColorClassName,\n\t__experimentalGetGradientClass,\n\t// @wordpress/block-editor imports are not typed.\n\t// @ts-expect-error\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport type { Color, Gradient, ColorExampleProps } from './types';\n\nconst ColorExamples = ( {\n\tcolors,\n\ttype,\n\ttemplateColumns = '1fr 1fr',\n\titemHeight = '52px',\n}: ColorExampleProps ): JSX.Element | null => {\n\tif ( ! colors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Grid templateColumns={ templateColumns } rowGap={ 8 } columnGap={ 16 }>\n\t\t\t{ colors.map( ( color: Color | Gradient ) => {\n\t\t\t\tconst className =\n\t\t\t\t\ttype === 'gradients'\n\t\t\t\t\t\t? __experimentalGetGradientClass( color.slug )\n\t\t\t\t\t\t: getColorClassName( 'background-color', color.slug );\n\t\t\t\tconst classes = clsx(\n\t\t\t\t\t'editor-style-book__color-example',\n\t\t\t\t\tclassName\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ color.slug }\n\t\t\t\t\t\tclassName={ classes }\n\t\t\t\t\t\tstyle={ { height: itemHeight } }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Grid>\n\t);\n};\n\nexport default ColorExamples;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CK;AAzCL,kBAAiB;AAKjB,wBAA2C;AAC3C,0BAKO;AAOP,MAAM,gBAAgB,CAAE;AAAA,EACvB;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,aAAa;AACd,MAA8C;AAC7C,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,kBAAAA,oBAAA,EAAK,iBAAoC,QAAS,GAAI,WAAY,IAChE,iBAAO,IAAK,CAAE,UAA6B;AAC5C,UAAM,YACL,SAAS,kBACN,oDAAgC,MAAM,IAAK,QAC3C,uCAAmB,oBAAoB,MAAM,IAAK;AACtD,UAAM,cAAU,YAAAC;AAAA,MACf;AAAA,MACA;AAAA,IACD;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QAEA,WAAY;AAAA,QACZ,OAAQ,EAAE,QAAQ,WAAW;AAAA;AAAA,MAFvB,MAAM;AAAA,IAGb;AAAA,EAEF,CAAE,GACH;AAEF;AAEA,IAAO,yBAAQ;",
|
|
6
|
+
"names": ["Grid", "clsx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
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 constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES: () => STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES,
|
|
22
|
+
STYLE_BOOK_CATEGORIES: () => STYLE_BOOK_CATEGORIES,
|
|
23
|
+
STYLE_BOOK_COLOR_GROUPS: () => STYLE_BOOK_COLOR_GROUPS,
|
|
24
|
+
STYLE_BOOK_IFRAME_STYLES: () => STYLE_BOOK_IFRAME_STYLES,
|
|
25
|
+
STYLE_BOOK_PREVIEW_CATEGORIES: () => STYLE_BOOK_PREVIEW_CATEGORIES,
|
|
26
|
+
STYLE_BOOK_THEME_SUBCATEGORIES: () => STYLE_BOOK_THEME_SUBCATEGORIES
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
29
|
+
var import_i18n = require("@wordpress/i18n");
|
|
30
|
+
const STYLE_BOOK_COLOR_GROUPS = [
|
|
31
|
+
{
|
|
32
|
+
slug: "theme-colors",
|
|
33
|
+
title: (0, import_i18n.__)("Theme Colors"),
|
|
34
|
+
origin: "theme",
|
|
35
|
+
type: "colors"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
slug: "theme-gradients",
|
|
39
|
+
title: (0, import_i18n.__)("Theme Gradients"),
|
|
40
|
+
origin: "theme",
|
|
41
|
+
type: "gradients"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
slug: "custom-colors",
|
|
45
|
+
title: (0, import_i18n.__)("Custom Colors"),
|
|
46
|
+
origin: "custom",
|
|
47
|
+
type: "colors"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
slug: "custom-gradients",
|
|
51
|
+
title: (0, import_i18n.__)("Custom Gradients"),
|
|
52
|
+
origin: "custom",
|
|
53
|
+
// User.
|
|
54
|
+
type: "gradients"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
slug: "duotones",
|
|
58
|
+
title: (0, import_i18n.__)("Duotones"),
|
|
59
|
+
origin: "theme",
|
|
60
|
+
type: "duotones"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
slug: "default-colors",
|
|
64
|
+
title: (0, import_i18n.__)("Default Colors"),
|
|
65
|
+
origin: "default",
|
|
66
|
+
type: "colors"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
slug: "default-gradients",
|
|
70
|
+
title: (0, import_i18n.__)("Default Gradients"),
|
|
71
|
+
origin: "default",
|
|
72
|
+
type: "gradients"
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
const STYLE_BOOK_THEME_SUBCATEGORIES = [
|
|
76
|
+
{
|
|
77
|
+
slug: "site-identity",
|
|
78
|
+
title: (0, import_i18n.__)("Site Identity"),
|
|
79
|
+
blocks: ["core/site-logo", "core/site-title", "core/site-tagline"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
slug: "design",
|
|
83
|
+
title: (0, import_i18n.__)("Design"),
|
|
84
|
+
blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"],
|
|
85
|
+
exclude: ["core/home-link", "core/navigation-link"]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
slug: "posts",
|
|
89
|
+
title: (0, import_i18n.__)("Posts"),
|
|
90
|
+
blocks: [
|
|
91
|
+
"core/post-title",
|
|
92
|
+
"core/post-excerpt",
|
|
93
|
+
"core/post-author",
|
|
94
|
+
"core/post-author-name",
|
|
95
|
+
"core/post-author-biography",
|
|
96
|
+
"core/post-date",
|
|
97
|
+
"core/post-terms",
|
|
98
|
+
"core/term-description",
|
|
99
|
+
"core/query-title",
|
|
100
|
+
"core/query-no-results",
|
|
101
|
+
"core/query-pagination",
|
|
102
|
+
"core/query-numbers"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
slug: "comments",
|
|
107
|
+
title: (0, import_i18n.__)("Comments"),
|
|
108
|
+
blocks: [
|
|
109
|
+
"core/comments-title",
|
|
110
|
+
"core/comments-pagination",
|
|
111
|
+
"core/comments-pagination-numbers",
|
|
112
|
+
"core/comments",
|
|
113
|
+
"core/comments-author-name",
|
|
114
|
+
"core/comment-content",
|
|
115
|
+
"core/comment-date",
|
|
116
|
+
"core/comment-edit-link",
|
|
117
|
+
"core/comment-reply-link",
|
|
118
|
+
"core/comment-template",
|
|
119
|
+
"core/post-comments-count",
|
|
120
|
+
"core/post-comments-link"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
const STYLE_BOOK_CATEGORIES = [
|
|
125
|
+
{
|
|
126
|
+
slug: "overview",
|
|
127
|
+
title: (0, import_i18n.__)("Overview"),
|
|
128
|
+
blocks: []
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
slug: "text",
|
|
132
|
+
title: (0, import_i18n.__)("Text"),
|
|
133
|
+
blocks: [
|
|
134
|
+
"core/post-content",
|
|
135
|
+
"core/home-link",
|
|
136
|
+
"core/navigation-link"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
slug: "colors",
|
|
141
|
+
title: (0, import_i18n.__)("Colors"),
|
|
142
|
+
blocks: []
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
slug: "theme",
|
|
146
|
+
title: (0, import_i18n.__)("Theme"),
|
|
147
|
+
subcategories: STYLE_BOOK_THEME_SUBCATEGORIES
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
slug: "media",
|
|
151
|
+
title: (0, import_i18n.__)("Media"),
|
|
152
|
+
blocks: ["core/post-featured-image"]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
slug: "widgets",
|
|
156
|
+
title: (0, import_i18n.__)("Widgets"),
|
|
157
|
+
blocks: []
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
slug: "embed",
|
|
161
|
+
title: (0, import_i18n.__)("Embeds"),
|
|
162
|
+
include: []
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [
|
|
166
|
+
...STYLE_BOOK_THEME_SUBCATEGORIES,
|
|
167
|
+
{
|
|
168
|
+
slug: "media",
|
|
169
|
+
title: (0, import_i18n.__)("Media"),
|
|
170
|
+
blocks: ["core/post-featured-image"]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
slug: "widgets",
|
|
174
|
+
title: (0, import_i18n.__)("Widgets"),
|
|
175
|
+
blocks: []
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
slug: "embed",
|
|
179
|
+
title: (0, import_i18n.__)("Embeds"),
|
|
180
|
+
include: []
|
|
181
|
+
}
|
|
182
|
+
];
|
|
183
|
+
const STYLE_BOOK_PREVIEW_CATEGORIES = [
|
|
184
|
+
{
|
|
185
|
+
slug: "overview",
|
|
186
|
+
title: (0, import_i18n.__)("Overview"),
|
|
187
|
+
blocks: []
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
slug: "text",
|
|
191
|
+
title: (0, import_i18n.__)("Text"),
|
|
192
|
+
blocks: [
|
|
193
|
+
"core/post-content",
|
|
194
|
+
"core/home-link",
|
|
195
|
+
"core/navigation-link"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
slug: "colors",
|
|
200
|
+
title: (0, import_i18n.__)("Colors"),
|
|
201
|
+
blocks: []
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
slug: "blocks",
|
|
205
|
+
title: (0, import_i18n.__)("All Blocks"),
|
|
206
|
+
blocks: [],
|
|
207
|
+
subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES
|
|
208
|
+
}
|
|
209
|
+
];
|
|
210
|
+
const ROOT_CONTAINER = `
|
|
211
|
+
.is-root-container {
|
|
212
|
+
display: flow-root;
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
const STYLE_BOOK_IFRAME_STYLES = `
|
|
216
|
+
body {
|
|
217
|
+
position: relative;
|
|
218
|
+
padding: 32px !important;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
${ROOT_CONTAINER}
|
|
222
|
+
|
|
223
|
+
.editor-style-book__examples {
|
|
224
|
+
max-width: 1200px;
|
|
225
|
+
margin: 0 auto;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.editor-style-book__example {
|
|
229
|
+
max-width: 900px;
|
|
230
|
+
border-radius: 2px;
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
gap: 40px;
|
|
235
|
+
padding: 16px;
|
|
236
|
+
width: 100%;
|
|
237
|
+
box-sizing: border-box;
|
|
238
|
+
scroll-margin-top: 32px;
|
|
239
|
+
scroll-margin-bottom: 32px;
|
|
240
|
+
margin: 0 auto 40px auto;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.editor-style-book__example.is-selected {
|
|
244
|
+
box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.editor-style-book__example.is-disabled-example {
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.editor-style-book__example:focus:not(:disabled) {
|
|
252
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
253
|
+
outline: 3px solid transparent;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.editor-style-book__duotone-example > div:first-child {
|
|
257
|
+
display: flex;
|
|
258
|
+
aspect-ratio: 16 / 9;
|
|
259
|
+
grid-row: span 1;
|
|
260
|
+
grid-column: span 2;
|
|
261
|
+
}
|
|
262
|
+
.editor-style-book__duotone-example img {
|
|
263
|
+
width: 100%;
|
|
264
|
+
height: 100%;
|
|
265
|
+
object-fit: cover;
|
|
266
|
+
}
|
|
267
|
+
.editor-style-book__duotone-example > div:not(:first-child) {
|
|
268
|
+
height: 20px;
|
|
269
|
+
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.editor-style-book__color-example {
|
|
273
|
+
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.editor-style-book__subcategory-title,
|
|
277
|
+
.editor-style-book__example-title {
|
|
278
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
279
|
+
font-size: 13px;
|
|
280
|
+
font-weight: normal;
|
|
281
|
+
line-height: normal;
|
|
282
|
+
margin: 0;
|
|
283
|
+
text-align: left;
|
|
284
|
+
padding-top: 8px;
|
|
285
|
+
border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
|
|
286
|
+
color: color-mix( in srgb, currentColor 60%, transparent );
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.editor-style-book__subcategory-title {
|
|
290
|
+
font-size: 16px;
|
|
291
|
+
margin-bottom: 40px;
|
|
292
|
+
padding-bottom: 8px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.editor-style-book__example-preview {
|
|
296
|
+
width: 100%;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.editor-style-book__example-preview .block-editor-block-list__insertion-point,
|
|
300
|
+
.editor-style-book__example-preview .block-list-appender {
|
|
301
|
+
display: none;
|
|
302
|
+
}
|
|
303
|
+
:where(.is-root-container > .wp-block:first-child) {
|
|
304
|
+
margin-top: 0;
|
|
305
|
+
}
|
|
306
|
+
:where(.is-root-container > .wp-block:last-child) {
|
|
307
|
+
margin-bottom: 0;
|
|
308
|
+
}
|
|
309
|
+
`;
|
|
310
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
311
|
+
0 && (module.exports = {
|
|
312
|
+
STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES,
|
|
313
|
+
STYLE_BOOK_CATEGORIES,
|
|
314
|
+
STYLE_BOOK_COLOR_GROUPS,
|
|
315
|
+
STYLE_BOOK_IFRAME_STYLES,
|
|
316
|
+
STYLE_BOOK_PREVIEW_CATEGORIES,
|
|
317
|
+
STYLE_BOOK_THEME_SUBCATEGORIES
|
|
318
|
+
});
|
|
319
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/style-book/constants.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { StyleBookCategory, StyleBookColorGroup } from './types';\n\nexport const STYLE_BOOK_COLOR_GROUPS: StyleBookColorGroup[] = [\n\t{\n\t\tslug: 'theme-colors',\n\t\ttitle: __( 'Theme Colors' ),\n\t\torigin: 'theme',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'theme-gradients',\n\t\ttitle: __( 'Theme Gradients' ),\n\t\torigin: 'theme',\n\t\ttype: 'gradients',\n\t},\n\t{\n\t\tslug: 'custom-colors',\n\t\ttitle: __( 'Custom Colors' ),\n\t\torigin: 'custom',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'custom-gradients',\n\t\ttitle: __( 'Custom Gradients' ),\n\t\torigin: 'custom', // User.\n\t\ttype: 'gradients',\n\t},\n\t{\n\t\tslug: 'duotones',\n\t\ttitle: __( 'Duotones' ),\n\t\torigin: 'theme',\n\t\ttype: 'duotones',\n\t},\n\t{\n\t\tslug: 'default-colors',\n\t\ttitle: __( 'Default Colors' ),\n\t\torigin: 'default',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'default-gradients',\n\t\ttitle: __( 'Default Gradients' ),\n\t\torigin: 'default',\n\t\ttype: 'gradients',\n\t},\n];\n\nexport const STYLE_BOOK_THEME_SUBCATEGORIES: Omit<\n\tStyleBookCategory,\n\t'subcategories'\n>[] = [\n\t{\n\t\tslug: 'site-identity',\n\t\ttitle: __( 'Site Identity' ),\n\t\tblocks: [ 'core/site-logo', 'core/site-title', 'core/site-tagline' ],\n\t},\n\t{\n\t\tslug: 'design',\n\t\ttitle: __( 'Design' ),\n\t\tblocks: [ 'core/navigation', 'core/avatar', 'core/post-time-to-read' ],\n\t\texclude: [ 'core/home-link', 'core/navigation-link' ],\n\t},\n\t{\n\t\tslug: 'posts',\n\t\ttitle: __( 'Posts' ),\n\t\tblocks: [\n\t\t\t'core/post-title',\n\t\t\t'core/post-excerpt',\n\t\t\t'core/post-author',\n\t\t\t'core/post-author-name',\n\t\t\t'core/post-author-biography',\n\t\t\t'core/post-date',\n\t\t\t'core/post-terms',\n\t\t\t'core/term-description',\n\t\t\t'core/query-title',\n\t\t\t'core/query-no-results',\n\t\t\t'core/query-pagination',\n\t\t\t'core/query-numbers',\n\t\t],\n\t},\n\t{\n\t\tslug: 'comments',\n\t\ttitle: __( 'Comments' ),\n\t\tblocks: [\n\t\t\t'core/comments-title',\n\t\t\t'core/comments-pagination',\n\t\t\t'core/comments-pagination-numbers',\n\t\t\t'core/comments',\n\t\t\t'core/comments-author-name',\n\t\t\t'core/comment-content',\n\t\t\t'core/comment-date',\n\t\t\t'core/comment-edit-link',\n\t\t\t'core/comment-reply-link',\n\t\t\t'core/comment-template',\n\t\t\t'core/post-comments-count',\n\t\t\t'core/post-comments-link',\n\t\t],\n\t},\n];\n\nexport const STYLE_BOOK_CATEGORIES: StyleBookCategory[] = [\n\t{\n\t\tslug: 'overview',\n\t\ttitle: __( 'Overview' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'text',\n\t\ttitle: __( 'Text' ),\n\t\tblocks: [\n\t\t\t'core/post-content',\n\t\t\t'core/home-link',\n\t\t\t'core/navigation-link',\n\t\t],\n\t},\n\t{\n\t\tslug: 'colors',\n\t\ttitle: __( 'Colors' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'theme',\n\t\ttitle: __( 'Theme' ),\n\t\tsubcategories: STYLE_BOOK_THEME_SUBCATEGORIES,\n\t},\n\t{\n\t\tslug: 'media',\n\t\ttitle: __( 'Media' ),\n\t\tblocks: [ 'core/post-featured-image' ],\n\t},\n\t{\n\t\tslug: 'widgets',\n\t\ttitle: __( 'Widgets' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'embed',\n\t\ttitle: __( 'Embeds' ),\n\t\tinclude: [],\n\t},\n];\n\n// Style book preview subcategories for all blocks section.\nexport const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES: StyleBookCategory[] = [\n\t...STYLE_BOOK_THEME_SUBCATEGORIES,\n\t{\n\t\tslug: 'media',\n\t\ttitle: __( 'Media' ),\n\t\tblocks: [ 'core/post-featured-image' ],\n\t},\n\t{\n\t\tslug: 'widgets',\n\t\ttitle: __( 'Widgets' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'embed',\n\t\ttitle: __( 'Embeds' ),\n\t\tinclude: [],\n\t},\n];\n\n// Style book preview categories are organized slightly differently to the editor ones.\nexport const STYLE_BOOK_PREVIEW_CATEGORIES: StyleBookCategory[] = [\n\t{\n\t\tslug: 'overview',\n\t\ttitle: __( 'Overview' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'text',\n\t\ttitle: __( 'Text' ),\n\t\tblocks: [\n\t\t\t'core/post-content',\n\t\t\t'core/home-link',\n\t\t\t'core/navigation-link',\n\t\t],\n\t},\n\t{\n\t\tslug: 'colors',\n\t\ttitle: __( 'Colors' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'blocks',\n\t\ttitle: __( 'All Blocks' ),\n\t\tblocks: [],\n\t\tsubcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES,\n\t},\n];\n\n// Forming a \"block formatting context\" to prevent margin collapsing.\n// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\nconst ROOT_CONTAINER = `\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n`;\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.editor-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nexport const STYLE_BOOK_IFRAME_STYLES = `\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t${ ROOT_CONTAINER }\n\n\t.editor-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.editor-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t\tmargin: 0 auto 40px auto;\n\t}\n\n\t.editor-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.editor-style-book__example.is-disabled-example {\n\t\tpointer-events: none;\n\t}\n\n\t.editor-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.editor-style-book__duotone-example > div:first-child {\n\t\tdisplay: flex;\n\t\taspect-ratio: 16 / 9;\n\t\tgrid-row: span 1;\n\t\tgrid-column: span 2;\n\t}\n\t.editor-style-book__duotone-example img {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tobject-fit: cover;\n\t}\n\t.editor-style-book__duotone-example > div:not(:first-child) {\n\t\theight: 20px;\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.editor-style-book__color-example {\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.editor-style-book__subcategory-title,\n\t.editor-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 13px;\n\t\tfont-weight: normal;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tpadding-top: 8px;\n\t\tborder-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t\tcolor: color-mix( in srgb, currentColor 60%, transparent );\n\t}\n\n\t.editor-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tpadding-bottom: 8px;\n\t}\n\n\t.editor-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.editor-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.editor-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\t:where(.is-root-container > .wp-block:first-child) {\n\t\tmargin-top: 0;\n\t}\n\t:where(.is-root-container > .wp-block:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n`;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAOZ,MAAM,0BAAiD;AAAA,EAC7D;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,cAAe;AAAA,IAC1B,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,iBAAkB;AAAA,IAC7B,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,eAAgB;AAAA,IAC3B,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,kBAAmB;AAAA,IAC9B,QAAQ;AAAA;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,UAAW;AAAA,IACtB,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,gBAAiB;AAAA,IAC5B,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,mBAAoB;AAAA,IAC/B,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AACD;AAEO,MAAM,iCAGP;AAAA,EACL;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,eAAgB;AAAA,IAC3B,QAAQ,CAAE,kBAAkB,mBAAmB,mBAAoB;AAAA,EACpE;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,IACpB,QAAQ,CAAE,mBAAmB,eAAe,wBAAyB;AAAA,IACrE,SAAS,CAAE,kBAAkB,sBAAuB;AAAA,EACrD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,QAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,UAAW;AAAA,IACtB,QAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,wBAA6C;AAAA,EACzD;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,UAAW;AAAA,IACtB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,MAAO;AAAA,IAClB,QAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,IACpB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,eAAe;AAAA,EAChB;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,QAAQ,CAAE,0BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,SAAU;AAAA,IACrB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,IACpB,SAAS,CAAC;AAAA,EACX;AACD;AAGO,MAAM,sCAA2D;AAAA,EACvE,GAAG;AAAA,EACH;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,QAAQ,CAAE,0BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,SAAU;AAAA,IACrB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,IACpB,SAAS,CAAC;AAAA,EACX;AACD;AAGO,MAAM,gCAAqD;AAAA,EACjE;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,UAAW;AAAA,IACtB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,MAAO;AAAA,IAClB,QAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,IACpB,QAAQ,CAAC;AAAA,EACV;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,YAAa;AAAA,IACxB,QAAQ,CAAC;AAAA,IACT,eAAe;AAAA,EAChB;AACD;AAIA,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAYhB,MAAM,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAMpC,cAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
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 duotone_examples_exports = {};
|
|
20
|
+
__export(duotone_examples_exports, {
|
|
21
|
+
default: () => duotone_examples_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(duotone_examples_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_components = require("@wordpress/components");
|
|
26
|
+
const DuotoneExamples = ({
|
|
27
|
+
duotones
|
|
28
|
+
}) => {
|
|
29
|
+
if (!duotones) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => {
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
34
|
+
import_components.__experimentalGrid,
|
|
35
|
+
{
|
|
36
|
+
className: "editor-style-book__duotone-example",
|
|
37
|
+
columns: 2,
|
|
38
|
+
rowGap: 8,
|
|
39
|
+
columnGap: 8,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
42
|
+
"img",
|
|
43
|
+
{
|
|
44
|
+
alt: `Duotone example: ${duotone.slug}`,
|
|
45
|
+
src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg",
|
|
46
|
+
style: {
|
|
47
|
+
filter: `url(#wp-duotone-${duotone.slug})`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
duotone.colors.map((color) => {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "editor-style-book__color-example",
|
|
56
|
+
style: { backgroundColor: color }
|
|
57
|
+
},
|
|
58
|
+
color
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
duotone.slug
|
|
64
|
+
);
|
|
65
|
+
}) });
|
|
66
|
+
};
|
|
67
|
+
var duotone_examples_default = DuotoneExamples;
|
|
68
|
+
//# sourceMappingURL=duotone-examples.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/style-book/duotone-examples.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalGrid as Grid } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { Duotone } from './types';\n\nconst DuotoneExamples = ( {\n\tduotones,\n}: {\n\tduotones: Duotone[];\n} ): JSX.Element | null => {\n\tif ( ! duotones ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Grid columns={ 2 } rowGap={ 16 } columnGap={ 16 }>\n\t\t\t{ duotones.map( ( duotone: Duotone ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tkey={ duotone.slug }\n\t\t\t\t\t\tclassName=\"editor-style-book__duotone-example\"\n\t\t\t\t\t\tcolumns={ 2 }\n\t\t\t\t\t\trowGap={ 8 }\n\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\talt={ `Duotone example: ${ duotone.slug }` }\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/core/5.3/MtBlanc1.jpg\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfilter: `url(#wp-duotone-${ duotone.slug })`,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{ duotone.colors.map( ( color ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ color }\n\t\t\t\t\t\t\t\t\tclassName=\"editor-style-book__color-example\"\n\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: color } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Grid>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Grid>\n\t);\n};\n\nexport default DuotoneExamples;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBK;AApBL,wBAA2C;AAO3C,MAAM,kBAAkB,CAAE;AAAA,EACzB;AACD,MAE2B;AAC1B,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,kBAAAA,oBAAA,EAAK,SAAU,GAAI,QAAS,IAAK,WAAY,IAC3C,mBAAS,IAAK,CAAE,YAAsB;AACvC,WACC;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QAEA,WAAU;AAAA,QACV,SAAU;AAAA,QACV,QAAS;AAAA,QACT,WAAY;AAAA,QAEZ;AAAA,sDAAC,SACA;AAAA,YAAC;AAAA;AAAA,cACA,KAAM,oBAAqB,QAAQ,IAAK;AAAA,cACxC,KAAI;AAAA,cACJ,OAAQ;AAAA,gBACP,QAAQ,mBAAoB,QAAQ,IAAK;AAAA,cAC1C;AAAA;AAAA,UACD,GACD;AAAA,UACE,QAAQ,OAAO,IAAK,CAAE,UAAW;AAClC,mBACC;AAAA,cAAC;AAAA;AAAA,gBAEA,WAAU;AAAA,gBACV,OAAQ,EAAE,iBAAiB,MAAM;AAAA;AAAA,cAF3B;AAAA,YAGP;AAAA,UAEF,CAAE;AAAA;AAAA;AAAA,MAvBI,QAAQ;AAAA,IAwBf;AAAA,EAEF,CAAE,GACH;AAEF;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["Grid"]
|
|
7
|
+
}
|