generator-chisel 2.0.0-alpha.4 → 2.0.0-alpha.5
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 +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Ajax.php +20 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AjaxEnpoints.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Assets.php +12 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Comments.php +6 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/GravityForms.php +31 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Helpers.php +13 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +65 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-mods.js +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks.js +0 -28
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js +103 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-spacer.js +28 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/utils.js +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor.js +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/login.js +9 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +47 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core.scss +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_form.scss +5 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/login.scss +7 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/icon.twig +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +1 -1
- package/lib/commands/create/packages-versions.js +1 -1
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-attributes.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## 2.0.0-alpha.5 (2024-09-27)
|
|
6
|
+
|
|
7
|
+
- bugs fixes, blocks mods, adjustments ([5a2b460](https://github.com/xfiveco/generator-chisel/commit/5a2b460))
|
|
8
|
+
|
|
5
9
|
## 2.0.0-alpha.4 (2024-09-16)
|
|
6
10
|
|
|
7
11
|
- adjust plugins ([bc2343a](https://github.com/xfiveco/generator-chisel/commit/bc2343a))
|
|
@@ -97,11 +97,8 @@ class Ajax extends \WP_REST_Controller implements Instance {
|
|
|
97
97
|
* @return callable
|
|
98
98
|
*/
|
|
99
99
|
public function callback( $request ) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
$callback = str_replace( '-', '_', end( $route_parts ) );
|
|
103
|
-
|
|
104
|
-
$ajax_endpoints = new AjaxEnpoints();
|
|
100
|
+
$callback = self::get_callback_name( $request );
|
|
101
|
+
$ajax_endpoints = new AjaxEnpoints();
|
|
105
102
|
|
|
106
103
|
if ( method_exists( $ajax_endpoints, $callback ) ) {
|
|
107
104
|
if ( ! defined( 'DOING_AJAX' ) ) {
|
|
@@ -124,7 +121,9 @@ class Ajax extends \WP_REST_Controller implements Instance {
|
|
|
124
121
|
* @return boolean
|
|
125
122
|
*/
|
|
126
123
|
public function permissions_check( $request ) {
|
|
127
|
-
|
|
124
|
+
$permission = apply_filters( 'chisel_ajax_permissions_check', true, self::get_callback_name( $request ), $request );
|
|
125
|
+
|
|
126
|
+
return $permission;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
/**
|
|
@@ -147,6 +146,21 @@ class Ajax extends \WP_REST_Controller implements Instance {
|
|
|
147
146
|
return (array) json_decode( stripslashes( $value ) );
|
|
148
147
|
}
|
|
149
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Get callback name from ajax request.
|
|
151
|
+
*
|
|
152
|
+
* @param \WP_REST_Request $request
|
|
153
|
+
*
|
|
154
|
+
* @return string
|
|
155
|
+
*/
|
|
156
|
+
public static function get_callback_name( $request ) {
|
|
157
|
+
$route = $request->get_route();
|
|
158
|
+
$route_parts = explode( '/', $route );
|
|
159
|
+
$callback = str_replace( '-', '_', end( $route_parts ) );
|
|
160
|
+
|
|
161
|
+
return $callback;
|
|
162
|
+
}
|
|
163
|
+
|
|
150
164
|
/**
|
|
151
165
|
* Get the instance of the class.
|
|
152
166
|
*/
|
|
@@ -40,7 +40,7 @@ class AjaxEnpoints {
|
|
|
40
40
|
)
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
$templates = array( 'components/
|
|
43
|
+
$templates = array( 'components/' . $post_type . '-item.twig', 'components/post-item.twig' );
|
|
44
44
|
|
|
45
45
|
if ( $post_type === 'product' ) {
|
|
46
46
|
array_unshift( $templates, 'woocommerce/content-product.twig' );
|
|
@@ -127,7 +127,7 @@ class Assets implements Instance {
|
|
|
127
127
|
'localize' => array(
|
|
128
128
|
'name' => 'chiselScripts',
|
|
129
129
|
'data' => array(
|
|
130
|
-
'
|
|
130
|
+
'logoData' => Helpers::get_login_page_logo_data(),
|
|
131
131
|
),
|
|
132
132
|
),
|
|
133
133
|
),
|
|
@@ -155,7 +155,17 @@ class Assets implements Instance {
|
|
|
155
155
|
);
|
|
156
156
|
|
|
157
157
|
$this->editor_scripts = array(
|
|
158
|
-
'editor' => array(
|
|
158
|
+
'editor' => array(
|
|
159
|
+
'localize' => array(
|
|
160
|
+
'name' => 'chiselEditorScripts',
|
|
161
|
+
'data' => array(
|
|
162
|
+
'icons' => array(
|
|
163
|
+
'minus' => __( 'Minus', 'chisel' ),
|
|
164
|
+
'plus' => __( 'Plus', 'chisel' ),
|
|
165
|
+
),
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
),
|
|
159
169
|
);
|
|
160
170
|
}
|
|
161
171
|
}
|
|
@@ -207,11 +207,15 @@ class Comments implements Instance {
|
|
|
207
207
|
<script>
|
|
208
208
|
wp.domReady( () => {
|
|
209
209
|
const blockType = 'core/latest-comments';
|
|
210
|
-
if (
|
|
210
|
+
if (!wp?.data) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if ( wp?.blocks && wp.data && wp.data.select( 'core/blocks' ).getBlockType( blockType ) ){
|
|
211
215
|
wp.blocks.unregisterBlockType( blockType );
|
|
212
216
|
}
|
|
213
217
|
|
|
214
|
-
wp.data.dispatch( 'core/edit-post')
|
|
218
|
+
wp.data.dispatch( 'core/edit-post')?.removeEditorPanel( 'discussion-panel' ); // Discussion
|
|
215
219
|
} );
|
|
216
220
|
</script>
|
|
217
221
|
<?php
|
|
@@ -40,6 +40,8 @@ class GravityForms implements Instance {
|
|
|
40
40
|
public function filter_hooks() {
|
|
41
41
|
add_filter( 'chisel_frontend_styles', array( $this, 'register_custom_styles' ) );
|
|
42
42
|
add_filter( 'chisel_enqueue_frontend_style', array( $this, 'enqueue_custom_styles' ), 10, 3 );
|
|
43
|
+
add_filter( 'gform_form_theme_slug', array( $this, 'default_form_styles' ), 99, 2 );
|
|
44
|
+
add_filter( 'gform_plugin_settings_fields', array( $this, 'plugin_settings_fields' ), 99 );
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -85,6 +87,35 @@ class GravityForms implements Instance {
|
|
|
85
87
|
return $enqueue;
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Set default form styles for all forms so that our custom styles can be used.
|
|
92
|
+
*
|
|
93
|
+
* @param string $slug
|
|
94
|
+
* @param array $form
|
|
95
|
+
*
|
|
96
|
+
* @return string
|
|
97
|
+
*/
|
|
98
|
+
public function default_form_styles( $slug, $form ) {
|
|
99
|
+
$slug = 'gravity-theme';
|
|
100
|
+
|
|
101
|
+
return $slug;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Remove default theme settings so that we can use our custom styles.
|
|
106
|
+
*
|
|
107
|
+
* @param array $fields
|
|
108
|
+
*
|
|
109
|
+
* @return array
|
|
110
|
+
*/
|
|
111
|
+
public function plugin_settings_fields( $fields ) {
|
|
112
|
+
if ( isset( $fields['default_theme'] ) ) {
|
|
113
|
+
unset( $fields['default_theme'] );
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return $fields;
|
|
117
|
+
}
|
|
118
|
+
|
|
88
119
|
/**
|
|
89
120
|
* Check if Gravity Forms plugin is active.
|
|
90
121
|
*
|
|
@@ -116,20 +116,25 @@ class Helpers {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Get logo
|
|
119
|
+
* Get logo data for the wp login page.
|
|
120
120
|
*
|
|
121
|
-
* @return
|
|
121
|
+
* @return array
|
|
122
122
|
*/
|
|
123
|
-
public static function
|
|
124
|
-
$
|
|
125
|
-
$
|
|
123
|
+
public static function get_login_page_logo_data() {
|
|
124
|
+
$logo_id = get_theme_mod( 'custom_logo', 0 );
|
|
125
|
+
$logo_data = array();
|
|
126
126
|
|
|
127
127
|
if ( $logo_id ) {
|
|
128
|
-
$
|
|
128
|
+
$logo_data = wp_get_attachment_image_src( $logo_id, 'medium' );
|
|
129
129
|
} else {
|
|
130
|
-
$
|
|
130
|
+
$logo_data = array(
|
|
131
|
+
self::get_image_url( 'chisel.png' ),
|
|
132
|
+
84,
|
|
133
|
+
84,
|
|
134
|
+
0,
|
|
135
|
+
);
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
return $
|
|
138
|
+
return $logo_data;
|
|
134
139
|
}
|
|
135
140
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
@use 'px-to-rem' as *;
|
|
4
4
|
|
|
5
5
|
@mixin button() {
|
|
6
|
+
box-sizing: border-box;
|
|
6
7
|
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
7
9
|
padding: get-padding('small') get-padding('medium');
|
|
8
10
|
font-size: get-font-size('normal');
|
|
9
11
|
font-weight: 400;
|
|
@@ -14,6 +16,21 @@
|
|
|
14
16
|
border: 1px solid transparent;
|
|
15
17
|
border-radius: get-border-radius('little');
|
|
16
18
|
transition: get-transition('normal');
|
|
19
|
+
|
|
20
|
+
&::after {
|
|
21
|
+
transition: get-transition('normal');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin button-disabled() {
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
cursor: default;
|
|
28
|
+
opacity: 0.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@mixin button-icon() {
|
|
32
|
+
padding-top: px-rem(14);
|
|
33
|
+
padding-bottom: px-rem(14);
|
|
17
34
|
}
|
|
18
35
|
|
|
19
36
|
@mixin button-primary() {
|
|
@@ -28,6 +45,12 @@
|
|
|
28
45
|
border-color: get-color('secondary');
|
|
29
46
|
}
|
|
30
47
|
|
|
48
|
+
@mixin button-primary-icon() {
|
|
49
|
+
&::after {
|
|
50
|
+
background-color: get-color('white');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
31
54
|
@mixin button-primary-outline() {
|
|
32
55
|
color: get-color('primary');
|
|
33
56
|
background-color: transparent;
|
|
@@ -40,6 +63,18 @@
|
|
|
40
63
|
border-color: get-color('primary');
|
|
41
64
|
}
|
|
42
65
|
|
|
66
|
+
@mixin button-primary-outline-icon() {
|
|
67
|
+
&::after {
|
|
68
|
+
background-color: get-color('primary');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@mixin button-primary-outline-icon-hover() {
|
|
73
|
+
&::after {
|
|
74
|
+
background-color: get-color('white');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
43
78
|
@mixin button-secondary() {
|
|
44
79
|
color: get-color('white');
|
|
45
80
|
background-color: get-color('secondary');
|
|
@@ -64,6 +99,18 @@
|
|
|
64
99
|
border-color: get-color('secondary');
|
|
65
100
|
}
|
|
66
101
|
|
|
102
|
+
@mixin button-secondary-outline-icon() {
|
|
103
|
+
&::after {
|
|
104
|
+
background-color: get-color('secondary');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@mixin button-secondary-outline-icon-hover() {
|
|
109
|
+
&::after {
|
|
110
|
+
background-color: get-color('white');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
67
114
|
@mixin button-tertiary() {
|
|
68
115
|
color: get-color('white');
|
|
69
116
|
background-color: get-color('black');
|
|
@@ -88,8 +135,26 @@
|
|
|
88
135
|
border-color: get-color('black');
|
|
89
136
|
}
|
|
90
137
|
|
|
138
|
+
@mixin button-tertiary-outline-icon() {
|
|
139
|
+
&::after {
|
|
140
|
+
background-color: get-color('black');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@mixin button-tertiary-outline-icon-hover() {
|
|
145
|
+
&::after {
|
|
146
|
+
background-color: get-color('white');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
91
150
|
@mixin button-small() {
|
|
92
151
|
padding: get-padding('little') get-padding('normal');
|
|
152
|
+
font-size: get-font-size('small');
|
|
153
|
+
line-height: get-line-height('normal');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@mixin button-large() {
|
|
157
|
+
padding: get-padding('normal') get-padding('large');
|
|
93
158
|
}
|
|
94
159
|
|
|
95
160
|
@mixin button-loading($color: currentColor) {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { addFilter } from '@wordpress/hooks';
|
|
2
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
3
|
-
import { useEffect } from '@wordpress/element';
|
|
4
1
|
import { select, subscribe } from '@wordpress/data';
|
|
5
2
|
|
|
6
3
|
class Blocks {
|
|
@@ -28,28 +25,3 @@ class Blocks {
|
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
new Blocks();
|
|
31
|
-
|
|
32
|
-
addFilter(
|
|
33
|
-
'editor.BlockEdit',
|
|
34
|
-
'chisel/blocks/blockEdit',
|
|
35
|
-
createHigherOrderComponent((BlockEdit) => {
|
|
36
|
-
return (props) => {
|
|
37
|
-
const { setAttributes, attributes, name } = props;
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (name === 'core/spacer') {
|
|
41
|
-
setAttributes({
|
|
42
|
-
height: 'auto',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}, [attributes?.height]);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<>
|
|
49
|
-
<BlockEdit key="edit" {...props} />
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
}, 'chisel/blocks/blockEdit'),
|
|
54
|
-
10,
|
|
55
|
-
);
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { addFilter } from '@wordpress/hooks';
|
|
3
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
4
|
+
import { Fragment } from '@wordpress/element';
|
|
5
|
+
import { PanelBody, SelectControl } from '@wordpress/components';
|
|
6
|
+
import { InspectorControls } from '@wordpress/blockEditor';
|
|
7
|
+
import Utils from '../utils';
|
|
8
|
+
|
|
9
|
+
const blockName = 'core/button';
|
|
10
|
+
const buttonSizes = [
|
|
11
|
+
{ label: __('Small', 'chisel'), value: 'small' },
|
|
12
|
+
{ label: __('Default', 'chisel'), value: '' },
|
|
13
|
+
{ label: __('Large', 'chisel'), value: 'large' },
|
|
14
|
+
];
|
|
15
|
+
const buttonIcons = [
|
|
16
|
+
{
|
|
17
|
+
label: __('None', 'chisel'),
|
|
18
|
+
value: '',
|
|
19
|
+
},
|
|
20
|
+
...Utils.generateIconsChoices(),
|
|
21
|
+
];
|
|
22
|
+
const buttonSizesClassNamesRegex = Utils.generateClassNamesRegex(buttonSizes, 'is-size');
|
|
23
|
+
const buttonIconsClassNamesRegex = Utils.generateClassNamesRegex(buttonIcons, 'has-icon');
|
|
24
|
+
|
|
25
|
+
// Add Custom Attributes
|
|
26
|
+
const chiselButtonBlockAttributes = (settings, name) => {
|
|
27
|
+
if (name === blockName) {
|
|
28
|
+
settings = Object.assign({}, settings, {
|
|
29
|
+
attributes: Object.assign({}, settings.attributes, {
|
|
30
|
+
buttonSize: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
buttonIcon: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return settings;
|
|
43
|
+
};
|
|
44
|
+
addFilter('blocks.registerBlockType', 'chisel/button-block', chiselButtonBlockAttributes);
|
|
45
|
+
|
|
46
|
+
const chiselButtonCustomControls = createHigherOrderComponent((BlockEdit) => {
|
|
47
|
+
return (props) => {
|
|
48
|
+
const { attributes, setAttributes, isSelected } = props;
|
|
49
|
+
|
|
50
|
+
let { buttonSize = '', className = '', buttonIcon = '' } = attributes;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Fragment>
|
|
54
|
+
<BlockEdit {...props} />
|
|
55
|
+
|
|
56
|
+
{isSelected && props.name === blockName && (
|
|
57
|
+
<InspectorControls>
|
|
58
|
+
<PanelBody title={__('Button Size', 'lps')}>
|
|
59
|
+
<SelectControl
|
|
60
|
+
label={__('Size', 'lps')}
|
|
61
|
+
options={buttonSizes}
|
|
62
|
+
value={buttonSize}
|
|
63
|
+
onChange={(value) => {
|
|
64
|
+
className = Utils.prepareClassName(className, buttonSizesClassNamesRegex);
|
|
65
|
+
|
|
66
|
+
if (value) {
|
|
67
|
+
className += ` ${`is-size-${value}`}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setAttributes({
|
|
71
|
+
buttonSize: value,
|
|
72
|
+
className,
|
|
73
|
+
});
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</PanelBody>
|
|
77
|
+
<PanelBody title={__('Button Icon', 'lps')}>
|
|
78
|
+
<SelectControl
|
|
79
|
+
label={__('Icon', 'lps')}
|
|
80
|
+
options={buttonIcons}
|
|
81
|
+
value={buttonIcon}
|
|
82
|
+
onChange={(value) => {
|
|
83
|
+
className = Utils.prepareClassName(className, buttonIconsClassNamesRegex);
|
|
84
|
+
className = className.replace('has-icon', '').trim();
|
|
85
|
+
|
|
86
|
+
if (value) {
|
|
87
|
+
className += ` has-icon ${`has-icon-${value}`}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setAttributes({
|
|
91
|
+
buttonIcon: value,
|
|
92
|
+
className,
|
|
93
|
+
});
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
</PanelBody>
|
|
97
|
+
</InspectorControls>
|
|
98
|
+
)}
|
|
99
|
+
</Fragment>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
}, 'coreButtonCustomControls');
|
|
103
|
+
addFilter('editor.BlockEdit', 'chisel/button-block', chiselButtonCustomControls);
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-spacer.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { addFilter } from '@wordpress/hooks';
|
|
2
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
3
|
+
import { useEffect } from '@wordpress/element';
|
|
4
|
+
|
|
5
|
+
addFilter(
|
|
6
|
+
'editor.BlockEdit',
|
|
7
|
+
'chisel/blocks/blockEdit',
|
|
8
|
+
createHigherOrderComponent((BlockEdit) => {
|
|
9
|
+
return (props) => {
|
|
10
|
+
const { setAttributes, attributes, name } = props;
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (name === 'core/spacer') {
|
|
14
|
+
setAttributes({
|
|
15
|
+
height: 'auto',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}, [attributes?.height]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<BlockEdit key="edit" {...props} />
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
}, 'chisel/blocks/blockEdit'),
|
|
27
|
+
10,
|
|
28
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* global chiselEditorScripts */
|
|
2
|
+
|
|
3
|
+
class Utils {
|
|
4
|
+
generateClassNamesRegex = (options, classPrefix) => {
|
|
5
|
+
const classNames = options
|
|
6
|
+
.map((option) => option.value)
|
|
7
|
+
.filter((className) => className !== '');
|
|
8
|
+
|
|
9
|
+
return new RegExp(`${classPrefix}-(${classNames.join('|')})`, 'gi');
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
prepareClassName = (className, classNames) => {
|
|
13
|
+
return className.replace(classNames, '').trim().replace('/[ ]{2,}/g', ' ');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
generateIconsChoices = () => {
|
|
17
|
+
const icons = chiselEditorScripts?.icons || null;
|
|
18
|
+
|
|
19
|
+
if (!icons) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const choices = [];
|
|
24
|
+
|
|
25
|
+
Object.entries(icons).forEach(([value, label]) => {
|
|
26
|
+
choices.push({
|
|
27
|
+
label,
|
|
28
|
+
value,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return choices;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default new Utils();
|
|
@@ -13,16 +13,22 @@ class LoginPage {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
this.logo = this.loginPage.querySelector('#login h1 a');
|
|
16
|
-
this.
|
|
16
|
+
this.logoData = chiselScripts?.logoData;
|
|
17
17
|
|
|
18
|
-
if (this.
|
|
18
|
+
if (this.logoData) {
|
|
19
19
|
this.setLogoImage();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
setLogoImage() {
|
|
24
24
|
if (this.logo) {
|
|
25
|
-
this.
|
|
25
|
+
const logoWidth = this.logoData[1] > 300 ? 300 : this.logoData[1];
|
|
26
|
+
const logoHeight = this.logoData[2] > 100 ? 100 : this.logoData[2];
|
|
27
|
+
|
|
28
|
+
this.logo.setAttribute(
|
|
29
|
+
'style',
|
|
30
|
+
`background-image: url("${this.logoData[0]}");width: ${logoWidth}px;height: ${logoHeight}px;`,
|
|
31
|
+
);
|
|
26
32
|
this.logo.setAttribute('aria-hidden', 'true');
|
|
27
33
|
this.logo.parentElement.classList.add(this.classnames.loaded);
|
|
28
34
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
@use '~design' as *;
|
|
2
|
+
@use '../../design/settings';
|
|
3
|
+
|
|
4
|
+
$_buttons-icons: settings.$buttons-icons;
|
|
2
5
|
|
|
3
6
|
.wp-block-button {
|
|
4
7
|
.wp-block-button__link {
|
|
5
8
|
@include button;
|
|
9
|
+
|
|
10
|
+
&.has-text-align-center {
|
|
11
|
+
justify-content: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:disabled {
|
|
15
|
+
@include button-disabled;
|
|
16
|
+
}
|
|
6
17
|
}
|
|
7
18
|
|
|
8
19
|
.wp-block-button__link,
|
|
9
20
|
&.is-style-primary .wp-block-button__link {
|
|
10
21
|
@include button-primary;
|
|
22
|
+
@include button-primary-icon;
|
|
11
23
|
|
|
12
24
|
&:hover,
|
|
13
25
|
&:focus {
|
|
@@ -17,10 +29,12 @@
|
|
|
17
29
|
|
|
18
30
|
&.is-style-primary-outline .wp-block-button__link {
|
|
19
31
|
@include button-primary-outline;
|
|
32
|
+
@include button-primary-outline-icon;
|
|
20
33
|
|
|
21
34
|
&:hover,
|
|
22
35
|
&:focus {
|
|
23
36
|
@include button-primary-outline-hover;
|
|
37
|
+
@include button-primary-outline-icon-hover;
|
|
24
38
|
}
|
|
25
39
|
}
|
|
26
40
|
|
|
@@ -35,10 +49,12 @@
|
|
|
35
49
|
|
|
36
50
|
&.is-style-secondary-outline .wp-block-button__link {
|
|
37
51
|
@include button-secondary-outline;
|
|
52
|
+
@include button-secondary-outline-icon;
|
|
38
53
|
|
|
39
54
|
&:hover,
|
|
40
55
|
&:focus {
|
|
41
56
|
@include button-secondary-outline-hover;
|
|
57
|
+
@include button-secondary-outline-icon-hover;
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
|
|
@@ -53,10 +69,41 @@
|
|
|
53
69
|
|
|
54
70
|
&.is-style-tertiary-outline .wp-block-button__link {
|
|
55
71
|
@include button-tertiary-outline;
|
|
72
|
+
@include button-tertiary-outline-icon;
|
|
56
73
|
|
|
57
74
|
&:hover,
|
|
58
75
|
&:focus {
|
|
59
76
|
@include button-tertiary-outline-hover;
|
|
77
|
+
@include button-tertiary-outline-icon-hover;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.is-size-small .wp-block-button__link {
|
|
82
|
+
@include button-small;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.is-size-large .wp-block-button__link {
|
|
86
|
+
@include button-large;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.has-icon {
|
|
90
|
+
@include button-icon;
|
|
91
|
+
|
|
92
|
+
.wp-block-button__link {
|
|
93
|
+
&::after {
|
|
94
|
+
width: px-rem(24);
|
|
95
|
+
height: px-rem(24);
|
|
96
|
+
margin-left: px-rem(8);
|
|
97
|
+
content: '';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@each $button-icon in $_buttons-icons {
|
|
103
|
+
&.has-icon-#{$button-icon} .wp-block-button__link {
|
|
104
|
+
&::after {
|
|
105
|
+
@include get-icon($button-icon);
|
|
106
|
+
}
|
|
60
107
|
}
|
|
61
108
|
}
|
|
62
109
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
@use '~design' as *;
|
|
2
|
+
@use '../../design/settings';
|
|
3
|
+
|
|
4
|
+
$_buttons-icons: settings.$buttons-icons;
|
|
2
5
|
|
|
3
6
|
.c-btn {
|
|
4
7
|
@include button;
|
|
@@ -6,10 +9,15 @@
|
|
|
6
9
|
&.is-loading {
|
|
7
10
|
@include button-loading;
|
|
8
11
|
}
|
|
12
|
+
|
|
13
|
+
&:disabled {
|
|
14
|
+
@include button-disabled;
|
|
15
|
+
}
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
.c-btn--primary {
|
|
12
19
|
@include button-primary;
|
|
20
|
+
@include button-primary-icon;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
.c-btn--primary:hover,
|
|
@@ -19,11 +27,13 @@
|
|
|
19
27
|
|
|
20
28
|
.c-btn--primary-outline {
|
|
21
29
|
@include button-primary-outline;
|
|
30
|
+
@include button-primary-outline-icon;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
.c-btn--primary-outline:hover,
|
|
25
34
|
.c-btn--primary-outline:focus {
|
|
26
35
|
@include button-primary-outline-hover;
|
|
36
|
+
@include button-primary-outline-icon-hover;
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
.c-btn--secondary {
|
|
@@ -37,11 +47,13 @@
|
|
|
37
47
|
|
|
38
48
|
.c-btn--secondary-outline {
|
|
39
49
|
@include button-secondary-outline;
|
|
50
|
+
@include button-secondary-outline-icon;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
.c-btn--secondary-outline:hover,
|
|
43
54
|
.c-btn--secondary-outline:focus {
|
|
44
55
|
@include button-secondary-outline-hover;
|
|
56
|
+
@include button-secondary-outline-icon-hover;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
.c-btn--tertiary {
|
|
@@ -55,13 +67,38 @@
|
|
|
55
67
|
|
|
56
68
|
.c-btn--tertiary-outline {
|
|
57
69
|
@include button-tertiary-outline;
|
|
70
|
+
@include button-tertiary-outline-icon;
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
.c-btn--tertiary-outline:hover,
|
|
61
74
|
.c-btn--tertiary-outline:focus {
|
|
62
75
|
@include button-tertiary-outline-hover;
|
|
76
|
+
@include button-tertiary-outline-icon-hover;
|
|
63
77
|
}
|
|
64
78
|
|
|
65
79
|
.c-btn--small {
|
|
66
80
|
@include button-small;
|
|
67
81
|
}
|
|
82
|
+
|
|
83
|
+
.c-btn--large {
|
|
84
|
+
@include button-large;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.c-btn.has-icon {
|
|
88
|
+
@include button-icon;
|
|
89
|
+
|
|
90
|
+
&::after {
|
|
91
|
+
width: px-rem(24);
|
|
92
|
+
height: px-rem(24);
|
|
93
|
+
margin-left: px-rem(8);
|
|
94
|
+
content: '';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@each $button-icon in $_buttons-icons {
|
|
99
|
+
.c-btn.has-icon-#{$button-icon} {
|
|
100
|
+
&::after {
|
|
101
|
+
@include get-icon($button-icon);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss
CHANGED
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
|
|
232
232
|
@include bp(large) {
|
|
233
233
|
.c-main-nav--columns {
|
|
234
|
-
.c-main-nav__item {
|
|
234
|
+
.c-main-nav__item:not(.is-default) {
|
|
235
235
|
position: static;
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.c-main-nav__subitems {
|
|
250
|
+
.c-main-nav__item:not(.is-default) .c-main-nav__subitems {
|
|
251
251
|
&.is-level-2 {
|
|
252
252
|
top: calc(100% - px-rem(16));
|
|
253
253
|
right: 0;
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_form.scss
CHANGED
|
@@ -32,7 +32,8 @@ $form-checkbox-radio-height: px-rem(18);
|
|
|
32
32
|
$form-label-margin: get-margin('little');
|
|
33
33
|
$form-select-arrow: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Ctitle%3Edown-arrow%3C%2Ftitle%3E%3Cg%20fill%3D%22%23000000%22%3E%3Cpath%20d%3D%22M10.293%2C3.293%2C6%2C7.586%2C1.707%2C3.293A1%2C1%2C0%2C0%2C0%2C.293%2C4.707l5%2C5a1%2C1%2C0%2C0%2C0%2C1.414%2C0l5-5a1%2C1%2C0%2C1%2C0-1.414-1.414Z%22%20fill%3D%22%23000000%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E');
|
|
34
34
|
|
|
35
|
-
/*
|
|
35
|
+
/* Some rules have an important declaration to overwrite gravity forms rules */
|
|
36
|
+
|
|
36
37
|
input,
|
|
37
38
|
select,
|
|
38
39
|
option,
|
|
@@ -71,9 +72,6 @@ input::file-selector-button {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
/* All elements with types */
|
|
75
|
-
|
|
76
|
-
/* Select and text-fields */
|
|
77
75
|
select,
|
|
78
76
|
.select2-container .select2-selection--single,
|
|
79
77
|
textarea,
|
|
@@ -89,11 +87,11 @@ input[type='text'],
|
|
|
89
87
|
input[type='time'],
|
|
90
88
|
input[type='url'],
|
|
91
89
|
input[type='week'] {
|
|
92
|
-
width: 100
|
|
90
|
+
width: 100% !important;
|
|
93
91
|
max-width: 100%;
|
|
94
|
-
padding: $form-field-padding;
|
|
92
|
+
padding: $form-field-padding !important;
|
|
95
93
|
margin: 0 0 $form-field-margin;
|
|
96
|
-
font-size: $form-field-font-size;
|
|
94
|
+
font-size: $form-field-font-size !important;
|
|
97
95
|
line-height: $form-field-line-height;
|
|
98
96
|
color: $form-field-color;
|
|
99
97
|
background-color: $form-field-bg-color;
|
|
@@ -138,15 +138,20 @@ body.login {
|
|
|
138
138
|
a {
|
|
139
139
|
display: block;
|
|
140
140
|
min-width: px-rem(84);
|
|
141
|
-
max-width:
|
|
141
|
+
max-width: px-rem(200);
|
|
142
|
+
height: auto;
|
|
142
143
|
max-height: px-rem(100);
|
|
143
144
|
margin: 0;
|
|
144
145
|
background-repeat: no-repeat;
|
|
145
146
|
background-position: center;
|
|
146
147
|
background-size: contain;
|
|
147
148
|
|
|
149
|
+
@include bp(360px) {
|
|
150
|
+
max-width: 100%;
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
@include bp(medium) {
|
|
149
|
-
max-width: px-rem(
|
|
154
|
+
max-width: px-rem(300);
|
|
150
155
|
}
|
|
151
156
|
}
|
|
152
157
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<i class="c-icon c-icon--{{ icon }}"></i>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.5",
|
|
4
4
|
"description": "A generator for scaffolding front-end and WordPress projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"chisel": "bin/chisel.js"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"tinyqueue": "^2.0.3",
|
|
38
38
|
"update-notifier": "^4.1.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f8767b71f2178288d9e37e3a44491b054e2a08ca"
|
|
41
41
|
}
|
|
File without changes
|