Skip to content

Commit 436194a

Browse files
kaeizenArukuen
andauthored
Feat: New Design Library Revamp (#3501)
* feat: size and spacing steps * working range with steps * fix: remove extra assignment * feat: add markmode in four range control * feat: apply preset controls to fontSize, padding, margin, height * feat: generate global css for presets * feat: size and spacing steps * working range with steps * fix: remove extra assignment * feat: add markmode in four range control * feat: apply preset controls to fontSize, padding, margin, height * feat: generate global css for presets * fix: apply generated css * fix: make fontSizes string to store CSS variables * fix: add default to prioritization * feat: support for custom presets * feat: dynamically add styles in editor * feat: dynamically add styles in editor with editor loader * fix: get current marked value, go to markmode * fix: css generation should consider custom, by each preset, not by property * fix: add additional functionalities to usePresetControls * fix: allow AdvancedRangeControl to set custom onReset * fix: do not add style for discarded presets * fix: add comments, title in generated css * fix: FourRangeControl markmode and initial value * feat: add row and column gap * feat: add blockHeight and borderRadius * feat: add blockHeight and borderRadius loader * fix: editorLoader merge * feat: Use Global Typography sizes as preset * feat: add vertical/horizontal to mark mode for four range * fix: removing of unit picker according to four range mode * fix: useTypographyAsPresets reactivity * feat: initial init * fix: separate none and custom, fix issue with setting to none * fix: selecting font pair/type scale overwritting previous changes * chore: move other functions to utils * fix: only get the new style for onChange, since changeStyle now handles merging * fix: set the value when changing from mark to custom * fix: typography min and max slider for rem * fix: use only "var" in detecting CSS variable * fix: FourRangeControl synchronization of markmode; default markmode * feat: add none presets to padding and margin similar to native * fix: use extractNumbersAndUnits that can process clamp, min, etc. * fix: add rem support to allow custom mode to have values when switching, convert from rem if only has px support * feat: support mimic/clamping by using WP generated presets * fix: global preset control title * feat: apply body to html * fix: add margin to apply html toggle * fix: remove hasCSSVariableValue, always assume that marks has string value * fix: get_option is never null * fix: use wp_json_file_decode * fix: remove JSON stringify since customPresets is just an array * fix: separate loading of presets in another function * fix: use wp_style_engine_get_stylesheet_from_css_rules to generate styles * fix: translate only the words * fix: move updating presets with typography to editor loader * fix: add typography deprecation for font size * fix: add block height deprecations * fix: add row and column gaps deprecations * fix: add row and column gaps deprecations * tweaked premium notice wording * fix: still match previous value even the custom values changes * fix: implement presets in the design system; fix issues with reactivity, variable type, units, etc. * fix: typography font size steps * fix: sync mark mode * fix: sync state when succeeding call to change styles * fixed value preview * fix: error in getting css var name * feat: add use size preset by default option * added more descriptive text * temporarily skip since the test breaks now * fix: two-way value conversion between preset and custom mode * version bump to 3.16.0 for the default option to kick in * version bump to 3.16.0 for the default option to kick in * prevent errors if upgrading and value is a number * optimized to prevent repetitive calls * fix: update markmode when changing device type * fix: move use size presets by default to editor settings * fix: saving of new typography * fix: only cofirm when font family is changed * fix: clean style object for comparison * update test for global typography * fix: remove unused hasCSSVariableValue * fix: add inner column spacing presets * fix: add inner column > inner column spacing presets * fix: also clean typography style for consistency * fix: consider unit conversion during two-way value conversion between preset and custom mode * fix: consider unit conversion during two-way value conversion between preset and custom mode * fix: remove placeholder for custom css in number input * fix: add fallback tooltip for theme.json data with no name like blocksy * fix: bug fixes * fix: bug fix * fix: four range reactivity * init * fix: do not actually change value when switching mode * remove error * fix render of preview * updates - modal for adding designs with disabled blocks - fix icon list substitution - fix style options spacing - hide design library modal header tabs - fix php error if download fails * fix preview of designs * updates - add default placeholder - fix adding background scheme - fix adding margins on root * update placeholder defaults * fix fatal error * fix issues from user testing - modify disabled blocks tooltip - fix block style inheritance not being applied - change 'add color scheme' to 'manage color scheme' - add style option tooltips * updates - remove "Stackable" from design labels - update tooltip for style options - update checking of image if it's already in media library * add fixes - fix footer size when there are no designs - fix designs not showing up unless a category is selected * fix color schemes not being applied * add other categories, add background to category * fix spinner when fetching from cloud * add confirm dialog when going to color schemes * add plain button compatibility for tove * add default placeholders for testimonials * update blocklist * fix issues - modify color schemes dropdown - fix paddings disappearing when global settings have value * fix remaining issues * apply fixes - remove margin bottom - remove plan dropdown - fix warning * add fixes - grayed toggle for premium - fix pro note * update placeholders * fix scale for selected designs when switching categories * fix error handling for image download/upload * update placeholders, fix design render * remove designs for v2 * update designs * inherit text color for subtitle --------- Co-authored-by: [email protected] <> Co-authored-by: Alquen Sarmiento <[email protected]>
1 parent f3fc365 commit 436194a

File tree

35 files changed

+2813
-945
lines changed

35 files changed

+2813
-945
lines changed

src/block/design-library/edit.js

Lines changed: 293 additions & 122 deletions
Large diffs are not rendered by default.

src/block/icon-list/substitute.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
export const substitute = {
22
from: 'stackable/icon-list',
3-
transform: () => {
3+
transform: ( oldAttributes, innerBlocks ) => {
4+
const newInnerBlocks = innerBlocks.reduce( ( newInnerBlocks, innerBlock ) => {
5+
const attributes = innerBlock[ 1 ]
6+
7+
newInnerBlocks.push( [ 'core/list-item', { content: attributes.text } ] )
8+
return newInnerBlocks
9+
}, [] )
410
return [
511
'core/list',
612
{},
7-
[
8-
[ 'core/list-item', { content: 'First item list' } ],
9-
[ 'core/list-item', { content: 'Second item list' } ],
10-
[ 'core/list-item', { content: 'Third item list' } ],
11-
],
13+
newInnerBlocks,
1214
]
1315
},
1416
}

src/compatibility/tove/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:where(.stk-has-block-style-inheritance.stk--is-tove-theme) :is(.stk-block-button, .stk-block-icon-button, .stk-block-pagination):is(.is-style-plain) .stk-button {
2+
border-width: 0;
3+
box-shadow: none;
4+
}

src/components/color-scheme-preview/editor.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,15 @@
7676
.stk-scheme--is-disabled {
7777
opacity: 0.1;
7878
}
79+
80+
.stk-scheme--is-collapsed {
81+
flex-direction: row;
82+
gap: 4px;
83+
align-items: center;
84+
max-height: 30px;
85+
86+
.stk-global-color-scheme__preview__typography {
87+
margin-bottom: 0;
88+
font-size: 12px;
89+
}
90+
}

src/components/color-scheme-preview/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ export const DEFAULT_COLOR_SCHEME_COLORS = {
1414
const NOOP = () => {}
1515

1616
const ColorSchemePreview = ( {
17-
colors, withWrapper = false, onClick = NOOP, isDisabled = false,
17+
colors,
18+
withWrapper = false,
19+
onClick = NOOP,
20+
isDisabled = false,
21+
isCollapsed = false,
1822
} ) => {
1923
const TagName = onClick === NOOP ? 'div' : Button
2024
const additionalProps = onClick === NOOP ? {} : { onClick }
2125

2226
const classNames = classnames( 'stk-global-color-scheme__preview__background', {
2327
'stk-scheme--is-disabled': isDisabled,
28+
'stk-scheme--is-collapsed': isCollapsed,
2429
} )
2530

2631
return (

src/components/color-schemes-help/index.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ import { Link } from '~stackable/components'
44
import { __ } from '@wordpress/i18n'
55
import { dispatch } from '@wordpress/data'
66

7-
export const ColorSchemesHelp = () => {
7+
export const ColorSchemesHelp = props => {
8+
const {
9+
customText, callback, className,
10+
} = props
811
const onClick = () => {
12+
let cancelOnClick = false
13+
if ( callback ) {
14+
cancelOnClick = callback()
15+
}
16+
17+
if ( cancelOnClick ) {
18+
return
19+
}
20+
921
// Open the global settings sidebar.
1022
dispatch( 'core/edit-post' )?.openGeneralSidebar( 'stackable-global-settings/sidebar' ) // For Block Editor
1123
dispatch( 'core/edit-site' )?.openGeneralSidebar( 'stackable-global-settings/sidebar' ) // For Site Editor
@@ -31,9 +43,10 @@ export const ColorSchemesHelp = () => {
3143
}
3244

3345
return <>
34-
<span>{ __( 'Change the color scheme.', i18n ) }</span>
35-
&nbsp;
36-
<Link onClick={ onClick }> { __( 'Manage your color schemes.', i18n ) } </Link>
46+
{ customText || customText === '' ? customText
47+
: <span>{ __( 'Change the color scheme.', i18n ) }</span> }
48+
{ customText !== '' && <>&nbsp;</> }
49+
<Link className={ className } onClick={ onClick }> { __( 'Manage your color schemes.', i18n ) } </Link>
3750
</>
3851
}
3952

src/components/design-library-list/default.json

Lines changed: 502 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)