@wordpress/block-editor 15.6.1-next.36001005c.0 → 15.7.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/block-list/block.js +3 -3
- package/build/components/block-list/block.js.map +2 -2
- package/build/components/block-list/index.js +2 -2
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-toolbar/switch-section-style.js +2 -5
- package/build/components/block-toolbar/switch-section-style.js.map +2 -2
- package/build/components/global-styles/hooks.js +0 -107
- package/build/components/global-styles/hooks.js.map +3 -3
- package/build/components/global-styles/index.js +0 -15
- package/build/components/global-styles/index.js.map +2 -2
- package/build/components/global-styles/typography-panel.js +18 -1
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/global-styles/utils.js +0 -19
- package/build/components/global-styles/utils.js.map +3 -3
- package/build/components/inserter/media-tab/media-tab.js +33 -1
- package/build/components/inserter/media-tab/media-tab.js.map +3 -3
- package/build/components/inserter/tips.js +0 -2
- package/build/components/inserter/tips.js.map +2 -2
- package/build/components/media-placeholder/index.js +31 -1
- package/build/components/media-placeholder/index.js.map +3 -3
- package/build/components/media-replace-flow/index.js +29 -1
- package/build/components/media-replace-flow/index.js.map +3 -3
- package/build/components/{global-styles/context.js → media-upload-modal/index.js} +8 -23
- package/build/components/media-upload-modal/index.js.map +7 -0
- package/build/components/rich-text/index.js +8 -7
- package/build/components/rich-text/index.js.map +2 -2
- package/build/hooks/allowed-blocks.js +3 -8
- package/build/hooks/allowed-blocks.js.map +3 -3
- package/build/hooks/block-bindings.js +111 -170
- package/build/hooks/block-bindings.js.map +2 -2
- package/build/hooks/block-style-variation.js +4 -13
- package/build/hooks/block-style-variation.js.map +2 -2
- package/build/hooks/custom-class-name.js +1 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/fit-text.js +33 -20
- package/build/hooks/fit-text.js.map +2 -2
- package/build/hooks/font-size.js +4 -3
- package/build/hooks/font-size.js.map +2 -2
- package/build/hooks/metadata.js +48 -2
- package/build/hooks/metadata.js.map +2 -2
- package/build/hooks/typography.js +11 -4
- package/build/hooks/typography.js.map +3 -3
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +3 -3
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/selectors.js +38 -13
- package/build/store/selectors.js.map +2 -2
- package/build/store/utils.js +2 -1
- package/build/store/utils.js.map +2 -2
- package/build/utils/fit-text-utils.js +4 -4
- package/build/utils/fit-text-utils.js.map +2 -2
- package/build-module/components/block-list/block.js +3 -3
- package/build-module/components/block-list/block.js.map +2 -2
- package/build-module/components/block-list/index.js +2 -2
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-toolbar/switch-section-style.js +2 -5
- package/build-module/components/block-toolbar/switch-section-style.js.map +2 -2
- package/build-module/components/global-styles/hooks.js +1 -99
- package/build-module/components/global-styles/hooks.js.map +2 -2
- package/build-module/components/global-styles/index.js +1 -15
- package/build-module/components/global-styles/index.js.map +2 -2
- package/build-module/components/global-styles/typography-panel.js +18 -1
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/global-styles/utils.js +0 -8
- package/build-module/components/global-styles/utils.js.map +2 -2
- package/build-module/components/inserter/media-tab/media-tab.js +34 -2
- package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
- package/build-module/components/inserter/tips.js +0 -2
- package/build-module/components/inserter/tips.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +31 -1
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-replace-flow/index.js +29 -1
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/media-upload-modal/index.js +7 -0
- package/build-module/components/media-upload-modal/index.js.map +7 -0
- package/build-module/components/rich-text/index.js +8 -7
- package/build-module/components/rich-text/index.js.map +2 -2
- package/build-module/hooks/allowed-blocks.js +3 -8
- package/build-module/hooks/allowed-blocks.js.map +2 -2
- package/build-module/hooks/block-bindings.js +112 -172
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/block-style-variation.js +5 -14
- package/build-module/hooks/block-style-variation.js.map +2 -2
- package/build-module/hooks/custom-class-name.js +1 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/fit-text.js +34 -21
- package/build-module/hooks/fit-text.js.map +2 -2
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +2 -2
- package/build-module/hooks/metadata.js +46 -1
- package/build-module/hooks/metadata.js.map +2 -2
- package/build-module/hooks/typography.js +11 -4
- package/build-module/hooks/typography.js.map +3 -3
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/selectors.js +39 -14
- package/build-module/store/selectors.js.map +2 -2
- package/build-module/store/utils.js +3 -2
- package/build-module/store/utils.js.map +2 -2
- package/build-module/utils/fit-text-utils.js +4 -4
- package/build-module/utils/fit-text-utils.js.map +2 -2
- package/package.json +36 -36
- package/src/components/block-list/block.js +1 -1
- package/src/components/block-list/index.js +2 -2
- package/src/components/block-toolbar/switch-section-style.js +2 -5
- package/src/components/global-styles/hooks.js +1 -121
- package/src/components/global-styles/index.js +1 -9
- package/src/components/global-styles/typography-panel.js +26 -1
- package/src/components/global-styles/utils.js +0 -31
- package/src/components/inserter/media-tab/media-tab.js +44 -2
- package/src/components/inserter/tips.js +0 -2
- package/src/components/media-placeholder/index.js +41 -1
- package/src/components/media-replace-flow/index.js +39 -1
- package/src/components/media-upload-modal/index.js +18 -0
- package/src/components/rich-text/index.js +8 -14
- package/src/hooks/allowed-blocks.js +3 -11
- package/src/hooks/block-bindings.js +79 -153
- package/src/hooks/block-style-variation.js +5 -17
- package/src/hooks/custom-class-name.js +1 -1
- package/src/hooks/fit-text.js +39 -30
- package/src/hooks/font-size.js +7 -3
- package/src/hooks/metadata.js +89 -0
- package/src/hooks/test/metadata.js +316 -0
- package/src/hooks/typography.js +15 -4
- package/src/private-apis.js +2 -0
- package/src/store/private-selectors.js +2 -2
- package/src/store/selectors.js +59 -21
- package/src/store/test/selectors.js +1 -1
- package/src/store/utils.js +2 -1
- package/src/utils/fit-text-utils.js +4 -16
- package/tsconfig.json +1 -0
- package/build/components/global-styles/context.js.map +0 -7
- package/build/components/global-styles/get-global-styles-changes.js +0 -216
- package/build/components/global-styles/get-global-styles-changes.js.map +0 -7
- package/build-module/components/global-styles/context.js +0 -17
- package/build-module/components/global-styles/context.js.map +0 -7
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -182
- package/build-module/components/global-styles/get-global-styles-changes.js.map +0 -7
- package/src/components/global-styles/README.md +0 -190
- package/src/components/global-styles/context.js +0 -16
- package/src/components/global-styles/get-global-styles-changes.js +0 -252
- package/src/components/global-styles/test/get-global-styles-changes.js +0 -290
- package/src/components/global-styles/test/utils.js +0 -58
package/src/store/selectors.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
isSectionBlock,
|
|
44
44
|
getParentSectionBlock,
|
|
45
45
|
isZoomOut,
|
|
46
|
-
|
|
46
|
+
isContainerInsertableToInContentOnlyMode,
|
|
47
47
|
} from './private-selectors';
|
|
48
48
|
|
|
49
49
|
const { isContentBlock } = unlock( blocksPrivateApis );
|
|
@@ -1682,15 +1682,7 @@ const canInsertBlockTypeUnmemoized = (
|
|
|
1682
1682
|
blockType = getBlockType( blockName );
|
|
1683
1683
|
}
|
|
1684
1684
|
|
|
1685
|
-
|
|
1686
|
-
if ( isLocked ) {
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
const isContentRoleBlock = isContentBlock( blockName );
|
|
1690
|
-
const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
|
|
1691
|
-
// It shouldn't be possible to insert inside a section block unless in
|
|
1692
|
-
// some cases when the block is a content block.
|
|
1693
|
-
if ( isParentSectionBlock && ! isContentRoleBlock ) {
|
|
1685
|
+
if ( getTemplateLock( state, rootClientId ) ) {
|
|
1694
1686
|
return false;
|
|
1695
1687
|
}
|
|
1696
1688
|
|
|
@@ -1707,10 +1699,29 @@ const canInsertBlockTypeUnmemoized = (
|
|
|
1707
1699
|
return false;
|
|
1708
1700
|
}
|
|
1709
1701
|
|
|
1710
|
-
//
|
|
1702
|
+
// It shouldn't be possible to insert inside a section block unless in
|
|
1703
|
+
// some cases when the block is a content block.
|
|
1704
|
+
const isContentRoleBlock = isContentBlock( blockName );
|
|
1705
|
+
const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
|
|
1706
|
+
const isBlockWithinSection = !! getParentSectionBlock(
|
|
1707
|
+
state,
|
|
1708
|
+
rootClientId
|
|
1709
|
+
);
|
|
1710
|
+
if (
|
|
1711
|
+
( isParentSectionBlock || isBlockWithinSection ) &&
|
|
1712
|
+
! isContentRoleBlock
|
|
1713
|
+
) {
|
|
1714
|
+
return false;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// In content only mode, check if this container allows insertion.
|
|
1711
1718
|
if (
|
|
1712
|
-
blockEditingMode === 'contentOnly' &&
|
|
1713
|
-
!
|
|
1719
|
+
( isParentSectionBlock || blockEditingMode === 'contentOnly' ) &&
|
|
1720
|
+
! isContainerInsertableToInContentOnlyMode(
|
|
1721
|
+
state,
|
|
1722
|
+
blockName,
|
|
1723
|
+
rootClientId
|
|
1724
|
+
)
|
|
1714
1725
|
) {
|
|
1715
1726
|
return false;
|
|
1716
1727
|
}
|
|
@@ -1858,6 +1869,8 @@ export function canRemoveBlock( state, clientId ) {
|
|
|
1858
1869
|
return false;
|
|
1859
1870
|
}
|
|
1860
1871
|
|
|
1872
|
+
// It shouldn't be possible to move in a section block unless in
|
|
1873
|
+
// some cases when the block is a content block.
|
|
1861
1874
|
const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
|
|
1862
1875
|
const isContentRoleBlock = isContentBlock(
|
|
1863
1876
|
getBlockName( state, clientId )
|
|
@@ -1866,21 +1879,21 @@ export function canRemoveBlock( state, clientId ) {
|
|
|
1866
1879
|
return false;
|
|
1867
1880
|
}
|
|
1868
1881
|
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
// Check if the parent container allows insertion/removal in
|
|
1882
|
+
const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
|
|
1883
|
+
const rootBlockEditingMode = getBlockEditingMode( state, rootClientId );
|
|
1884
|
+
// Check if the parent container allows insertion/removal in contentOnly mode
|
|
1872
1885
|
if (
|
|
1873
|
-
|
|
1874
|
-
!
|
|
1886
|
+
( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' ) &&
|
|
1887
|
+
! isContainerInsertableToInContentOnlyMode(
|
|
1875
1888
|
state,
|
|
1876
|
-
getBlockName( state,
|
|
1889
|
+
getBlockName( state, clientId ),
|
|
1877
1890
|
rootClientId
|
|
1878
1891
|
)
|
|
1879
1892
|
) {
|
|
1880
1893
|
return false;
|
|
1881
1894
|
}
|
|
1882
1895
|
|
|
1883
|
-
return
|
|
1896
|
+
return rootBlockEditingMode !== 'disabled';
|
|
1884
1897
|
}
|
|
1885
1898
|
|
|
1886
1899
|
/**
|
|
@@ -1913,9 +1926,34 @@ export function canMoveBlock( state, clientId ) {
|
|
|
1913
1926
|
}
|
|
1914
1927
|
|
|
1915
1928
|
const rootClientId = getBlockRootClientId( state, clientId );
|
|
1916
|
-
|
|
1929
|
+
const templateLock = getTemplateLock( state, rootClientId );
|
|
1930
|
+
if ( templateLock === 'all' || templateLock === 'contentOnly' ) {
|
|
1931
|
+
return false;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
|
|
1935
|
+
const isContentRoleBlock = isContentBlock(
|
|
1936
|
+
getBlockName( state, clientId )
|
|
1937
|
+
);
|
|
1938
|
+
if ( isBlockWithinSection && ! isContentRoleBlock ) {
|
|
1917
1939
|
return false;
|
|
1918
1940
|
}
|
|
1941
|
+
|
|
1942
|
+
// If the parent is a section or is `contentOnly`, then check is the inner block
|
|
1943
|
+
// should be allowed to move.
|
|
1944
|
+
const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
|
|
1945
|
+
const rootBlockEditingMode = getBlockEditingMode( state, rootClientId );
|
|
1946
|
+
if (
|
|
1947
|
+
( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' ) &&
|
|
1948
|
+
! isContainerInsertableToInContentOnlyMode(
|
|
1949
|
+
state,
|
|
1950
|
+
getBlockName( state, clientId ),
|
|
1951
|
+
rootClientId
|
|
1952
|
+
)
|
|
1953
|
+
) {
|
|
1954
|
+
return false;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1919
1957
|
return getBlockEditingMode( state, rootClientId ) !== 'disabled';
|
|
1920
1958
|
}
|
|
1921
1959
|
|
|
@@ -3081,7 +3081,7 @@ describe( 'selectors', () => {
|
|
|
3081
3081
|
byClientId: new Map(
|
|
3082
3082
|
Object.entries( {
|
|
3083
3083
|
block1: { name: 'core/test-block-ancestor' },
|
|
3084
|
-
block2: { name: 'core/
|
|
3084
|
+
block2: { name: 'core/group' },
|
|
3085
3085
|
block3: { name: 'core/test-block-parent' },
|
|
3086
3086
|
} )
|
|
3087
3087
|
),
|
package/src/store/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ import { parse as grammarParse } from '@wordpress/block-serialization-default-pa
|
|
|
10
10
|
import { selectBlockPatternsKey } from './private-keys';
|
|
11
11
|
import { unlock } from '../lock-unlock';
|
|
12
12
|
import { STORE_NAME } from './constants';
|
|
13
|
-
import { getSectionRootClientId } from './private-selectors';
|
|
13
|
+
import { getSectionRootClientId, isSectionBlock } from './private-selectors';
|
|
14
14
|
import { getBlockEditingMode } from './selectors';
|
|
15
15
|
import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
|
|
16
16
|
|
|
@@ -140,5 +140,6 @@ export const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {
|
|
|
140
140
|
state.settings.templateLock,
|
|
141
141
|
getBlockEditingMode( state, rootClientId ),
|
|
142
142
|
getSectionRootClientId( state ),
|
|
143
|
+
isSectionBlock( state, rootClientId ),
|
|
143
144
|
];
|
|
144
145
|
};
|
|
@@ -20,18 +20,13 @@ function generateCSSRule( elementSelector, fontSize ) {
|
|
|
20
20
|
* @param {HTMLElement} textElement The text element
|
|
21
21
|
* @param {string} elementSelector CSS selector for the text element
|
|
22
22
|
* @param {Function} applyStylesFn Function to apply test styles
|
|
23
|
-
* @param {number} maxSize Maximum font size in pixels (default: 600)
|
|
24
23
|
* @return {number} Optimal font size
|
|
25
24
|
*/
|
|
26
|
-
function findOptimalFontSize(
|
|
27
|
-
textElement,
|
|
28
|
-
elementSelector,
|
|
29
|
-
applyStylesFn,
|
|
30
|
-
maxSize = 600
|
|
31
|
-
) {
|
|
25
|
+
function findOptimalFontSize( textElement, elementSelector, applyStylesFn ) {
|
|
32
26
|
const alreadyHasScrollableHeight =
|
|
33
27
|
textElement.scrollHeight > textElement.clientHeight;
|
|
34
28
|
let minSize = 5;
|
|
29
|
+
let maxSize = 600;
|
|
35
30
|
let bestSize = minSize;
|
|
36
31
|
|
|
37
32
|
while ( minSize <= maxSize ) {
|
|
@@ -61,14 +56,8 @@ function findOptimalFontSize(
|
|
|
61
56
|
* @param {HTMLElement} textElement The text element (paragraph, heading, etc.)
|
|
62
57
|
* @param {string} elementSelector CSS selector for the text element
|
|
63
58
|
* @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear)
|
|
64
|
-
* @param {number} maxSize Maximum font size in pixels.
|
|
65
59
|
*/
|
|
66
|
-
export function optimizeFitText(
|
|
67
|
-
textElement,
|
|
68
|
-
elementSelector,
|
|
69
|
-
applyStylesFn,
|
|
70
|
-
maxSize
|
|
71
|
-
) {
|
|
60
|
+
export function optimizeFitText( textElement, elementSelector, applyStylesFn ) {
|
|
72
61
|
if ( ! textElement ) {
|
|
73
62
|
return;
|
|
74
63
|
}
|
|
@@ -78,8 +67,7 @@ export function optimizeFitText(
|
|
|
78
67
|
const optimalSize = findOptimalFontSize(
|
|
79
68
|
textElement,
|
|
80
69
|
elementSelector,
|
|
81
|
-
applyStylesFn
|
|
82
|
-
maxSize
|
|
70
|
+
applyStylesFn
|
|
83
71
|
);
|
|
84
72
|
|
|
85
73
|
const cssRule = generateCSSRule( elementSelector, optimalSize );
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/global-styles/context.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const DEFAULT_GLOBAL_STYLES_CONTEXT = {\n\tuser: {},\n\tbase: {},\n\tmerged: {},\n\tsetUserConfig: () => {},\n};\n\nexport const GlobalStylesContext = createContext(\n\tDEFAULT_GLOBAL_STYLES_CONTEXT\n);\nGlobalStylesContext.displayName = 'GlobalStylesContext';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA8B;AAEvB,MAAM,gCAAgC;AAAA,EAC5C,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,QAAQ,CAAC;AAAA,EACT,eAAe,MAAM;AAAA,EAAC;AACvB;AAEO,MAAM,0BAAsB;AAAA,EAClC;AACD;AACA,oBAAoB,cAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
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 get_global_styles_changes_exports = {};
|
|
30
|
-
__export(get_global_styles_changes_exports, {
|
|
31
|
-
default: () => getGlobalStylesChanges,
|
|
32
|
-
getGlobalStylesChangelist: () => getGlobalStylesChangelist
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(get_global_styles_changes_exports);
|
|
35
|
-
var import_memize = __toESM(require("memize"));
|
|
36
|
-
var import_i18n = require("@wordpress/i18n");
|
|
37
|
-
var import_blocks = require("@wordpress/blocks");
|
|
38
|
-
const globalStylesChangesCache = /* @__PURE__ */ new Map();
|
|
39
|
-
const EMPTY_ARRAY = [];
|
|
40
|
-
const translationMap = {
|
|
41
|
-
caption: (0, import_i18n.__)("Caption"),
|
|
42
|
-
link: (0, import_i18n.__)("Link"),
|
|
43
|
-
button: (0, import_i18n.__)("Button"),
|
|
44
|
-
heading: (0, import_i18n.__)("Heading"),
|
|
45
|
-
h1: (0, import_i18n.__)("H1"),
|
|
46
|
-
h2: (0, import_i18n.__)("H2"),
|
|
47
|
-
h3: (0, import_i18n.__)("H3"),
|
|
48
|
-
h4: (0, import_i18n.__)("H4"),
|
|
49
|
-
h5: (0, import_i18n.__)("H5"),
|
|
50
|
-
h6: (0, import_i18n.__)("H6"),
|
|
51
|
-
"settings.color": (0, import_i18n.__)("Color"),
|
|
52
|
-
"settings.typography": (0, import_i18n.__)("Typography"),
|
|
53
|
-
"settings.shadow": (0, import_i18n.__)("Shadow"),
|
|
54
|
-
"settings.layout": (0, import_i18n.__)("Layout"),
|
|
55
|
-
"styles.color": (0, import_i18n.__)("Colors"),
|
|
56
|
-
"styles.spacing": (0, import_i18n.__)("Spacing"),
|
|
57
|
-
"styles.background": (0, import_i18n.__)("Background"),
|
|
58
|
-
"styles.typography": (0, import_i18n.__)("Typography")
|
|
59
|
-
};
|
|
60
|
-
const getBlockNames = (0, import_memize.default)(
|
|
61
|
-
() => (0, import_blocks.getBlockTypes)().reduce((accumulator, { name, title }) => {
|
|
62
|
-
accumulator[name] = title;
|
|
63
|
-
return accumulator;
|
|
64
|
-
}, {})
|
|
65
|
-
);
|
|
66
|
-
const isObject = (obj) => obj !== null && typeof obj === "object";
|
|
67
|
-
function getTranslation(key) {
|
|
68
|
-
if (translationMap[key]) {
|
|
69
|
-
return translationMap[key];
|
|
70
|
-
}
|
|
71
|
-
const keyArray = key.split(".");
|
|
72
|
-
if (keyArray?.[0] === "blocks") {
|
|
73
|
-
const blockName = getBlockNames()?.[keyArray[1]];
|
|
74
|
-
return blockName || keyArray[1];
|
|
75
|
-
}
|
|
76
|
-
if (keyArray?.[0] === "elements") {
|
|
77
|
-
return translationMap[keyArray[1]] || keyArray[1];
|
|
78
|
-
}
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
function deepCompare(changedObject, originalObject, parentPath = "") {
|
|
82
|
-
if (!isObject(changedObject) && !isObject(originalObject)) {
|
|
83
|
-
return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0;
|
|
84
|
-
}
|
|
85
|
-
changedObject = isObject(changedObject) ? changedObject : {};
|
|
86
|
-
originalObject = isObject(originalObject) ? originalObject : {};
|
|
87
|
-
const allKeys = /* @__PURE__ */ new Set([
|
|
88
|
-
...Object.keys(changedObject),
|
|
89
|
-
...Object.keys(originalObject)
|
|
90
|
-
]);
|
|
91
|
-
let diffs = [];
|
|
92
|
-
for (const key of allKeys) {
|
|
93
|
-
const path = parentPath ? parentPath + "." + key : key;
|
|
94
|
-
const changedPath = deepCompare(
|
|
95
|
-
changedObject[key],
|
|
96
|
-
originalObject[key],
|
|
97
|
-
path
|
|
98
|
-
);
|
|
99
|
-
if (changedPath) {
|
|
100
|
-
diffs = diffs.concat(changedPath);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return diffs;
|
|
104
|
-
}
|
|
105
|
-
function getGlobalStylesChangelist(next, previous) {
|
|
106
|
-
const cacheKey = JSON.stringify({ next, previous });
|
|
107
|
-
if (globalStylesChangesCache.has(cacheKey)) {
|
|
108
|
-
return globalStylesChangesCache.get(cacheKey);
|
|
109
|
-
}
|
|
110
|
-
const changedValueTree = deepCompare(
|
|
111
|
-
{
|
|
112
|
-
styles: {
|
|
113
|
-
background: next?.styles?.background,
|
|
114
|
-
color: next?.styles?.color,
|
|
115
|
-
typography: next?.styles?.typography,
|
|
116
|
-
spacing: next?.styles?.spacing
|
|
117
|
-
},
|
|
118
|
-
blocks: next?.styles?.blocks,
|
|
119
|
-
elements: next?.styles?.elements,
|
|
120
|
-
settings: next?.settings
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
styles: {
|
|
124
|
-
background: previous?.styles?.background,
|
|
125
|
-
color: previous?.styles?.color,
|
|
126
|
-
typography: previous?.styles?.typography,
|
|
127
|
-
spacing: previous?.styles?.spacing
|
|
128
|
-
},
|
|
129
|
-
blocks: previous?.styles?.blocks,
|
|
130
|
-
elements: previous?.styles?.elements,
|
|
131
|
-
settings: previous?.settings
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
if (!changedValueTree.length) {
|
|
135
|
-
globalStylesChangesCache.set(cacheKey, EMPTY_ARRAY);
|
|
136
|
-
return EMPTY_ARRAY;
|
|
137
|
-
}
|
|
138
|
-
const result = [...new Set(changedValueTree)].reduce((acc, curr) => {
|
|
139
|
-
const translation = getTranslation(curr);
|
|
140
|
-
if (translation) {
|
|
141
|
-
acc.push([curr.split(".")[0], translation]);
|
|
142
|
-
}
|
|
143
|
-
return acc;
|
|
144
|
-
}, []);
|
|
145
|
-
globalStylesChangesCache.set(cacheKey, result);
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
function getGlobalStylesChanges(next, previous, options = {}) {
|
|
149
|
-
let changeList = getGlobalStylesChangelist(next, previous);
|
|
150
|
-
const changesLength = changeList.length;
|
|
151
|
-
const { maxResults } = options;
|
|
152
|
-
if (changesLength) {
|
|
153
|
-
if (!!maxResults && changesLength > maxResults) {
|
|
154
|
-
changeList = changeList.slice(0, maxResults);
|
|
155
|
-
}
|
|
156
|
-
return Object.entries(
|
|
157
|
-
changeList.reduce((acc, curr) => {
|
|
158
|
-
const group = acc[curr[0]] || [];
|
|
159
|
-
if (!group.includes(curr[1])) {
|
|
160
|
-
acc[curr[0]] = [...group, curr[1]];
|
|
161
|
-
}
|
|
162
|
-
return acc;
|
|
163
|
-
}, {})
|
|
164
|
-
).map(([key, changeValues]) => {
|
|
165
|
-
const changeValuesLength = changeValues.length;
|
|
166
|
-
const joinedChangesValue = changeValues.join(
|
|
167
|
-
/* translators: Used between list items, there is a space after the comma. */
|
|
168
|
-
(0, import_i18n.__)(", ")
|
|
169
|
-
// eslint-disable-line @wordpress/i18n-no-flanking-whitespace
|
|
170
|
-
);
|
|
171
|
-
switch (key) {
|
|
172
|
-
case "blocks": {
|
|
173
|
-
return (0, import_i18n.sprintf)(
|
|
174
|
-
// translators: %s: a list of block names separated by a comma.
|
|
175
|
-
(0, import_i18n._n)("%s block.", "%s blocks.", changeValuesLength),
|
|
176
|
-
joinedChangesValue
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
case "elements": {
|
|
180
|
-
return (0, import_i18n.sprintf)(
|
|
181
|
-
// translators: %s: a list of element names separated by a comma.
|
|
182
|
-
(0, import_i18n._n)("%s element.", "%s elements.", changeValuesLength),
|
|
183
|
-
joinedChangesValue
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
case "settings": {
|
|
187
|
-
return (0, import_i18n.sprintf)(
|
|
188
|
-
// translators: %s: a list of theme.json setting labels separated by a comma.
|
|
189
|
-
(0, import_i18n.__)("%s settings."),
|
|
190
|
-
joinedChangesValue
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
case "styles": {
|
|
194
|
-
return (0, import_i18n.sprintf)(
|
|
195
|
-
// translators: %s: a list of theme.json top-level styles labels separated by a comma.
|
|
196
|
-
(0, import_i18n.__)("%s styles."),
|
|
197
|
-
joinedChangesValue
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
default: {
|
|
201
|
-
return (0, import_i18n.sprintf)(
|
|
202
|
-
// translators: %s: a list of global styles changes separated by a comma.
|
|
203
|
-
(0, import_i18n.__)("%s."),
|
|
204
|
-
joinedChangesValue
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
return EMPTY_ARRAY;
|
|
211
|
-
}
|
|
212
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
213
|
-
0 && (module.exports = {
|
|
214
|
-
getGlobalStylesChangelist
|
|
215
|
-
});
|
|
216
|
-
//# sourceMappingURL=get-global-styles-changes.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/global-styles/get-global-styles-changes.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { getBlockTypes } from '@wordpress/blocks';\n\nconst globalStylesChangesCache = new Map();\nconst EMPTY_ARRAY = [];\nconst translationMap = {\n\tcaption: __( 'Caption' ),\n\tlink: __( 'Link' ),\n\tbutton: __( 'Button' ),\n\theading: __( 'Heading' ),\n\th1: __( 'H1' ),\n\th2: __( 'H2' ),\n\th3: __( 'H3' ),\n\th4: __( 'H4' ),\n\th5: __( 'H5' ),\n\th6: __( 'H6' ),\n\t'settings.color': __( 'Color' ),\n\t'settings.typography': __( 'Typography' ),\n\t'settings.shadow': __( 'Shadow' ),\n\t'settings.layout': __( 'Layout' ),\n\t'styles.color': __( 'Colors' ),\n\t'styles.spacing': __( 'Spacing' ),\n\t'styles.background': __( 'Background' ),\n\t'styles.typography': __( 'Typography' ),\n};\nconst getBlockNames = memoize( () =>\n\tgetBlockTypes().reduce( ( accumulator, { name, title } ) => {\n\t\taccumulator[ name ] = title;\n\t\treturn accumulator;\n\t}, {} )\n);\nconst isObject = ( obj ) => obj !== null && typeof obj === 'object';\n\n/**\n * Get the translation for a given global styles key.\n * @param {string} key A key representing a path to a global style property or setting.\n * @return {string|undefined} A translated key or undefined if no translation exists.\n */\nfunction getTranslation( key ) {\n\tif ( translationMap[ key ] ) {\n\t\treturn translationMap[ key ];\n\t}\n\n\tconst keyArray = key.split( '.' );\n\n\tif ( keyArray?.[ 0 ] === 'blocks' ) {\n\t\tconst blockName = getBlockNames()?.[ keyArray[ 1 ] ];\n\t\treturn blockName || keyArray[ 1 ];\n\t}\n\n\tif ( keyArray?.[ 0 ] === 'elements' ) {\n\t\treturn translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];\n\t}\n\n\treturn undefined;\n}\n\n/**\n * A deep comparison of two objects, optimized for comparing global styles.\n * @param {Object} changedObject The changed object to compare.\n * @param {Object} originalObject The original object to compare against.\n * @param {string} parentPath A key/value pair object of block names and their rendered titles.\n * @return {string[]} An array of paths whose values have changed.\n */\nfunction deepCompare( changedObject, originalObject, parentPath = '' ) {\n\t// We have two non-object values to compare.\n\tif ( ! isObject( changedObject ) && ! isObject( originalObject ) ) {\n\t\t/*\n\t\t * Only return a path if the value has changed.\n\t\t * And then only the path name up to 2 levels deep.\n\t\t */\n\t\treturn changedObject !== originalObject\n\t\t\t? parentPath.split( '.' ).slice( 0, 2 ).join( '.' )\n\t\t\t: undefined;\n\t}\n\n\t// Enable comparison when an object doesn't have a corresponding property to compare.\n\tchangedObject = isObject( changedObject ) ? changedObject : {};\n\toriginalObject = isObject( originalObject ) ? originalObject : {};\n\n\tconst allKeys = new Set( [\n\t\t...Object.keys( changedObject ),\n\t\t...Object.keys( originalObject ),\n\t] );\n\n\tlet diffs = [];\n\tfor ( const key of allKeys ) {\n\t\tconst path = parentPath ? parentPath + '.' + key : key;\n\t\tconst changedPath = deepCompare(\n\t\t\tchangedObject[ key ],\n\t\t\toriginalObject[ key ],\n\t\t\tpath\n\t\t);\n\t\tif ( changedPath ) {\n\t\t\tdiffs = diffs.concat( changedPath );\n\t\t}\n\t}\n\treturn diffs;\n}\n\n/**\n * Returns an array of translated summarized global styles changes.\n * Results are cached using a Map() key of `JSON.stringify( { next, previous } )`.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @return {Array[]} A 2-dimensional array of tuples: [ \"group\", \"translated change\" ].\n */\nexport function getGlobalStylesChangelist( next, previous ) {\n\tconst cacheKey = JSON.stringify( { next, previous } );\n\n\tif ( globalStylesChangesCache.has( cacheKey ) ) {\n\t\treturn globalStylesChangesCache.get( cacheKey );\n\t}\n\n\t/*\n\t * Compare the two changesets with normalized keys.\n\t * The order of these keys determines the order in which\n\t * they'll appear in the results.\n\t */\n\tconst changedValueTree = deepCompare(\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tbackground: next?.styles?.background,\n\t\t\t\tcolor: next?.styles?.color,\n\t\t\t\ttypography: next?.styles?.typography,\n\t\t\t\tspacing: next?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: next?.styles?.blocks,\n\t\t\telements: next?.styles?.elements,\n\t\t\tsettings: next?.settings,\n\t\t},\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tbackground: previous?.styles?.background,\n\t\t\t\tcolor: previous?.styles?.color,\n\t\t\t\ttypography: previous?.styles?.typography,\n\t\t\t\tspacing: previous?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: previous?.styles?.blocks,\n\t\t\telements: previous?.styles?.elements,\n\t\t\tsettings: previous?.settings,\n\t\t}\n\t);\n\n\tif ( ! changedValueTree.length ) {\n\t\tglobalStylesChangesCache.set( cacheKey, EMPTY_ARRAY );\n\t\treturn EMPTY_ARRAY;\n\t}\n\n\t// Remove duplicate results.\n\tconst result = [ ...new Set( changedValueTree ) ]\n\t\t/*\n\t\t * Translate the keys.\n\t\t * Remove empty translations.\n\t\t */\n\t\t.reduce( ( acc, curr ) => {\n\t\t\tconst translation = getTranslation( curr );\n\t\t\tif ( translation ) {\n\t\t\t\tacc.push( [ curr.split( '.' )[ 0 ], translation ] );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\tglobalStylesChangesCache.set( cacheKey, result );\n\n\treturn result;\n}\n\n/**\n * From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type.\n * The types are 'blocks', 'elements', 'settings', and 'styles'.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @param {{maxResults:number}} options Options. maxResults: results to return before truncating.\n * @return {string[]} An array of translated changes.\n */\nexport default function getGlobalStylesChanges( next, previous, options = {} ) {\n\tlet changeList = getGlobalStylesChangelist( next, previous );\n\tconst changesLength = changeList.length;\n\tconst { maxResults } = options;\n\n\tif ( changesLength ) {\n\t\t// Truncate to `n` results if necessary.\n\t\tif ( !! maxResults && changesLength > maxResults ) {\n\t\t\tchangeList = changeList.slice( 0, maxResults );\n\t\t}\n\t\treturn Object.entries(\n\t\t\tchangeList.reduce( ( acc, curr ) => {\n\t\t\t\tconst group = acc[ curr[ 0 ] ] || [];\n\t\t\t\tif ( ! group.includes( curr[ 1 ] ) ) {\n\t\t\t\t\tacc[ curr[ 0 ] ] = [ ...group, curr[ 1 ] ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} )\n\t\t).map( ( [ key, changeValues ] ) => {\n\t\t\tconst changeValuesLength = changeValues.length;\n\t\t\tconst joinedChangesValue = changeValues.join(\n\t\t\t\t/* translators: Used between list items, there is a space after the comma. */\n\t\t\t\t__( ', ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t);\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'blocks': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of block names separated by a comma.\n\t\t\t\t\t\t_n( '%s block.', '%s blocks.', changeValuesLength ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'elements': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of element names separated by a comma.\n\t\t\t\t\t\t_n( '%s element.', '%s elements.', changeValuesLength ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'settings': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of theme.json setting labels separated by a comma.\n\t\t\t\t\t\t__( '%s settings.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'styles': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of theme.json top-level styles labels separated by a comma.\n\t\t\t\t\t\t__( '%s styles.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of global styles changes separated by a comma.\n\t\t\t\t\t\t__( '%s.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn EMPTY_ARRAY;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAoB;AAKpB,kBAAgC;AAChC,oBAA8B;AAE9B,MAAM,2BAA2B,oBAAI,IAAI;AACzC,MAAM,cAAc,CAAC;AACrB,MAAM,iBAAiB;AAAA,EACtB,aAAS,gBAAI,SAAU;AAAA,EACvB,UAAM,gBAAI,MAAO;AAAA,EACjB,YAAQ,gBAAI,QAAS;AAAA,EACrB,aAAS,gBAAI,SAAU;AAAA,EACvB,QAAI,gBAAI,IAAK;AAAA,EACb,QAAI,gBAAI,IAAK;AAAA,EACb,QAAI,gBAAI,IAAK;AAAA,EACb,QAAI,gBAAI,IAAK;AAAA,EACb,QAAI,gBAAI,IAAK;AAAA,EACb,QAAI,gBAAI,IAAK;AAAA,EACb,sBAAkB,gBAAI,OAAQ;AAAA,EAC9B,2BAAuB,gBAAI,YAAa;AAAA,EACxC,uBAAmB,gBAAI,QAAS;AAAA,EAChC,uBAAmB,gBAAI,QAAS;AAAA,EAChC,oBAAgB,gBAAI,QAAS;AAAA,EAC7B,sBAAkB,gBAAI,SAAU;AAAA,EAChC,yBAAqB,gBAAI,YAAa;AAAA,EACtC,yBAAqB,gBAAI,YAAa;AACvC;AACA,MAAM,oBAAgB,cAAAA;AAAA,EAAS,UAC9B,6BAAc,EAAE,OAAQ,CAAE,aAAa,EAAE,MAAM,MAAM,MAAO;AAC3D,gBAAa,IAAK,IAAI;AACtB,WAAO;AAAA,EACR,GAAG,CAAC,CAAE;AACP;AACA,MAAM,WAAW,CAAE,QAAS,QA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AL_STYLES_CONTEXT = {
|
|
3
|
-
user: {},
|
|
4
|
-
base: {},
|
|
5
|
-
merged: {},
|
|
6
|
-
setUserConfig: () => {
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
const GlobalStylesContext = createContext(
|
|
10
|
-
DEFAULT_GLOBAL_STYLES_CONTEXT
|
|
11
|
-
);
|
|
12
|
-
GlobalStylesContext.displayName = "GlobalStylesContext";
|
|
13
|
-
export {
|
|
14
|
-
DEFAULT_GLOBAL_STYLES_CONTEXT,
|
|
15
|
-
GlobalStylesContext
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/global-styles/context.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const DEFAULT_GLOBAL_STYLES_CONTEXT = {\n\tuser: {},\n\tbase: {},\n\tmerged: {},\n\tsetUserConfig: () => {},\n};\n\nexport const GlobalStylesContext = createContext(\n\tDEFAULT_GLOBAL_STYLES_CONTEXT\n);\nGlobalStylesContext.displayName = 'GlobalStylesContext';\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,qBAAqB;AAEvB,MAAM,gCAAgC;AAAA,EAC5C,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,QAAQ,CAAC;AAAA,EACT,eAAe,MAAM;AAAA,EAAC;AACvB;AAEO,MAAM,sBAAsB;AAAA,EAClC;AACD;AACA,oBAAoB,cAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|