@wordpress/block-editor 11.5.0 → 11.6.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-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +57 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +20 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +62 -15
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +20 -13
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +28 -3
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +5 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +9 -7
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -1
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/hooks/border.js +91 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/layout.js +19 -22
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +27 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +19 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +15 -9
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +54 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +62 -16
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +20 -13
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +28 -4
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +5 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +9 -7
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/hooks/border.js +93 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/layout.js +19 -22
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +27 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +10 -8
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +17 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +15 -9
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +6 -6
- package/build-style/style.css +6 -6
- package/package.json +31 -31
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/hooks.js +74 -1
- package/src/components/global-styles/index.js +2 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +48 -1
- package/src/components/global-styles/use-global-styles-output.js +13 -13
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +3 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/style.scss +0 -4
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/off-canvas-editor/appender.js +31 -5
- package/src/components/off-canvas-editor/branch.js +3 -1
- package/src/components/off-canvas-editor/index.js +7 -7
- package/src/components/off-canvas-editor/link-ui.js +0 -1
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/url-popover/test/index.js +0 -2
- package/src/hooks/border.js +94 -225
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/layout.js +19 -16
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +36 -0
- package/src/layouts/constrained.js +23 -17
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +10 -8
- package/src/store/selectors.js +20 -3
- package/src/utils/parse-css-unit-to-px.js +14 -9
- package/src/utils/test/parse-css-unit-to-px.js +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
|
@@ -142,21 +142,27 @@ function evalMathExpression(cssUnit) {
|
|
|
142
142
|
|
|
143
143
|
const cssUnitsBits = cssUnit.match(/\d+\.?\d*[a-zA-Z]+|\.\d+[a-zA-Z]+/g);
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
if (cssUnitsBits) {
|
|
146
|
+
for (const unit of cssUnitsBits) {
|
|
147
|
+
// Standardize the unit to px and extract the value.
|
|
148
|
+
const parsedUnit = parseUnit(getPxFromCssUnit(unit));
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
if (!parseFloat(parsedUnit.value)) {
|
|
151
|
+
errorFound = true; // End early since we are dealing with a null value.
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
cssUnit = cssUnit.replace(unit, parsedUnit.value);
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
errorFound = true;
|
|
156
160
|
} // For mixed math expressions wrapped within CSS expressions
|
|
157
161
|
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
const expressionsMatches = cssUnit.match(/(max|min|clamp)/g);
|
|
164
|
+
|
|
165
|
+
if (!errorFound && expressionsMatches) {
|
|
160
166
|
const values = cssUnit.split(',');
|
|
161
167
|
|
|
162
168
|
for (const currentValue of values) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","err","getFunctionUnitValue","functionUnitValue","options","functionUnit","split","filter","Boolean","units","slice","map","getPxFromCssUnit","Math","min","max","length","parseUnitFunction","currentCssUnit","regExp","matches","exec","replace","isMathExpression","i","includes","evalMathExpression","errorFound","cssUnitsBits","parsedUnit","values","currentValue","rawCurrentValue","calculatedExpression","calculatedValue","toFixed","parsedValue","calculatedResult","convertParsedUnitToPx","PIXELS_PER_INCH","ONE_PERCENT","defaultProperties","fontSize","lineHeight","width","height","type","setOptions","Object","assign","relativeUnits","em","rem","vh","vw","vmin","vmax","ch","ex","lh","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,QAAMC,KAAK,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAClBE,IADW,GAEZD,KAFY,CAGZ,6EAHY,CAAd;;AAKA,MAAK,CAAEE,KAAK,CAAEH,OAAF,CAAP,IAAsB,CAAEG,KAAK,CAAEC,UAAU,CAAEJ,OAAF,CAAZ,CAAlC,EAA8D;AAC7D,WAAO;AAAEK,MAAAA,KAAK,EAAED,UAAU,CAAEJ,OAAF,CAAnB;AAAgCM,MAAAA,IAAI,EAAE;AAAtC,KAAP;AACA;;AACD,SAAOL,KAAK,GACT;AAAEI,IAAAA,KAAK,EAAED,UAAU,CAAEH,KAAK,CAAE,CAAF,CAAP,CAAV,IAA4BA,KAAK,CAAE,CAAF,CAA1C;AAAiDK,IAAAA,IAAI,EAAEL,KAAK,CAAE,CAAF;AAA5D,GADS,GAET;AAAEI,IAAAA,KAAK,EAAEL,OAAT;AAAkBM,IAAAA,IAAI,EAAEC;AAAxB,GAFH;AAGA;AACD;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,SAAT,CAAoBC,UAApB,EAAiC;AAChC,MAAI;AACH,WAAOC,QAAQ,CAAG,yBAAyBD,UAAY,GAAxC,CAAR,EAAP;AACA,GAFD,CAEE,OAAQE,GAAR,EAAc;AACf,WAAO,IAAP;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BC,iBAA/B,EAAkDC,OAAlD,EAA4D;AAC3D,QAAMC,YAAY,GAAGF,iBAAiB,CAACG,KAAlB,CAAyB,QAAzB,EAAoCC,MAApC,CAA4CC,OAA5C,CAArB;AAEA,QAAMC,KAAK,GAAGJ,YAAY,CACxBK,KADY,CACL,CADK,EAEZC,GAFY,CAELf,IAAF,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AAmCjF,OAAnC,EAA2D;AAAA,MAAfc,OAAe,uEAAL,EAAK;AAC1D,QAAMoE,IAAI,GAAGlF,OAAO,GAAGmF,WAAW,CAAErE,OAAF,CAAlC;;AAEA,MAAK,CAAEkE,KAAK,CAAEE,IAAF,CAAZ,EAAuB;AACtBF,IAAAA,KAAK,CAAEE,IAAF,CAAL,GAAgB5D,gBAAgB,CAAEtB,OAAF,EAAWc,OAAX,CAAhC;AACA;;AACD,SAAOkE,KAAK,CAAEE,IAAF,CAAZ;AACA;;AAED,SAASC,WAAT,CAAsBrE,OAAtB,EAAgC;AAC/B,MAAIoE,IAAI,GAAG,EAAX;;AACA,MAAKpE,OAAO,CAACsE,cAAR,CAAwB,UAAxB,CAAL,EAA4C;AAC3CF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACwC,KAArB;AACA;;AACD,MAAKxC,OAAO,CAACsE,cAAR,CAAwB,YAAxB,CAAL,EAA8C;AAC7CF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACuC,UAArB;AACA;;AACD,MAAKvC,OAAO,CAACsE,cAAR,CAAwB,OAAxB,CAAL,EAAyC;AACxCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACwC,KAArB;AACA;;AACD,MAAKxC,OAAO,CAACsE,cAAR,CAAwB,QAAxB,CAAL,EAA0C;AACzCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACyC,MAArB;AACA;;AACD,MAAKzC,OAAO,CAACsE,cAAR,CAAwB,MAAxB,CAAL,EAAwC;AACvCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAAC0C,IAArB;AACA;;AACD,SAAO0B,IAAP;AACA;;AAED,eAAeD,wBAAf","sourcesContent":["/**\n * Converts string to object { value, unit }.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit\n */\nfunction parseUnit( cssUnit ) {\n\tconst match = cssUnit\n\t\t?.trim()\n\t\t.match(\n\t\t\t/^(0?[-.]?\\d*\\.?\\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/\n\t\t);\n\tif ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {\n\t\treturn { value: parseFloat( cssUnit ), unit: 'px' };\n\t}\n\treturn match\n\t\t? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }\n\t\t: { value: cssUnit, unit: undefined };\n}\n/**\n * Evaluate a math expression.\n *\n * @param {string} expression\n * @return {number} evaluated expression.\n */\nfunction calculate( expression ) {\n\ttry {\n\t\treturn Function( `'use strict'; return (${ expression })` )();\n\t} catch ( err ) {\n\t\treturn null;\n\t}\n}\n\n/**\n * Calculates the css function value for the supported css functions such as max, min, clamp and calc.\n *\n * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.\n * @param {Object} options\n * @return {string} unit containing the unit in PX.\n */\nfunction getFunctionUnitValue( functionUnitValue, options ) {\n\tconst functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );\n\n\tconst units = functionUnit\n\t\t.slice( 1 )\n\t\t.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )\n\t\t.filter( Boolean );\n\n\tswitch ( functionUnit[ 0 ] ) {\n\t\tcase 'min':\n\t\t\treturn Math.min( ...units ) + 'px';\n\t\tcase 'max':\n\t\t\treturn Math.max( ...units ) + 'px';\n\t\tcase 'clamp':\n\t\t\tif ( units.length !== 3 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( units[ 1 ] < units[ 0 ] ) {\n\t\t\t\treturn units[ 0 ] + 'px';\n\t\t\t}\n\t\t\tif ( units[ 1 ] > units[ 2 ] ) {\n\t\t\t\treturn units[ 2 ] + 'px';\n\t\t\t}\n\t\t\treturn units[ 1 ] + 'px';\n\t\tcase 'calc':\n\t\t\treturn units[ 0 ] + 'px';\n\t}\n}\n\n/**\n * Take a css function such as min, max, calc, clamp and returns parsedUnit\n *\n * How this works for the nested function is that it first replaces the inner function call.\n * Then it tackles the outer onces.\n * So for example: min( max(25px, 35px), 40px )\n * in the first pass we would replace max(25px, 35px) with 35px.\n * then we would try to evaluate min( 35px, 40px )\n * and then finally return 35px.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit object.\n */\nfunction parseUnitFunction( cssUnit ) {\n\twhile ( true ) {\n\t\tconst currentCssUnit = cssUnit;\n\t\tconst regExp = /(max|min|calc|clamp)\\(([^()]*)\\)/g;\n\t\tconst matches = regExp.exec( cssUnit ) || [];\n\t\tif ( matches[ 0 ] ) {\n\t\t\tconst functionUnitValue = getFunctionUnitValue( matches[ 0 ] );\n\t\t\tcssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );\n\t\t}\n\n\t\t// If the unit hasn't been modified or we have a single value break free.\n\t\tif ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn parseUnit( cssUnit );\n}\n/**\n * Return true if we think this is a math expression.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {boolean} Whether the cssUnit is a math expression.\n */\nfunction isMathExpression( cssUnit ) {\n\tfor ( let i = 0; i < cssUnit.length; i++ ) {\n\t\tif ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n/**\n * Evaluates the math expression and return a px value.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {string} return a converfted value to px.\n */\nfunction evalMathExpression( cssUnit ) {\n\tlet errorFound = false;\n\t// Convert every part of the expression to px values.\n\t// The following regex matches numbers that have a following unit\n\t// E.g. 5.25rem, 1vw\n\tconst cssUnitsBits = cssUnit.match( /\\d+\\.?\\d*[a-zA-Z]+|\\.\\d+[a-zA-Z]+/g );\n\tfor ( const unit of cssUnitsBits ) {\n\t\t// Standardize the unit to px and extract the value.\n\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\terrorFound = true;\n\t\t\t// End early since we are dealing with a null value.\n\t\t\tbreak;\n\t\t}\n\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t}\n\n\t// For mixed math expressions wrapped within CSS expressions\n\tif ( ! errorFound && cssUnit.match( /(max|min|clamp)/g ) ) {\n\t\tconst values = cssUnit.split( ',' );\n\t\tfor ( const currentValue of values ) {\n\t\t\t// Check for nested calc() and remove them to calculate the value.\n\t\t\tconst rawCurrentValue = currentValue.replace( /\\s|calc/g, '' );\n\n\t\t\tif ( isMathExpression( rawCurrentValue ) ) {\n\t\t\t\tconst calculatedExpression = calculate( rawCurrentValue );\n\n\t\t\t\tif ( calculatedExpression ) {\n\t\t\t\t\tconst calculatedValue =\n\t\t\t\t\t\tcalculatedExpression.toFixed( 0 ) + 'px';\n\t\t\t\t\tcssUnit = cssUnit.replace( currentValue, calculatedValue );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst parsedValue = parseUnitFunction( cssUnit );\n\t\treturn ! parsedValue ? null : parsedValue.value + parsedValue.unit;\n\t}\n\n\tif ( errorFound ) {\n\t\treturn null;\n\t}\n\n\tconst calculatedResult = calculate( cssUnit );\n\treturn calculatedResult ? calculatedResult.toFixed( 0 ) + 'px' : null;\n}\n\n/**\n * Convert a parsedUnit object to px value.\n *\n * @param {Object} parsedUnit\n * @param {Object} options\n * @return {string} or {null} returns the converted with in a px value format.\n */\nfunction convertParsedUnitToPx( parsedUnit, options ) {\n\tconst PIXELS_PER_INCH = 96;\n\tconst ONE_PERCENT = 0.01;\n\n\tconst defaultProperties = {\n\t\tfontSize: 16,\n\t\tlineHeight: 16,\n\t\twidth: 375,\n\t\theight: 812,\n\t\ttype: 'font',\n\t};\n\n\tconst setOptions = Object.assign( {}, defaultProperties, options );\n\n\tconst relativeUnits = {\n\t\tem: setOptions.fontSize,\n\t\trem: setOptions.fontSize,\n\t\tvh: setOptions.height * ONE_PERCENT,\n\t\tvw: setOptions.width * ONE_PERCENT,\n\t\tvmin:\n\t\t\t( setOptions.width < setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\tvmax:\n\t\t\t( setOptions.width > setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\t'%':\n\t\t\t( setOptions.type === 'font'\n\t\t\t\t? setOptions.fontSize\n\t\t\t\t: setOptions.width ) * ONE_PERCENT,\n\t\tch: 8, // The advance measure (width) of the glyph \"0\" of the element's font. Approximate\n\t\tex: 7.15625, // X-height of the element's font. Approximate.\n\t\tlh: setOptions.lineHeight,\n\t};\n\n\tconst absoluteUnits = {\n\t\tin: PIXELS_PER_INCH,\n\t\tcm: PIXELS_PER_INCH / 2.54,\n\t\tmm: PIXELS_PER_INCH / 25.4,\n\t\tpt: PIXELS_PER_INCH / 72,\n\t\tpc: PIXELS_PER_INCH / 6,\n\t\tpx: 1,\n\t\tQ: PIXELS_PER_INCH / 2.54 / 40,\n\t};\n\n\tif ( relativeUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\tif ( absoluteUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Returns the px value of a cssUnit.\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nexport function getPxFromCssUnit( cssUnit, options = {} ) {\n\tif ( Number.isFinite( cssUnit ) ) {\n\t\treturn cssUnit.toFixed( 0 ) + 'px';\n\t}\n\tif ( cssUnit === undefined ) {\n\t\treturn null;\n\t}\n\tlet parsedUnit = parseUnit( cssUnit );\n\n\tif ( ! parsedUnit.unit ) {\n\t\tparsedUnit = parseUnitFunction( cssUnit );\n\t}\n\n\tif ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {\n\t\treturn evalMathExpression( cssUnit );\n\t}\n\n\treturn convertParsedUnitToPx( parsedUnit, options );\n}\n\n// Use simple cache.\nconst cache = {};\n/**\n * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nfunction memoizedGetPxFromCssUnit( cssUnit, options = {} ) {\n\tconst hash = cssUnit + hashOptions( options );\n\n\tif ( ! cache[ hash ] ) {\n\t\tcache[ hash ] = getPxFromCssUnit( cssUnit, options );\n\t}\n\treturn cache[ hash ];\n}\n\nfunction hashOptions( options ) {\n\tlet hash = '';\n\tif ( options.hasOwnProperty( 'fontSize' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'lineHeight' ) ) {\n\t\thash = ':' + options.lineHeight;\n\t}\n\tif ( options.hasOwnProperty( 'width' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'height' ) ) {\n\t\thash = ':' + options.height;\n\t}\n\tif ( options.hasOwnProperty( 'type' ) ) {\n\t\thash = ':' + options.type;\n\t}\n\treturn hash;\n}\n\nexport default memoizedGetPxFromCssUnit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","err","getFunctionUnitValue","functionUnitValue","options","functionUnit","split","filter","Boolean","units","slice","map","getPxFromCssUnit","Math","min","max","length","parseUnitFunction","currentCssUnit","regExp","matches","exec","replace","isMathExpression","i","includes","evalMathExpression","errorFound","cssUnitsBits","parsedUnit","expressionsMatches","values","currentValue","rawCurrentValue","calculatedExpression","calculatedValue","toFixed","parsedValue","calculatedResult","convertParsedUnitToPx","PIXELS_PER_INCH","ONE_PERCENT","defaultProperties","fontSize","lineHeight","width","height","type","setOptions","Object","assign","relativeUnits","em","rem","vh","vw","vmin","vmax","ch","ex","lh","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,QAAMC,KAAK,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAClBE,IADW,GAEZD,KAFY,CAGZ,6EAHY,CAAd;;AAKA,MAAK,CAAEE,KAAK,CAAEH,OAAF,CAAP,IAAsB,CAAEG,KAAK,CAAEC,UAAU,CAAEJ,OAAF,CAAZ,CAAlC,EAA8D;AAC7D,WAAO;AAAEK,MAAAA,KAAK,EAAED,UAAU,CAAEJ,OAAF,CAAnB;AAAgCM,MAAAA,IAAI,EAAE;AAAtC,KAAP;AACA;;AACD,SAAOL,KAAK,GACT;AAAEI,IAAAA,KAAK,EAAED,UAAU,CAAEH,KAAK,CAAE,CAAF,CAAP,CAAV,IAA4BA,KAAK,CAAE,CAAF,CAA1C;AAAiDK,IAAAA,IAAI,EAAEL,KAAK,CAAE,CAAF;AAA5D,GADS,GAET;AAAEI,IAAAA,KAAK,EAAEL,OAAT;AAAkBM,IAAAA,IAAI,EAAEC;AAAxB,GAFH;AAGA;AACD;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,SAAT,CAAoBC,UAApB,EAAiC;AAChC,MAAI;AACH,WAAOC,QAAQ,CAAG,yBAAyBD,UAAY,GAAxC,CAAR,EAAP;AACA,GAFD,CAEE,OAAQE,GAAR,EAAc;AACf,WAAO,IAAP;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BC,iBAA/B,EAAkDC,OAAlD,EAA4D;AAC3D,QAAMC,YAAY,GAAGF,iBAAiB,CAACG,KAAlB,CAAyB,QAA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O,CAAC2C,IAArB;AACA;;AACD,SAAO0B,IAAP;AACA;;AAED,eAAeD,wBAAf","sourcesContent":["/**\n * Converts string to object { value, unit }.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit\n */\nfunction parseUnit( cssUnit ) {\n\tconst match = cssUnit\n\t\t?.trim()\n\t\t.match(\n\t\t\t/^(0?[-.]?\\d*\\.?\\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/\n\t\t);\n\tif ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {\n\t\treturn { value: parseFloat( cssUnit ), unit: 'px' };\n\t}\n\treturn match\n\t\t? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }\n\t\t: { value: cssUnit, unit: undefined };\n}\n/**\n * Evaluate a math expression.\n *\n * @param {string} expression\n * @return {number} evaluated expression.\n */\nfunction calculate( expression ) {\n\ttry {\n\t\treturn Function( `'use strict'; return (${ expression })` )();\n\t} catch ( err ) {\n\t\treturn null;\n\t}\n}\n\n/**\n * Calculates the css function value for the supported css functions such as max, min, clamp and calc.\n *\n * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.\n * @param {Object} options\n * @return {string} unit containing the unit in PX.\n */\nfunction getFunctionUnitValue( functionUnitValue, options ) {\n\tconst functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );\n\n\tconst units = functionUnit\n\t\t.slice( 1 )\n\t\t.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )\n\t\t.filter( Boolean );\n\n\tswitch ( functionUnit[ 0 ] ) {\n\t\tcase 'min':\n\t\t\treturn Math.min( ...units ) + 'px';\n\t\tcase 'max':\n\t\t\treturn Math.max( ...units ) + 'px';\n\t\tcase 'clamp':\n\t\t\tif ( units.length !== 3 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( units[ 1 ] < units[ 0 ] ) {\n\t\t\t\treturn units[ 0 ] + 'px';\n\t\t\t}\n\t\t\tif ( units[ 1 ] > units[ 2 ] ) {\n\t\t\t\treturn units[ 2 ] + 'px';\n\t\t\t}\n\t\t\treturn units[ 1 ] + 'px';\n\t\tcase 'calc':\n\t\t\treturn units[ 0 ] + 'px';\n\t}\n}\n\n/**\n * Take a css function such as min, max, calc, clamp and returns parsedUnit\n *\n * How this works for the nested function is that it first replaces the inner function call.\n * Then it tackles the outer onces.\n * So for example: min( max(25px, 35px), 40px )\n * in the first pass we would replace max(25px, 35px) with 35px.\n * then we would try to evaluate min( 35px, 40px )\n * and then finally return 35px.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit object.\n */\nfunction parseUnitFunction( cssUnit ) {\n\twhile ( true ) {\n\t\tconst currentCssUnit = cssUnit;\n\t\tconst regExp = /(max|min|calc|clamp)\\(([^()]*)\\)/g;\n\t\tconst matches = regExp.exec( cssUnit ) || [];\n\t\tif ( matches[ 0 ] ) {\n\t\t\tconst functionUnitValue = getFunctionUnitValue( matches[ 0 ] );\n\t\t\tcssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );\n\t\t}\n\n\t\t// If the unit hasn't been modified or we have a single value break free.\n\t\tif ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn parseUnit( cssUnit );\n}\n/**\n * Return true if we think this is a math expression.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {boolean} Whether the cssUnit is a math expression.\n */\nfunction isMathExpression( cssUnit ) {\n\tfor ( let i = 0; i < cssUnit.length; i++ ) {\n\t\tif ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n/**\n * Evaluates the math expression and return a px value.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {string} return a converfted value to px.\n */\nfunction evalMathExpression( cssUnit ) {\n\tlet errorFound = false;\n\t// Convert every part of the expression to px values.\n\t// The following regex matches numbers that have a following unit\n\t// E.g. 5.25rem, 1vw\n\tconst cssUnitsBits = cssUnit.match( /\\d+\\.?\\d*[a-zA-Z]+|\\.\\d+[a-zA-Z]+/g );\n\tif ( cssUnitsBits ) {\n\t\tfor ( const unit of cssUnitsBits ) {\n\t\t\t// Standardize the unit to px and extract the value.\n\t\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\t\terrorFound = true;\n\t\t\t\t// End early since we are dealing with a null value.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t\t}\n\t} else {\n\t\terrorFound = true;\n\t}\n\n\t// For mixed math expressions wrapped within CSS expressions\n\tconst expressionsMatches = cssUnit.match( /(max|min|clamp)/g );\n\tif ( ! errorFound && expressionsMatches ) {\n\t\tconst values = cssUnit.split( ',' );\n\t\tfor ( const currentValue of values ) {\n\t\t\t// Check for nested calc() and remove them to calculate the value.\n\t\t\tconst rawCurrentValue = currentValue.replace( /\\s|calc/g, '' );\n\n\t\t\tif ( isMathExpression( rawCurrentValue ) ) {\n\t\t\t\tconst calculatedExpression = calculate( rawCurrentValue );\n\n\t\t\t\tif ( calculatedExpression ) {\n\t\t\t\t\tconst calculatedValue =\n\t\t\t\t\t\tcalculatedExpression.toFixed( 0 ) + 'px';\n\t\t\t\t\tcssUnit = cssUnit.replace( currentValue, calculatedValue );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst parsedValue = parseUnitFunction( cssUnit );\n\t\treturn ! parsedValue ? null : parsedValue.value + parsedValue.unit;\n\t}\n\n\tif ( errorFound ) {\n\t\treturn null;\n\t}\n\n\tconst calculatedResult = calculate( cssUnit );\n\treturn calculatedResult ? calculatedResult.toFixed( 0 ) + 'px' : null;\n}\n\n/**\n * Convert a parsedUnit object to px value.\n *\n * @param {Object} parsedUnit\n * @param {Object} options\n * @return {string} or {null} returns the converted with in a px value format.\n */\nfunction convertParsedUnitToPx( parsedUnit, options ) {\n\tconst PIXELS_PER_INCH = 96;\n\tconst ONE_PERCENT = 0.01;\n\n\tconst defaultProperties = {\n\t\tfontSize: 16,\n\t\tlineHeight: 16,\n\t\twidth: 375,\n\t\theight: 812,\n\t\ttype: 'font',\n\t};\n\n\tconst setOptions = Object.assign( {}, defaultProperties, options );\n\n\tconst relativeUnits = {\n\t\tem: setOptions.fontSize,\n\t\trem: setOptions.fontSize,\n\t\tvh: setOptions.height * ONE_PERCENT,\n\t\tvw: setOptions.width * ONE_PERCENT,\n\t\tvmin:\n\t\t\t( setOptions.width < setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\tvmax:\n\t\t\t( setOptions.width > setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\t'%':\n\t\t\t( setOptions.type === 'font'\n\t\t\t\t? setOptions.fontSize\n\t\t\t\t: setOptions.width ) * ONE_PERCENT,\n\t\tch: 8, // The advance measure (width) of the glyph \"0\" of the element's font. Approximate\n\t\tex: 7.15625, // X-height of the element's font. Approximate.\n\t\tlh: setOptions.lineHeight,\n\t};\n\n\tconst absoluteUnits = {\n\t\tin: PIXELS_PER_INCH,\n\t\tcm: PIXELS_PER_INCH / 2.54,\n\t\tmm: PIXELS_PER_INCH / 25.4,\n\t\tpt: PIXELS_PER_INCH / 72,\n\t\tpc: PIXELS_PER_INCH / 6,\n\t\tpx: 1,\n\t\tQ: PIXELS_PER_INCH / 2.54 / 40,\n\t};\n\n\tif ( relativeUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\tif ( absoluteUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Returns the px value of a cssUnit.\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nexport function getPxFromCssUnit( cssUnit, options = {} ) {\n\tif ( Number.isFinite( cssUnit ) ) {\n\t\treturn cssUnit.toFixed( 0 ) + 'px';\n\t}\n\tif ( cssUnit === undefined ) {\n\t\treturn null;\n\t}\n\tlet parsedUnit = parseUnit( cssUnit );\n\n\tif ( ! parsedUnit.unit ) {\n\t\tparsedUnit = parseUnitFunction( cssUnit );\n\t}\n\n\tif ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {\n\t\treturn evalMathExpression( cssUnit );\n\t}\n\n\treturn convertParsedUnitToPx( parsedUnit, options );\n}\n\n// Use simple cache.\nconst cache = {};\n/**\n * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nfunction memoizedGetPxFromCssUnit( cssUnit, options = {} ) {\n\tconst hash = cssUnit + hashOptions( options );\n\n\tif ( ! cache[ hash ] ) {\n\t\tcache[ hash ] = getPxFromCssUnit( cssUnit, options );\n\t}\n\treturn cache[ hash ];\n}\n\nfunction hashOptions( options ) {\n\tlet hash = '';\n\tif ( options.hasOwnProperty( 'fontSize' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'lineHeight' ) ) {\n\t\thash = ':' + options.lineHeight;\n\t}\n\tif ( options.hasOwnProperty( 'width' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'height' ) ) {\n\t\thash = ':' + options.height;\n\t}\n\tif ( options.hasOwnProperty( 'type' ) ) {\n\t\thash = ':' + options.type;\n\t}\n\treturn hash;\n}\n\nexport default memoizedGetPxFromCssUnit;\n"]}
|
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
.block-editor-block-inspector .components-panel__body {
|
|
165
165
|
border: none;
|
|
166
166
|
border-top: 1px solid #e0e0e0;
|
|
167
|
+
margin-top: -1px;
|
|
167
168
|
}
|
|
168
169
|
.block-editor-block-inspector .block-editor-block-card {
|
|
169
170
|
padding: 16px;
|
|
@@ -875,7 +876,7 @@
|
|
|
875
876
|
gap: 8px;
|
|
876
877
|
}
|
|
877
878
|
.block-editor-block-styles__variants .block-editor-block-styles__item {
|
|
878
|
-
color: #
|
|
879
|
+
color: #1e1e1e;
|
|
879
880
|
box-shadow: inset 0 0 0 1px #ccc;
|
|
880
881
|
display: inline-block;
|
|
881
882
|
width: calc(50% - 4px);
|
|
@@ -885,7 +886,7 @@
|
|
|
885
886
|
box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
|
|
886
887
|
}
|
|
887
888
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover {
|
|
888
|
-
background-color: #
|
|
889
|
+
background-color: #1e1e1e;
|
|
889
890
|
box-shadow: none;
|
|
890
891
|
}
|
|
891
892
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text {
|
|
@@ -1725,10 +1726,6 @@
|
|
|
1725
1726
|
order: 20;
|
|
1726
1727
|
}
|
|
1727
1728
|
|
|
1728
|
-
.components-button .block-editor-link-control__search-submit .has-icon {
|
|
1729
|
-
margin: -1px;
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
1729
|
.block-editor-link-control__search-results-wrapper {
|
|
1733
1730
|
position: relative;
|
|
1734
1731
|
margin-top: -15px;
|
|
@@ -3282,6 +3279,7 @@
|
|
|
3282
3279
|
.block-editor-inserter__popover.is-quick .components-popover__content {
|
|
3283
3280
|
border: none;
|
|
3284
3281
|
outline: none;
|
|
3282
|
+
box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1);
|
|
3285
3283
|
}
|
|
3286
3284
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * {
|
|
3287
3285
|
border-right: 1px solid #ccc;
|
|
@@ -3289,9 +3287,11 @@
|
|
|
3289
3287
|
}
|
|
3290
3288
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child {
|
|
3291
3289
|
border-top: 1px solid #ccc;
|
|
3290
|
+
border-radius: 2px 2px 0 0;
|
|
3292
3291
|
}
|
|
3293
3292
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child {
|
|
3294
3293
|
border-bottom: 1px solid #ccc;
|
|
3294
|
+
border-radius: 0 0 2px 2px;
|
|
3295
3295
|
}
|
|
3296
3296
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button {
|
|
3297
3297
|
border: 1px solid #1e1e1e;
|
package/build-style/style.css
CHANGED
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
.block-editor-block-inspector .components-panel__body {
|
|
165
165
|
border: none;
|
|
166
166
|
border-top: 1px solid #e0e0e0;
|
|
167
|
+
margin-top: -1px;
|
|
167
168
|
}
|
|
168
169
|
.block-editor-block-inspector .block-editor-block-card {
|
|
169
170
|
padding: 16px;
|
|
@@ -875,7 +876,7 @@
|
|
|
875
876
|
gap: 8px;
|
|
876
877
|
}
|
|
877
878
|
.block-editor-block-styles__variants .block-editor-block-styles__item {
|
|
878
|
-
color: #
|
|
879
|
+
color: #1e1e1e;
|
|
879
880
|
box-shadow: inset 0 0 0 1px #ccc;
|
|
880
881
|
display: inline-block;
|
|
881
882
|
width: calc(50% - 4px);
|
|
@@ -885,7 +886,7 @@
|
|
|
885
886
|
box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
|
|
886
887
|
}
|
|
887
888
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover {
|
|
888
|
-
background-color: #
|
|
889
|
+
background-color: #1e1e1e;
|
|
889
890
|
box-shadow: none;
|
|
890
891
|
}
|
|
891
892
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text {
|
|
@@ -1725,10 +1726,6 @@
|
|
|
1725
1726
|
order: 20;
|
|
1726
1727
|
}
|
|
1727
1728
|
|
|
1728
|
-
.components-button .block-editor-link-control__search-submit .has-icon {
|
|
1729
|
-
margin: -1px;
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
1729
|
.block-editor-link-control__search-results-wrapper {
|
|
1733
1730
|
position: relative;
|
|
1734
1731
|
margin-top: -15px;
|
|
@@ -3282,6 +3279,7 @@
|
|
|
3282
3279
|
.block-editor-inserter__popover.is-quick .components-popover__content {
|
|
3283
3280
|
border: none;
|
|
3284
3281
|
outline: none;
|
|
3282
|
+
box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1);
|
|
3285
3283
|
}
|
|
3286
3284
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * {
|
|
3287
3285
|
border-left: 1px solid #ccc;
|
|
@@ -3289,9 +3287,11 @@
|
|
|
3289
3287
|
}
|
|
3290
3288
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child {
|
|
3291
3289
|
border-top: 1px solid #ccc;
|
|
3290
|
+
border-radius: 2px 2px 0 0;
|
|
3292
3291
|
}
|
|
3293
3292
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child {
|
|
3294
3293
|
border-bottom: 1px solid #ccc;
|
|
3294
|
+
border-radius: 0 0 2px 2px;
|
|
3295
3295
|
}
|
|
3296
3296
|
.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button {
|
|
3297
3297
|
border: 1px solid #1e1e1e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,35 +33,35 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.4.5",
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^12.
|
|
40
|
-
"@wordpress/components": "^23.
|
|
41
|
-
"@wordpress/compose": "^6.
|
|
42
|
-
"@wordpress/data": "^8.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/escape-html": "^2.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/html-entities": "^3.
|
|
50
|
-
"@wordpress/i18n": "^4.
|
|
51
|
-
"@wordpress/icons": "^9.
|
|
52
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
53
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
54
|
-
"@wordpress/keycodes": "^3.
|
|
55
|
-
"@wordpress/notices": "^3.
|
|
56
|
-
"@wordpress/preferences": "^3.
|
|
57
|
-
"@wordpress/private-apis": "^0.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/shortcode": "^3.
|
|
60
|
-
"@wordpress/style-engine": "^1.
|
|
61
|
-
"@wordpress/token-list": "^2.
|
|
62
|
-
"@wordpress/url": "^3.
|
|
63
|
-
"@wordpress/warning": "^2.
|
|
64
|
-
"@wordpress/wordcount": "^3.
|
|
36
|
+
"@wordpress/a11y": "^3.29.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.26.0",
|
|
38
|
+
"@wordpress/blob": "^3.29.0",
|
|
39
|
+
"@wordpress/blocks": "^12.6.0",
|
|
40
|
+
"@wordpress/components": "^23.6.0",
|
|
41
|
+
"@wordpress/compose": "^6.6.0",
|
|
42
|
+
"@wordpress/data": "^8.6.0",
|
|
43
|
+
"@wordpress/date": "^4.29.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.29.0",
|
|
45
|
+
"@wordpress/dom": "^3.29.0",
|
|
46
|
+
"@wordpress/element": "^5.6.0",
|
|
47
|
+
"@wordpress/escape-html": "^2.29.0",
|
|
48
|
+
"@wordpress/hooks": "^3.29.0",
|
|
49
|
+
"@wordpress/html-entities": "^3.29.0",
|
|
50
|
+
"@wordpress/i18n": "^4.29.0",
|
|
51
|
+
"@wordpress/icons": "^9.20.0",
|
|
52
|
+
"@wordpress/is-shallow-equal": "^4.29.0",
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^4.6.0",
|
|
54
|
+
"@wordpress/keycodes": "^3.29.0",
|
|
55
|
+
"@wordpress/notices": "^3.29.0",
|
|
56
|
+
"@wordpress/preferences": "^3.6.0",
|
|
57
|
+
"@wordpress/private-apis": "^0.11.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.6.0",
|
|
59
|
+
"@wordpress/shortcode": "^3.29.0",
|
|
60
|
+
"@wordpress/style-engine": "^1.12.0",
|
|
61
|
+
"@wordpress/token-list": "^2.29.0",
|
|
62
|
+
"@wordpress/url": "^3.30.0",
|
|
63
|
+
"@wordpress/warning": "^2.29.0",
|
|
64
|
+
"@wordpress/wordcount": "^3.29.0",
|
|
65
65
|
"change-case": "^4.1.2",
|
|
66
66
|
"classnames": "^2.3.1",
|
|
67
67
|
"colord": "^2.7.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "9534a7b3bbf07c1d40b94fdb7a3d091f297bfb06"
|
|
87
87
|
}
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
import { __, _x } from '@wordpress/i18n';
|
|
5
5
|
import { Button, Modal } from '@wordpress/components';
|
|
6
6
|
import { useState, useCallback, useMemo } from '@wordpress/element';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { withDispatch, withSelect } from '@wordpress/data';
|
|
7
|
+
import { createBlock, rawHandler } from '@wordpress/blocks';
|
|
8
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Internal dependencies
|
|
@@ -15,38 +14,86 @@ import Warning from '../warning';
|
|
|
15
14
|
import BlockCompare from '../block-compare';
|
|
16
15
|
import { store as blockEditorStore } from '../../store';
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const blockToBlocks = ( block ) =>
|
|
18
|
+
rawHandler( {
|
|
19
|
+
HTML: block.originalContent,
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
export default function BlockInvalidWarning( { clientId } ) {
|
|
23
|
+
const { block, canInsertHTMLBlock, canInsertClassicBlock } = useSelect(
|
|
24
|
+
( select ) => {
|
|
25
|
+
const { canInsertBlockType, getBlock, getBlockRootClientId } =
|
|
26
|
+
select( blockEditorStore );
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
block: getBlock( clientId ),
|
|
32
|
+
canInsertHTMLBlock: canInsertBlockType(
|
|
33
|
+
'core/html',
|
|
34
|
+
rootClientId
|
|
35
|
+
),
|
|
36
|
+
canInsertClassicBlock: canInsertBlockType(
|
|
37
|
+
'core/freeform',
|
|
38
|
+
rootClientId
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
[ clientId ]
|
|
43
|
+
);
|
|
44
|
+
const { replaceBlock } = useDispatch( blockEditorStore );
|
|
45
|
+
|
|
46
|
+
const [ compare, setCompare ] = useState( false );
|
|
29
47
|
const onCompareClose = useCallback( () => setCompare( false ), [] );
|
|
30
48
|
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
const convert = useMemo(
|
|
50
|
+
() => ( {
|
|
51
|
+
toClassic() {
|
|
52
|
+
const classicBlock = createBlock( 'core/freeform', {
|
|
53
|
+
content: block.originalContent,
|
|
54
|
+
} );
|
|
55
|
+
return replaceBlock( block.clientId, classicBlock );
|
|
56
|
+
},
|
|
57
|
+
toHTML() {
|
|
58
|
+
const htmlBlock = createBlock( 'core/html', {
|
|
59
|
+
content: block.originalContent,
|
|
60
|
+
} );
|
|
61
|
+
return replaceBlock( block.clientId, htmlBlock );
|
|
62
|
+
},
|
|
63
|
+
toBlocks() {
|
|
64
|
+
const newBlocks = blockToBlocks( block );
|
|
65
|
+
return replaceBlock( block.clientId, newBlocks );
|
|
66
|
+
},
|
|
67
|
+
toRecoveredBlock() {
|
|
68
|
+
const recoveredBlock = createBlock(
|
|
69
|
+
block.name,
|
|
70
|
+
block.attributes,
|
|
71
|
+
block.innerBlocks
|
|
72
|
+
);
|
|
73
|
+
return replaceBlock( block.clientId, recoveredBlock );
|
|
74
|
+
},
|
|
75
|
+
} ),
|
|
76
|
+
[ block, replaceBlock ]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const secondaryActions = useMemo(
|
|
33
80
|
() =>
|
|
34
81
|
[
|
|
35
82
|
{
|
|
36
83
|
// translators: Button to fix block content
|
|
37
84
|
title: _x( 'Resolve', 'imperative verb' ),
|
|
38
|
-
onClick:
|
|
85
|
+
onClick: () => setCompare( true ),
|
|
39
86
|
},
|
|
40
|
-
|
|
87
|
+
canInsertHTMLBlock && {
|
|
41
88
|
title: __( 'Convert to HTML' ),
|
|
42
|
-
onClick:
|
|
89
|
+
onClick: convert.toHTML,
|
|
43
90
|
},
|
|
44
|
-
{
|
|
91
|
+
canInsertClassicBlock && {
|
|
45
92
|
title: __( 'Convert to Classic Block' ),
|
|
46
|
-
onClick:
|
|
93
|
+
onClick: convert.toClassic,
|
|
47
94
|
},
|
|
48
95
|
].filter( Boolean ),
|
|
49
|
-
[
|
|
96
|
+
[ canInsertHTMLBlock, canInsertClassicBlock, convert ]
|
|
50
97
|
);
|
|
51
98
|
|
|
52
99
|
return (
|
|
@@ -55,13 +102,13 @@ export function BlockInvalidWarning( {
|
|
|
55
102
|
actions={ [
|
|
56
103
|
<Button
|
|
57
104
|
key="recover"
|
|
58
|
-
onClick={
|
|
105
|
+
onClick={ convert.toRecoveredBlock }
|
|
59
106
|
variant="primary"
|
|
60
107
|
>
|
|
61
108
|
{ __( 'Attempt Block Recovery' ) }
|
|
62
109
|
</Button>,
|
|
63
110
|
] }
|
|
64
|
-
secondaryActions={
|
|
111
|
+
secondaryActions={ secondaryActions }
|
|
65
112
|
>
|
|
66
113
|
{ __( 'This block contains unexpected or invalid content.' ) }
|
|
67
114
|
</Warning>
|
|
@@ -76,8 +123,8 @@ export function BlockInvalidWarning( {
|
|
|
76
123
|
>
|
|
77
124
|
<BlockCompare
|
|
78
125
|
block={ block }
|
|
79
|
-
onKeep={
|
|
80
|
-
onConvert={
|
|
126
|
+
onKeep={ convert.toHTML }
|
|
127
|
+
onConvert={ convert.toBlocks }
|
|
81
128
|
convertor={ blockToBlocks }
|
|
82
129
|
convertButtonText={ __( 'Convert to Blocks' ) }
|
|
83
130
|
/>
|
|
@@ -86,42 +133,3 @@ export function BlockInvalidWarning( {
|
|
|
86
133
|
</>
|
|
87
134
|
);
|
|
88
135
|
}
|
|
89
|
-
|
|
90
|
-
const blockToClassic = ( block ) =>
|
|
91
|
-
createBlock( 'core/freeform', {
|
|
92
|
-
content: block.originalContent,
|
|
93
|
-
} );
|
|
94
|
-
const blockToHTML = ( block ) =>
|
|
95
|
-
createBlock( 'core/html', {
|
|
96
|
-
content: block.originalContent,
|
|
97
|
-
} );
|
|
98
|
-
const blockToBlocks = ( block ) =>
|
|
99
|
-
rawHandler( {
|
|
100
|
-
HTML: block.originalContent,
|
|
101
|
-
} );
|
|
102
|
-
const recoverBlock = ( { name, attributes, innerBlocks } ) =>
|
|
103
|
-
createBlock( name, attributes, innerBlocks );
|
|
104
|
-
|
|
105
|
-
export default compose( [
|
|
106
|
-
withSelect( ( select, { clientId } ) => ( {
|
|
107
|
-
block: select( blockEditorStore ).getBlock( clientId ),
|
|
108
|
-
} ) ),
|
|
109
|
-
withDispatch( ( dispatch, { block } ) => {
|
|
110
|
-
const { replaceBlock } = dispatch( blockEditorStore );
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
convertToClassic() {
|
|
114
|
-
replaceBlock( block.clientId, blockToClassic( block ) );
|
|
115
|
-
},
|
|
116
|
-
convertToHTML() {
|
|
117
|
-
replaceBlock( block.clientId, blockToHTML( block ) );
|
|
118
|
-
},
|
|
119
|
-
convertToBlocks() {
|
|
120
|
-
replaceBlock( block.clientId, blockToBlocks( block ) );
|
|
121
|
-
},
|
|
122
|
-
attemptBlockRecovery() {
|
|
123
|
-
replaceBlock( block.clientId, recoverBlock( block ) );
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
} ),
|
|
127
|
-
] )( BlockInvalidWarning );
|
|
@@ -98,7 +98,16 @@ exports[`Block Mover Picker should match snapshot 1`] = `
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
>
|
|
101
|
-
Svg
|
|
101
|
+
<Svg
|
|
102
|
+
colorScheme="light"
|
|
103
|
+
height={24}
|
|
104
|
+
style={{}}
|
|
105
|
+
viewBox="0 0 24 24"
|
|
106
|
+
width={24}
|
|
107
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
108
|
+
>
|
|
109
|
+
Path
|
|
110
|
+
</Svg>
|
|
102
111
|
</View>
|
|
103
112
|
</View>
|
|
104
113
|
</View>
|
|
@@ -157,7 +166,16 @@ exports[`Block Mover Picker should match snapshot 1`] = `
|
|
|
157
166
|
}
|
|
158
167
|
}
|
|
159
168
|
>
|
|
160
|
-
Svg
|
|
169
|
+
<Svg
|
|
170
|
+
colorScheme="light"
|
|
171
|
+
height={24}
|
|
172
|
+
style={{}}
|
|
173
|
+
viewBox="0 0 24 24"
|
|
174
|
+
width={24}
|
|
175
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
176
|
+
>
|
|
177
|
+
Path
|
|
178
|
+
</Svg>
|
|
161
179
|
</View>
|
|
162
180
|
</View>
|
|
163
181
|
</View>
|
|
@@ -48,7 +48,8 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
48
48
|
|
|
49
49
|
// Check if current selection of blocks is Groupable or Ungroupable
|
|
50
50
|
// and pass this props down to ConvertToGroupButton.
|
|
51
|
-
const convertToGroupButtonProps =
|
|
51
|
+
const convertToGroupButtonProps =
|
|
52
|
+
useConvertToGroupButtonProps( selectedClientIds );
|
|
52
53
|
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
53
54
|
const showConvertToGroupButton =
|
|
54
55
|
( isGroupable || isUngroupable ) && canRemove;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
gap: $grid-unit-10;
|
|
39
39
|
|
|
40
40
|
.block-editor-block-styles__item {
|
|
41
|
-
color: $gray-
|
|
41
|
+
color: $gray-900;
|
|
42
42
|
box-shadow: inset 0 0 0 1px $gray-400;
|
|
43
43
|
display: inline-block;
|
|
44
44
|
width: calc(50% - #{$grid-unit-05});
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
&.is-active,
|
|
53
53
|
&.is-active:hover {
|
|
54
|
-
background-color: $gray-
|
|
54
|
+
background-color: $gray-900;
|
|
55
55
|
box-shadow: none;
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -22,17 +22,18 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
22
22
|
display: -webkit-flex;
|
|
23
23
|
display: -ms-flexbox;
|
|
24
24
|
display: flex;
|
|
25
|
-
-webkit-align-items:
|
|
26
|
-
-webkit-box-align:
|
|
27
|
-
-ms-flex-align:
|
|
28
|
-
align-items:
|
|
25
|
+
-webkit-align-items: stretch;
|
|
26
|
+
-webkit-box-align: stretch;
|
|
27
|
+
-ms-flex-align: stretch;
|
|
28
|
+
align-items: stretch;
|
|
29
29
|
-webkit-flex-direction: column;
|
|
30
30
|
-ms-flex-direction: column;
|
|
31
31
|
flex-direction: column;
|
|
32
32
|
gap: calc(4px * 1);
|
|
33
|
-
-webkit-box-pack:
|
|
34
|
-
-
|
|
35
|
-
justify-content:
|
|
33
|
+
-webkit-box-pack: center;
|
|
34
|
+
-ms-flex-pack: center;
|
|
35
|
+
-webkit-justify-content: center;
|
|
36
|
+
justify-content: center;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
.emotion-4>* {
|
|
@@ -54,17 +55,18 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
54
55
|
display: -webkit-flex;
|
|
55
56
|
display: -ms-flexbox;
|
|
56
57
|
display: flex;
|
|
57
|
-
-webkit-align-items:
|
|
58
|
-
-webkit-box-align:
|
|
59
|
-
-ms-flex-align:
|
|
60
|
-
align-items:
|
|
58
|
+
-webkit-align-items: stretch;
|
|
59
|
+
-webkit-box-align: stretch;
|
|
60
|
+
-ms-flex-align: stretch;
|
|
61
|
+
align-items: stretch;
|
|
61
62
|
-webkit-flex-direction: column;
|
|
62
63
|
-ms-flex-direction: column;
|
|
63
64
|
flex-direction: column;
|
|
64
65
|
gap: calc(4px * 3);
|
|
65
|
-
-webkit-box-pack:
|
|
66
|
-
-
|
|
67
|
-
justify-content:
|
|
66
|
+
-webkit-box-pack: center;
|
|
67
|
+
-ms-flex-pack: center;
|
|
68
|
+
-webkit-justify-content: center;
|
|
69
|
+
justify-content: center;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
.emotion-8>* {
|