generator-chisel 2.0.0-alpha.3 → 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.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/commands/create/creators/app/chisel-starter-theme/.gitignore.chisel-tpl +1 -0
  3. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Ajax.php +20 -6
  4. package/lib/commands/create/creators/app/chisel-starter-theme/classes/AjaxEnpoints.php +1 -1
  5. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Assets.php +36 -18
  6. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Comments.php +6 -2
  7. package/lib/commands/create/creators/app/chisel-starter-theme/classes/GravityForms.php +31 -0
  8. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Helpers.php +13 -8
  9. package/lib/commands/create/creators/app/chisel-starter-theme/classes/RegisterBlocks.php +1 -1
  10. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +4 -4
  11. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +65 -0
  12. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-mods.js +2 -0
  13. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks.js +0 -28
  14. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js +103 -0
  15. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-spacer.js +28 -0
  16. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/utils.js +36 -0
  17. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor.js +1 -0
  18. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/login.js +11 -2
  19. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +47 -0
  20. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core.scss +4 -0
  21. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +37 -0
  22. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +2 -2
  23. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_form.scss +5 -7
  24. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/login.scss +7 -2
  25. package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +6 -16
  26. package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +6 -2
  27. package/lib/commands/create/creators/app/chisel-starter-theme/views/404.twig +2 -2
  28. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/icon.twig +1 -0
  29. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/slider.twig +1 -1
  30. package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +1 -1
  31. package/lib/commands/create/creators/wp-plugins/plugins.json +1 -3
  32. package/lib/commands/create/packages-versions.js +1 -1
  33. package/package.json +2 -2
  34. package/lib/commands/create/creators/app/chisel-starter-theme/lint-staged.config.mjs +0 -8
  35. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-attributes.js +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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
+
9
+ ## 2.0.0-alpha.4 (2024-09-16)
10
+
11
+ - adjust plugins ([bc2343a](https://github.com/xfiveco/generator-chisel/commit/bc2343a))
12
+ - bug fixes, phpcs and twigcs fixes ([118297b](https://github.com/xfiveco/generator-chisel/commit/118297b))
13
+ - remove lint staged (it is in coding standards) ([e51b4b6](https://github.com/xfiveco/generator-chisel/commit/e51b4b6))
14
+ - remove unnecessary gitignore ([f48e528](https://github.com/xfiveco/generator-chisel/commit/f48e528))
15
+ - scripts enqueueing fixes ([5a8badf](https://github.com/xfiveco/generator-chisel/commit/5a8badf))
16
+ - theme gitignore update ([9ef8d60](https://github.com/xfiveco/generator-chisel/commit/9ef8d60))
17
+ - twig cs adjustments ([84493cd](https://github.com/xfiveco/generator-chisel/commit/84493cd))
18
+
5
19
  ## 2.0.0-alpha.3 (2024-09-13)
6
20
 
7
21
  - refactor, adjustments, css spliting, comments, 3rd party integration classes ([e1fe3cd](https://github.com/xfiveco/generator-chisel/commit/e1fe3cd))
@@ -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
- $route = $request->get_route();
101
- $route_parts = explode( '/', $route );
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
- return true;
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/post-item.twig', 'components/' . $post_type . '-item.twig' );
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
- 'logoData' => Helpers::get_login_page_logo_url(),
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
  }
@@ -259,9 +269,10 @@ class Assets implements Instance {
259
269
  if ( $this->frontend_styles ) {
260
270
  foreach ( $this->frontend_styles as $handle => $args ) {
261
271
  $enqueue_style = apply_filters( 'chisel_enqueue_frontend_style', true, $handle, $args );
272
+ $style_handle = self::get_final_handle( $handle );
262
273
 
263
- if ( $enqueue_style ) {
264
- wp_enqueue_style( self::get_final_handle( $handle ) );
274
+ if ( $enqueue_style && wp_style_is( $style_handle, 'registered' ) ) {
275
+ wp_enqueue_style( $style_handle );
265
276
 
266
277
  // Enqueue js file for fast refresh of the css file.
267
278
  $this->enqueue_style_js_for_dev( $handle );
@@ -272,9 +283,10 @@ class Assets implements Instance {
272
283
  if ( $this->frontend_scripts ) {
273
284
  foreach ( $this->frontend_scripts as $handle => $args ) {
274
285
  $enqueue_script = apply_filters( 'chisel_enqueue_frontend_script', true, $handle, $args );
286
+ $script_handle = self::get_final_handle( $handle );
275
287
 
276
- if ( $enqueue_script ) {
277
- wp_enqueue_script( self::get_final_handle( $handle ) );
288
+ if ( $enqueue_script && wp_script_is( $script_handle, 'registered' ) ) {
289
+ wp_enqueue_script( $script_handle );
278
290
  $this->set_script_translations( $handle, $args );
279
291
  }
280
292
  }
@@ -291,9 +303,10 @@ class Assets implements Instance {
291
303
  if ( $this->admin_styles ) {
292
304
  foreach ( $this->admin_styles as $handle => $args ) {
293
305
  $enqueue_style = apply_filters( 'chisel_enqueue_admin_style', true, $handle, $args );
306
+ $style_handle = self::get_final_handle( $handle );
294
307
 
295
- if ( $enqueue_style ) {
296
- wp_enqueue_style( self::get_final_handle( $handle ) );
308
+ if ( $enqueue_style && wp_style_is( $style_handle, 'registered' ) ) {
309
+ wp_enqueue_style( $style_handle );
297
310
 
298
311
  // Enqueue js file for fast refresh of the css file.
299
312
  $this->enqueue_style_js_for_dev( $handle );
@@ -304,9 +317,10 @@ class Assets implements Instance {
304
317
  if ( $this->admin_scripts ) {
305
318
  foreach ( $this->admin_scripts as $handle => $args ) {
306
319
  $enqueue_script = apply_filters( 'chisel_enqueue_admin_script', true, $handle, $args );
320
+ $script_handle = self::get_final_handle( $handle );
307
321
 
308
- if ( $enqueue_script ) {
309
- wp_enqueue_script( self::get_final_handle( $handle ) );
322
+ if ( $enqueue_script && wp_script_is( $script_handle, 'registered' ) ) {
323
+ wp_enqueue_script( $script_handle );
310
324
  $this->set_script_translations( $handle, $args );
311
325
  }
312
326
  }
@@ -323,9 +337,10 @@ class Assets implements Instance {
323
337
  if ( $this->editor_styles ) {
324
338
  foreach ( $this->editor_styles as $handle => $args ) {
325
339
  $enqueue_style = apply_filters( 'chisel_enqueue_editor_style', true, $handle, $args );
340
+ $style_handle = self::get_final_handle( $handle );
326
341
 
327
- if ( $enqueue_style ) {
328
- wp_enqueue_style( self::get_final_handle( $handle ) );
342
+ if ( $enqueue_style && wp_style_is( $style_handle, 'registered' ) ) {
343
+ wp_enqueue_style( $style_handle );
329
344
 
330
345
  // Enqueue js file for fast refresh of the css file.
331
346
  $this->enqueue_style_js_for_dev( $handle );
@@ -336,9 +351,10 @@ class Assets implements Instance {
336
351
  if ( $this->editor_scripts ) {
337
352
  foreach ( $this->editor_scripts as $handle => $args ) {
338
353
  $enqueue_script = apply_filters( 'chisel_enqueue_editor_script', true, $handle, $args );
354
+ $script_handle = self::get_final_handle( $handle );
339
355
 
340
- if ( $enqueue_script ) {
341
- wp_enqueue_script( self::get_final_handle( $handle ) );
356
+ if ( $enqueue_script && wp_script_is( $script_handle, 'registered' ) ) {
357
+ wp_enqueue_script( $script_handle );
342
358
  $this->set_script_translations( $handle, $args );
343
359
  }
344
360
  }
@@ -364,9 +380,10 @@ class Assets implements Instance {
364
380
  if ( $this->login_styles ) {
365
381
  foreach ( $this->login_styles as $handle => $args ) {
366
382
  $enqueue_style = apply_filters( 'chisel_enqueue_login_style', true, $handle, $args );
383
+ $style_handle = self::get_final_handle( $handle );
367
384
 
368
- if ( $enqueue_style ) {
369
- wp_enqueue_style( self::get_final_handle( $handle ) );
385
+ if ( $enqueue_style && wp_style_is( $style_handle, 'registered' ) ) {
386
+ wp_enqueue_style( $style_handle );
370
387
 
371
388
  // Enqueue js file for fast refresh of the css file.
372
389
  $this->enqueue_style_js_for_dev( $handle );
@@ -377,9 +394,10 @@ class Assets implements Instance {
377
394
  if ( $this->login_scripts ) {
378
395
  foreach ( $this->login_scripts as $handle => $args ) {
379
396
  $enqueue_script = apply_filters( 'chisel_enqueue_login_script', true, $handle, $args );
397
+ $script_handle = self::get_final_handle( $handle );
380
398
 
381
- if ( $enqueue_script ) {
382
- wp_enqueue_script( self::get_final_handle( $handle ) );
399
+ if ( $enqueue_script && wp_script_is( $script_handle, 'registered' ) ) {
400
+ wp_enqueue_script( $script_handle );
383
401
  $this->set_script_translations( $handle, $args );
384
402
  }
385
403
  }
@@ -207,11 +207,15 @@ class Comments implements Instance {
207
207
  <script>
208
208
  wp.domReady( () => {
209
209
  const blockType = 'core/latest-comments';
210
- if ( wp.blocks && wp.data && wp.data.select( 'core/blocks' ).getBlockType( blockType ) ){
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').removeEditorPanel( 'discussion-panel' ); // Discussion
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 url for the wp login page.
119
+ * Get logo data for the wp login page.
120
120
  *
121
- * @return string
121
+ * @return array
122
122
  */
123
- public static function get_login_page_logo_url() {
124
- $logo_url = '';
125
- $logo_id = get_theme_mod( 'custom_logo', 0 );
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
- $logo_url = wp_get_attachment_image_url( $logo_id, 'medium' );
128
+ $logo_data = wp_get_attachment_image_src( $logo_id, 'medium' );
129
129
  } else {
130
- $logo_url = self::get_image_url( 'chisel.png' );
130
+ $logo_data = array(
131
+ self::get_image_url( 'chisel.png' ),
132
+ 84,
133
+ 84,
134
+ 0,
135
+ );
131
136
  }
132
137
 
133
- return $logo_url;
138
+ return $logo_data;
134
139
  }
135
140
  }
@@ -189,7 +189,7 @@ abstract class RegisterBlocks {
189
189
  $block
190
190
  );
191
191
 
192
- if ( ! in_array( $script, $ignore_scripts ) ) {
192
+ if ( ! in_array( $script, $ignore_scripts, true ) ) {
193
193
  wp_register_script(
194
194
  $block_handle,
195
195
  $file_url,
@@ -1,12 +1,12 @@
1
- {% set slidesHtml = '' %}
1
+ {% set slides_html = '' %}
2
2
 
3
3
  <div {{ wrapper_attributes }} data-block-id="{{ block.id }}">
4
4
  <div class="b-slider__inner alignfull">
5
5
  {% if fields.acf_block_slider_slides is not empty %}
6
6
  {% for slide in fields.acf_block_slider_slides %}
7
7
  {% if slide.acf_bs_image %}
8
- {% set slidesHtml %}
9
- {{slidesHtml}}
8
+ {% set slides_html %}
9
+ {{ slides_html }}
10
10
  <div class="b-slider__slide swiper-slide" data-thumbnail-url="{{ get_image(slide.acf_bs_image).src('medium') }}">
11
11
  {{ get_responsive_image(slide.acf_bs_image, 'large') }}
12
12
  </div>
@@ -15,7 +15,7 @@
15
15
  {% endfor %}
16
16
 
17
17
  {% include 'components/slider.twig' with {
18
- slidesHtml,
18
+ slides_html,
19
19
  params: {
20
20
  'slides-per-view': 1,
21
21
  block_settings: fields.slider_options
@@ -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) {
@@ -0,0 +1,2 @@
1
+ import './mods/core-button';
2
+ import './mods/core-spacer';
@@ -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
- );
@@ -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);
@@ -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();
@@ -1,2 +1,3 @@
1
1
  import './editor/blocks-styles';
2
2
  import './editor/blocks';
3
+ import './editor/blocks-mods';
@@ -13,13 +13,22 @@ class LoginPage {
13
13
  };
14
14
 
15
15
  this.logo = this.loginPage.querySelector('#login h1 a');
16
+ this.logoData = chiselScripts?.logoData;
16
17
 
17
- this.setLogoImage();
18
+ if (this.logoData) {
19
+ this.setLogoImage();
20
+ }
18
21
  }
19
22
 
20
23
  setLogoImage() {
21
24
  if (this.logo) {
22
- this.logo.setAttribute('style', `background-image: url("${chiselScripts.logoUrl}");`);
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
+ );
23
32
  this.logo.setAttribute('aria-hidden', 'true');
24
33
  this.logo.parentElement.classList.add(this.classnames.loaded);
25
34
  }
@@ -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
  }
@@ -64,3 +64,7 @@
64
64
  border-radius: get-border-radius('normal');
65
65
  }
66
66
  }
67
+
68
+ .has-text-align-center {
69
+ text-align: center;
70
+ }
@@ -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
+ }
@@ -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;
@@ -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
- /* All elements regardless of types */
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: 100%;
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(400);
154
+ max-width: px-rem(300);
150
155
  }
151
156
  }
152
157
 
@@ -78,10 +78,7 @@
78
78
  ],
79
79
  "duotone": [
80
80
  {
81
- "colors": [
82
- "#2a1468",
83
- "#ff6d54"
84
- ],
81
+ "colors": ["#2a1468", "#ff6d54"],
85
82
  "slug": "primary-secondary",
86
83
  "name": "Primary & Secondary"
87
84
  }
@@ -185,7 +182,7 @@
185
182
  "fontStyle": "normal",
186
183
  "fontStretch": "normal",
187
184
  "fontDisplay": "swap",
188
- "src": [ "file:./fonts/quicksand-regular.woff2" ]
185
+ "src": ["file:./assets/fonts/quicksand-regular.woff2"]
189
186
  },
190
187
  {
191
188
  "fontFamily": "Quicksand",
@@ -193,7 +190,7 @@
193
190
  "fontStyle": "normal",
194
191
  "fontStretch": "normal",
195
192
  "fontDisplay": "swap",
196
- "src": [ "file:./fonts/quicksand-700.woff2" ]
193
+ "src": ["file:./assets/fonts/quicksand-700.woff2"]
197
194
  }
198
195
  ]
199
196
  }
@@ -206,21 +203,14 @@
206
203
  "width": false
207
204
  },
208
205
  "layout": {
209
- "contentSize": "1200px",
210
- "wideSize": "1440px"
206
+ "contentSize": "1200px",
207
+ "wideSize": "1440px"
211
208
  },
212
209
  "spacing": {
213
210
  "blockGap": false,
214
211
  "margin": false,
215
212
  "padding": false,
216
- "units": [
217
- "%",
218
- "px",
219
- "em",
220
- "rem",
221
- "vh",
222
- "vw"
223
- ],
213
+ "units": ["%", "px", "em", "rem", "vh", "vw"],
224
214
  "defaultSpacingSizes": false,
225
215
  "spacingScale": {
226
216
  "operator": "+",
@@ -3,10 +3,14 @@ declare(strict_types=1);
3
3
 
4
4
  use FriendsOfTwig\Twigcs;
5
5
 
6
- $finder = Twigcs\Finder\TemplateFinder::create()->in( __DIR__ . '/views' );
6
+ $finder_1 = Twigcs\Finder\TemplateFinder::create()->in( __DIR__ . '/views' );
7
+ $finder_2 = Twigcs\Finder\TemplateFinder::create()->in( __DIR__ . '/build/blocks' );
8
+ $finder_3 = Twigcs\Finder\TemplateFinder::create()->in( __DIR__ . '/build/blocks-acf' );
7
9
 
8
10
  return Twigcs\Config\Config::create()
9
- ->addFinder( $finder )
11
+ ->addFinder( $finder_1 )
12
+ ->addFinder( $finder_2 )
13
+ ->addFinder( $finder_3 )
10
14
  ->setName( 'chisel' )
11
15
  ->setSeverity( 'warning' )
12
16
  ->setDisplay( Twigcs\Config\ConfigInterface::DISPLAY_BLOCKING )
@@ -1,7 +1,7 @@
1
1
  {% extends "single.twig" %}
2
2
 
3
3
  {% block inner_content %}
4
- <h1>{{ __( '404 - Not found', 'chisel' ) }}</h1>
5
- <h2>{{ __( 'Sorry, we couldn\'t find what you\'re looking for', 'chisel' ) }}</h2>
4
+ <h1>{{ __('404 - Not found', 'chisel') }}</h1>
5
+ <h2>{{ __('Sorry, we couldn\'t find what you\'re looking for', 'chisel') }}</h2>
6
6
  {% endblock %}
7
7
 
@@ -0,0 +1 @@
1
+ <i class="c-icon c-icon--{{ icon }}"></i>
@@ -6,7 +6,7 @@
6
6
  <!-- Additional required wrapper -->
7
7
  <div class="swiper-wrapper c-slider__slides">
8
8
  <!-- Slides html. Each slide must have a 'swiper-slide' class -->
9
- {{ slidesHtml }}
9
+ {{ slides_html }}
10
10
  </div>
11
11
  </div>
12
12
  </div>
@@ -17,7 +17,7 @@
17
17
  {% include "components/post-item.twig" with {post: post} %}
18
18
  {% endfor %}
19
19
  {% else %}
20
- dupa
20
+ <h2>{{ __('No results found', 'chisel') }}</h2>
21
21
  {% endif %}
22
22
  </div>
23
23
 
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "plugins": {
3
- "Classic Editor": "classic-editor",
4
3
  "WP Premium: Gravity Forms": "https://github.com/wp-premium/gravityforms/archive/master.zip",
5
- "WP Sync DB": "https://github.com/wp-sync-db/wp-sync-db/archive/master.zip",
6
- "WP Sync DB Media File Addon": "https://github.com/wp-sync-db/wp-sync-db-media-files/archive/master.zip"
4
+ "WP Migrate Lite": "wp-migrate-db"
7
5
  }
8
6
  }
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
2
  'chisel-scripts': '2.0.0-alpha.1',
3
3
  'chisel-shared-utils': '2.0.0-alpha.0',
4
- 'generator-chisel': '2.0.0-alpha.3',
4
+ 'generator-chisel': '2.0.0-alpha.5',
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-chisel",
3
- "version": "2.0.0-alpha.3",
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": "135a429a7af5deaae61c03de28371129ae21a34c"
40
+ "gitHead": "f8767b71f2178288d9e37e3a44491b054e2a08ca"
41
41
  }
@@ -1,8 +0,0 @@
1
- const listStagedConfig = {
2
- '*.{cjs,mjs,js,jsx,ts,tsx}': ['eslint --fix'],
3
- '*.vue': ['stylelint --fix', 'eslint --fix --allow-empty-input'],
4
- '*.{json,md,yml}': ['prettier --write'],
5
- '*.{css,scss}': ['stylelint --fix --allow-empty-input'],
6
- };
7
-
8
- export default listStagedConfig;