generator-chisel 2.0.0-alpha.14 → 2.0.0-alpha.16
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 +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.gitignore.chisel-tpl +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772609e3c28c.json +83 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772615562fb4.json +49 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/critical.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/script.js +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-left.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-right.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-icon.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/close-line.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/chisel-icon.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/chisel-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/facebook-logo.svg +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/instagram-logo.svg +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/x-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterBlocks.php +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/AssetsHelpers.php +28 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/BlocksHelpers.php +20 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/ImageHelpers.php +51 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/ThemeHelpers.php +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Trait/PageBlocks.php +92 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/AcfBlocks.php +42 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Assets.php +163 -40
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Blocks.php +41 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Components.php +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Theme.php +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Twig.php +13 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/accordion-item.js +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/style.scss +12 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/acf-json/group_66462c70b851f.json +107 -105
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +4 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +2 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_icon.scss +39 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_index.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_layout.scss +11 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin/acf.js +65 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/app.js +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/loaded.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +14 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +14 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icons-preview.scss +97 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +19 -9
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_icon.scss +51 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_layout.scss +0 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-admin/_acf.scss +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav-item.twig +2 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +3 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/objects/icon.twig +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/icons-preview.twig +81 -0
- package/lib/commands/create/packages-versions.js +2 -2
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icon.scss +0 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/icon.twig +0 -1
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/{loader.svg → animated/loader.svg} +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/{icons → icons-source}/minus.svg +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/{icons → icons-source}/plus.svg +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.16 (2025-02-04)
|
|
6
|
+
|
|
7
|
+
- blocks, scripts, images optimize, mega menu settings ([d8a8b3c](https://github.com/xfiveco/generator-chisel/commit/d8a8b3c))
|
|
8
|
+
|
|
9
|
+
## 2.0.0-alpha.15 (2024-12-06)
|
|
10
|
+
|
|
11
|
+
- icons add color param and improve caching keys ([9619163](https://github.com/xfiveco/generator-chisel/commit/9619163))
|
|
12
|
+
- integrate icons feature, get_icon twig function with cache ([3612fe9](https://github.com/xfiveco/generator-chisel/commit/3612fe9))
|
|
13
|
+
- Merge branch 'v2-feature-icons-improved' of github.com:xfiveco/generator-chisel into v2-feature-icon ([cc45f09](https://github.com/xfiveco/generator-chisel/commit/cc45f09))
|
|
14
|
+
- feature: added missing files for icons ([772d4c4](https://github.com/xfiveco/generator-chisel/commit/772d4c4))
|
|
15
|
+
- feature: icons - improved icon.twig, updated examples preview, styles adjustments ([7b31431](https://github.com/xfiveco/generator-chisel/commit/7b31431))
|
|
16
|
+
- refactor: icons.mjs - updated preview generation ([16f7792](https://github.com/xfiveco/generator-chisel/commit/16f7792))
|
|
17
|
+
- fix: added missing files ([fd93bac](https://github.com/xfiveco/generator-chisel/commit/fd93bac))
|
|
18
|
+
|
|
5
19
|
## 2.0.0-alpha.14 (2024-12-04)
|
|
6
20
|
|
|
7
21
|
- adjust base version logic, remove compose version ([69f340e](https://github.com/xfiveco/generator-chisel/commit/69f340e))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
20
|
|
1
|
+
20.12.2
|
package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772609e3c28c.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"key": "group_6772609e3c28c",
|
|
3
|
+
"title": "Mega Menu",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"key": "field_6772609e2dd03",
|
|
7
|
+
"label": "Enable Mega Menu",
|
|
8
|
+
"name": "mega_menu_enable",
|
|
9
|
+
"aria-label": "",
|
|
10
|
+
"type": "button_group",
|
|
11
|
+
"instructions": "",
|
|
12
|
+
"required": 0,
|
|
13
|
+
"conditional_logic": 0,
|
|
14
|
+
"wrapper": {
|
|
15
|
+
"width": "",
|
|
16
|
+
"class": "",
|
|
17
|
+
"id": ""
|
|
18
|
+
},
|
|
19
|
+
"choices": {
|
|
20
|
+
"yes": "Yes",
|
|
21
|
+
"no": "No"
|
|
22
|
+
},
|
|
23
|
+
"default_value": "no",
|
|
24
|
+
"return_format": "value",
|
|
25
|
+
"allow_null": 0,
|
|
26
|
+
"allow_in_bindings": 0,
|
|
27
|
+
"layout": "horizontal"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"key": "field_677260eefd533",
|
|
31
|
+
"label": "Number of Columns",
|
|
32
|
+
"name": "mega_menu_columns",
|
|
33
|
+
"aria-label": "",
|
|
34
|
+
"type": "button_group",
|
|
35
|
+
"instructions": "",
|
|
36
|
+
"required": 0,
|
|
37
|
+
"conditional_logic": [
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
"field": "field_6772609e2dd03",
|
|
41
|
+
"operator": "==",
|
|
42
|
+
"value": "yes"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
],
|
|
46
|
+
"wrapper": {
|
|
47
|
+
"width": "",
|
|
48
|
+
"class": "",
|
|
49
|
+
"id": ""
|
|
50
|
+
},
|
|
51
|
+
"choices": {
|
|
52
|
+
"1": "1",
|
|
53
|
+
"2": "2",
|
|
54
|
+
"3": "3",
|
|
55
|
+
"4": "4"
|
|
56
|
+
},
|
|
57
|
+
"default_value": 3,
|
|
58
|
+
"return_format": "value",
|
|
59
|
+
"allow_null": 0,
|
|
60
|
+
"allow_in_bindings": 1,
|
|
61
|
+
"layout": "horizontal"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"location": [
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
"param": "nav_menu",
|
|
68
|
+
"operator": "==",
|
|
69
|
+
"value": "location\/chisel_main_nav"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
],
|
|
73
|
+
"menu_order": 0,
|
|
74
|
+
"position": "normal",
|
|
75
|
+
"style": "default",
|
|
76
|
+
"label_placement": "top",
|
|
77
|
+
"instruction_placement": "label",
|
|
78
|
+
"hide_on_screen": "",
|
|
79
|
+
"active": true,
|
|
80
|
+
"description": "",
|
|
81
|
+
"show_in_rest": 0,
|
|
82
|
+
"modified": 1735549249
|
|
83
|
+
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772615562fb4.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"key": "group_6772615562fb4",
|
|
3
|
+
"title": "Mega Menu - Submenu",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"key": "field_67726155705fb",
|
|
7
|
+
"label": "Switch to default submenu",
|
|
8
|
+
"name": "mega_menu_default_dropdown",
|
|
9
|
+
"aria-label": "",
|
|
10
|
+
"type": "button_group",
|
|
11
|
+
"instructions": "",
|
|
12
|
+
"required": 0,
|
|
13
|
+
"conditional_logic": 0,
|
|
14
|
+
"wrapper": {
|
|
15
|
+
"width": "",
|
|
16
|
+
"class": "",
|
|
17
|
+
"id": ""
|
|
18
|
+
},
|
|
19
|
+
"choices": {
|
|
20
|
+
"yes": "Yes",
|
|
21
|
+
"no": "No"
|
|
22
|
+
},
|
|
23
|
+
"default_value": "no",
|
|
24
|
+
"return_format": "value",
|
|
25
|
+
"allow_null": 0,
|
|
26
|
+
"allow_in_bindings": 0,
|
|
27
|
+
"layout": "horizontal"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"location": [
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"param": "nav_menu_item",
|
|
34
|
+
"operator": "==",
|
|
35
|
+
"value": "location\/chisel_main_nav"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
],
|
|
39
|
+
"menu_order": 0,
|
|
40
|
+
"position": "normal",
|
|
41
|
+
"style": "default",
|
|
42
|
+
"label_placement": "top",
|
|
43
|
+
"instruction_placement": "label",
|
|
44
|
+
"hide_on_screen": "",
|
|
45
|
+
"active": true,
|
|
46
|
+
"description": "",
|
|
47
|
+
"show_in_rest": 0,
|
|
48
|
+
"modified": 1735549736
|
|
49
|
+
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-left.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
2
|
+
<path d="M12.141 13.418c0.268 0.271 0.268 0.709 0 0.978s-0.701 0.272-0.969 0l-3.83-3.908c-0.268-0.27-0.268-0.707 0-0.979l3.83-3.908c0.267-0.27 0.701-0.27 0.969 0s0.268 0.709 0 0.978l-3.141 3.421 3.141 3.418z"></path>
|
|
3
|
+
</svg>
|
package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-right.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
2
|
+
<path d="M11 10l-3.141-3.42c-0.268-0.27-0.268-0.707 0-0.978 0.268-0.27 0.701-0.27 0.969 0l3.83 3.908c0.268 0.271 0.268 0.709 0 0.979l-3.83 3.908c-0.267 0.272-0.701 0.27-0.969 0s-0.268-0.707 0-0.978l3.141-3.419z"></path>
|
|
3
|
+
</svg>
|
package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="c-logo__icon" viewBox="0 0 44.16 44.16"><path fill="#000" d="M22.08 0a22 22 0 0 0-12 3.55.83.83 0 0 0-.25 1.16A.84.84 0 0 0 11 5a20.41 20.41 0 1 1-2.63 2 .84.84 0 1 0-1.14-1.26A22.08 22.08 0 1 0 22.08 0Zm15 12.07a.84.84 0 1 0-1.4.93 16.3 16.3 0 1 1-2.16-2.61.84.84 0 0 0 1.19 0 .85.85 0 0 0 0-1.19 18.14 18.14 0 1 0 2.38 2.88Zm-15-2.86a12.83 12.83 0 0 0-7.65 2.52.85.85 0 0 0-.17 1.18.84.84 0 0 0 1.18.18 11.18 11.18 0 1 1 9.36 19.84.84.84 0 0 0 .2 1.66h.2a12.87 12.87 0 0 0-3.12-25.38ZM15 30.74a11.19 11.19 0 0 1-2-15.12.84.84 0 1 0-1.37-1 12.86 12.86 0 0 0 2.36 17.4.84.84 0 0 0 .53.19.86.86 0 0 0 .66-.31.85.85 0 0 0-.18-1.16Z"/><path fill="#000" d="M28.49 25.69a.85.85 0 0 0-1.18.19 6.46 6.46 0 1 1-1.43-9 .84.84 0 1 0 1-1.36 8.15 8.15 0 1 0 1.8 11.38.85.85 0 0 0-.19-1.21Zm-6.41-7a3.43 3.43 0 1 0 3.43 3.43 3.44 3.44 0 0 0-3.43-3.47Zm0 5.17a1.74 1.74 0 1 1 1.74-1.74 1.74 1.74 0 0 1-1.74 1.7Z"/></svg>
|
package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-logo.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="c-logo__icon" viewBox="0 0 150 44.16"><path d="M22.77 0a22 22 0 0 0-12 3.55.83.83 0 0 0-.25 1.16.84.84 0 0 0 1.17.29 20.41 20.41 0 1 1-2.63 2 .85.85 0 1 0-1.14-1.26A22.08 22.08 0 1 0 22.77 0Zm15 12.07a.84.84 0 1 0-1.4.93 16.3 16.3 0 1 1-2.16-2.61.84.84 0 0 0 1.19 0 .85.85 0 0 0 0-1.19 18.14 18.14 0 1 0 2.38 2.88zm-15-2.86a12.83 12.83 0 0 0-7.65 2.52.85.85 0 0 0-.17 1.18.84.84 0 0 0 1.18.18 11.18 11.18 0 1 1 9.36 19.84.84.84 0 0 0 .2 1.66h.2a12.87 12.87 0 0 0-3.12-25.38zm-7.08 21.53a11.19 11.19 0 0 1-2-15.12.848.848 0 1 0-1.37-1 12.86 12.86 0 0 0 2.36 17.4.84.84 0 0 0 .53.19.86.86 0 0 0 .66-.31.85.85 0 0 0-.18-1.16z"/><path d="M28.49 25.69a.85.85 0 0 0-1.18.19 6.46 6.46 0 1 1-1.43-9 .844.844 0 1 0 1-1.36 8.15 8.15 0 1 0 1.8 11.38.85.85 0 0 0-.19-1.21zm-6.41-7a3.43 3.43 0 1 0 3.43 3.43 3.44 3.44 0 0 0-3.43-3.47zm0 5.17a1.74 1.74 0 1 1 1.74-1.74 1.74 1.74 0 0 1-1.74 1.7zm46.33-10.823q.687.338.78 1.045.126.706-.343 1.29-.344.46-.906.522-.532.06-1.063-.215-.906-.461-1.906-.738-1-.276-2.125-.276-1.782 0-3.22.584-1.405.552-2.437 1.627-1.031 1.044-1.594 2.488-.53 1.443-.53 3.194 0 1.935.593 3.44.594 1.474 1.625 2.518 1.063 1.014 2.469 1.536 1.437.491 3.094.491 1.062 0 2.062-.246 1.032-.245 1.938-.737.562-.276 1.094-.184.562.061.906.522.531.645.375 1.32-.125.646-.781.983-.782.43-1.72.738-.937.307-1.905.491-.97.184-1.97.184-2.25 0-4.25-.737t-3.562-2.15q-1.563-1.412-2.469-3.47-.875-2.058-.875-4.699 0-2.365.813-4.361.843-2.027 2.343-3.47 1.532-1.475 3.563-2.273 2.031-.83 4.438-.83 1.5 0 2.906.37 1.438.368 2.657 1.043zm12.281 3.839q2.157 0 3.344.922 1.188.89 1.657 2.426.5 1.535.5 3.378v8.139q0 .675-.47 1.136-.437.43-1.093.43-.687 0-1.125-.43-.438-.46-.438-1.136v-8.139q0-1.075-.312-1.965-.281-.891-1.031-1.413-.72-.522-2.032-.522-1.219 0-2.187.522-.938.522-1.47 1.413-.5.89-.5 1.965v8.139q0 .675-.468 1.136-.437.43-1.094.43-.687 0-1.125-.43-.437-.46-.437-1.136V12.147q0-.676.437-1.106.438-.46 1.125-.46.657 0 1.094.46.469.43.469 1.106v8.384l-.563.307q.22-.676.72-1.382.53-.706 1.28-1.29.782-.583 1.72-.921.937-.369 2-.369zM93.473 31.74q0 .676-.437 1.137-.438.43-1.125.43-.657 0-1.125-.43-.438-.46-.438-1.136V18.596q0-.676.438-1.105.468-.461 1.125-.461.687 0 1.125.46.437.43.437 1.106zM91.88 15.004q-.906 0-1.312-.307-.406-.338-.406-1.106V13.1q0-.768.437-1.075.438-.307 1.313-.307.937 0 1.343.338.407.307.407 1.044v.491q0 .799-.438 1.106-.406.307-1.344.307zm4.843 15.785q-.281-.43-.25-.983.032-.584.657-.983.437-.276.906-.215.5.03.937.46.875.953 1.938 1.506 1.094.553 2.625.553.625-.031 1.281-.185.657-.184 1.126-.614.468-.46.468-1.32 0-.768-.5-1.229-.5-.46-1.312-.737-.813-.307-1.75-.553-1-.276-2.032-.614-1-.338-1.812-.86-.813-.553-1.344-1.413-.5-.86-.5-2.119 0-1.443.812-2.488.844-1.044 2.157-1.627 1.344-.584 2.906-.584.906 0 1.906.246 1 .215 1.938.706.938.492 1.625 1.29.313.4.344.952.062.553-.5.983-.375.307-.906.276-.532-.03-.875-.337-.594-.738-1.532-1.137-.937-.43-2.125-.43-.594 0-1.25.185-.625.153-1.063.583-.437.43-.437 1.26 0 .767.5 1.228.531.46 1.375.767.844.308 1.844.553.969.246 1.906.584.969.338 1.72.89.78.523 1.25 1.383.5.829.5 2.119 0 1.505-.907 2.58-.875 1.044-2.25 1.596-1.344.553-2.844.553-1.781 0-3.563-.614-1.75-.645-2.969-2.211zm23.564 2.825q-2.594 0-4.5-1.044-1.907-1.075-2.97-2.918-1.03-1.873-1.03-4.269 0-2.702 1.093-4.606 1.125-1.935 2.907-2.949 1.781-1.044 3.781-1.044 1.531 0 2.907.614 1.375.584 2.437 1.659 1.094 1.044 1.719 2.487.625 1.413.656 3.102-.031.615-.5 1.014-.469.4-1.094.4h-12.156l-.75-2.611h11.75l-.594.552v-.767q-.062-1.075-.718-1.874-.657-.829-1.626-1.259-.968-.46-2.03-.46-.938 0-1.813.306-.844.277-1.532.922-.656.645-1.062 1.72-.375 1.044-.375 2.61 0 1.69.718 2.949.72 1.259 1.938 1.965 1.219.676 2.688.676 1.156 0 1.906-.215.75-.246 1.25-.584.5-.338.875-.645.469-.276.938-.276.562 0 .937.4.375.368.375.89 0 .675-.687 1.228-.844.799-2.344 1.413-1.469.614-3.094.614zm13.907-1.874q0 .676-.469 1.137-.438.43-1.094.43-.656 0-1.125-.43-.437-.46-.437-1.136V12.147q0-.676.468-1.106.47-.46 1.125-.46.688 0 1.094.46.438.43.438 1.106z"/></svg>
|
package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/close-line.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,13.41l5.66,5.66c.4,.38,1.03,.37,1.41-.02,.37-.39,.37-1,0-1.39l-5.66-5.66,5.66-5.66c.38-.4,.37-1.03-.02-1.41-.39-.37-1-.37-1.39,0l-5.66,5.66L6.34,4.93c-.4-.38-1.04-.36-1.41,.05-.36,.38-.36,.98,0,1.37l5.66,5.66-5.66,5.66c-.4,.38-.41,1.02-.02,1.41,.38,.4,1.02,.41,1.41,.02,0,0,.02-.02,.02-.02l5.66-5.66Z" fill="#09244b" fill-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="c-logo__icon" viewBox="0 0 44.16 44.16"><path fill="#2a1468" d="M22.08 0a22 22 0 0 0-12 3.55.83.83 0 0 0-.25 1.16A.84.84 0 0 0 11 5a20.41 20.41 0 1 1-2.63 2 .84.84 0 1 0-1.14-1.26A22.08 22.08 0 1 0 22.08 0Zm15 12.07a.84.84 0 1 0-1.4.93 16.3 16.3 0 1 1-2.16-2.61.84.84 0 0 0 1.19 0 .85.85 0 0 0 0-1.19 18.14 18.14 0 1 0 2.38 2.88Zm-15-2.86a12.83 12.83 0 0 0-7.65 2.52.85.85 0 0 0-.17 1.18.84.84 0 0 0 1.18.18 11.18 11.18 0 1 1 9.36 19.84.84.84 0 0 0 .2 1.66h.2a12.87 12.87 0 0 0-3.12-25.38ZM15 30.74a11.19 11.19 0 0 1-2-15.12.84.84 0 1 0-1.37-1 12.86 12.86 0 0 0 2.36 17.4.84.84 0 0 0 .53.19.86.86 0 0 0 .66-.31.85.85 0 0 0-.18-1.16Z"/><path fill="#ff6d54" d="M28.49 25.69a.85.85 0 0 0-1.18.19 6.46 6.46 0 1 1-1.43-9 .84.84 0 1 0 1-1.36 8.15 8.15 0 1 0 1.8 11.38.85.85 0 0 0-.19-1.21Zm-6.41-7a3.43 3.43 0 1 0 3.43 3.43 3.44 3.44 0 0 0-3.43-3.47Zm0 5.17a1.74 1.74 0 1 1 1.74-1.74 1.74 1.74 0 0 1-1.74 1.7Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="c-logo__icon" viewBox="0 0 150 44.16"><path fill="#2a1468" d="M22.77 0a22 22 0 0 0-12 3.55.83.83 0 0 0-.25 1.16.84.84 0 0 0 1.17.29 20.41 20.41 0 1 1-2.63 2 .85.85 0 1 0-1.14-1.26A22.08 22.08 0 1 0 22.77 0Zm15 12.07a.84.84 0 1 0-1.4.93 16.3 16.3 0 1 1-2.16-2.61.84.84 0 0 0 1.19 0 .85.85 0 0 0 0-1.19 18.14 18.14 0 1 0 2.38 2.88zm-15-2.86a12.83 12.83 0 0 0-7.65 2.52.85.85 0 0 0-.17 1.18.84.84 0 0 0 1.18.18 11.18 11.18 0 1 1 9.36 19.84.84.84 0 0 0 .2 1.66h.2a12.87 12.87 0 0 0-3.12-25.38zm-7.08 21.53a11.19 11.19 0 0 1-2-15.12.848.848 0 1 0-1.37-1 12.86 12.86 0 0 0 2.36 17.4.84.84 0 0 0 .53.19.86.86 0 0 0 .66-.31.85.85 0 0 0-.18-1.16z"/><path fill="#ff6d54" d="M28.49 25.69a.85.85 0 0 0-1.18.19 6.46 6.46 0 1 1-1.43-9 .844.844 0 1 0 1-1.36 8.15 8.15 0 1 0 1.8 11.38.85.85 0 0 0-.19-1.21zm-6.41-7a3.43 3.43 0 1 0 3.43 3.43 3.44 3.44 0 0 0-3.43-3.47zm0 5.17a1.74 1.74 0 1 1 1.74-1.74 1.74 1.74 0 0 1-1.74 1.7z"/><path fill="#ff6d54" d="M68.41 13.037q.687.338.78 1.045.126.706-.343 1.29-.344.46-.906.522-.532.06-1.063-.215-.906-.461-1.906-.738-1-.276-2.125-.276-1.782 0-3.22.584-1.405.552-2.437 1.627-1.031 1.044-1.594 2.488-.53 1.443-.53 3.194 0 1.935.593 3.44.594 1.474 1.625 2.518 1.063 1.014 2.469 1.536 1.437.491 3.094.491 1.062 0 2.062-.246 1.032-.245 1.938-.737.562-.276 1.094-.184.562.061.906.522.531.645.375 1.32-.125.646-.781.983-.782.43-1.72.738-.937.307-1.905.491-.97.184-1.97.184-2.25 0-4.25-.737t-3.562-2.15q-1.563-1.412-2.469-3.47-.875-2.058-.875-4.699 0-2.365.813-4.361.843-2.027 2.343-3.47 1.532-1.475 3.563-2.273 2.031-.83 4.438-.83 1.5 0 2.906.37 1.438.368 2.657 1.043zm12.281 3.839q2.157 0 3.344.922 1.188.89 1.657 2.426.5 1.535.5 3.378v8.139q0 .675-.47 1.136-.437.43-1.093.43-.687 0-1.125-.43-.438-.46-.438-1.136v-8.139q0-1.075-.312-1.965-.281-.891-1.031-1.413-.72-.522-2.032-.522-1.219 0-2.187.522-.938.522-1.47 1.413-.5.89-.5 1.965v8.139q0 .675-.468 1.136-.437.43-1.094.43-.687 0-1.125-.43-.437-.46-.437-1.136V12.147q0-.676.437-1.106.438-.46 1.125-.46.657 0 1.094.46.469.43.469 1.106v8.384l-.563.307q.22-.676.72-1.382.53-.706 1.28-1.29.782-.583 1.72-.921.937-.369 2-.369zM93.473 31.74q0 .676-.437 1.137-.438.43-1.125.43-.657 0-1.125-.43-.438-.46-.438-1.136V18.596q0-.676.438-1.105.468-.461 1.125-.461.687 0 1.125.46.437.43.437 1.106zM91.88 15.004q-.906 0-1.312-.307-.406-.338-.406-1.106V13.1q0-.768.437-1.075.438-.307 1.313-.307.937 0 1.343.338.407.307.407 1.044v.491q0 .799-.438 1.106-.406.307-1.344.307zm4.843 15.785q-.281-.43-.25-.983.032-.584.657-.983.437-.276.906-.215.5.03.937.46.875.953 1.938 1.506 1.094.553 2.625.553.625-.031 1.281-.185.657-.184 1.126-.614.468-.46.468-1.32 0-.768-.5-1.229-.5-.46-1.312-.737-.813-.307-1.75-.553-1-.276-2.032-.614-1-.338-1.812-.86-.813-.553-1.344-1.413-.5-.86-.5-2.119 0-1.443.812-2.488.844-1.044 2.157-1.627 1.344-.584 2.906-.584.906 0 1.906.246 1 .215 1.938.706.938.492 1.625 1.29.313.4.344.952.062.553-.5.983-.375.307-.906.276-.532-.03-.875-.337-.594-.738-1.532-1.137-.937-.43-2.125-.43-.594 0-1.25.185-.625.153-1.063.583-.437.43-.437 1.26 0 .767.5 1.228.531.46 1.375.767.844.308 1.844.553.969.246 1.906.584.969.338 1.72.89.78.523 1.25 1.383.5.829.5 2.119 0 1.505-.907 2.58-.875 1.044-2.25 1.596-1.344.553-2.844.553-1.781 0-3.563-.614-1.75-.645-2.969-2.211zm23.564 2.825q-2.594 0-4.5-1.044-1.907-1.075-2.97-2.918-1.03-1.873-1.03-4.269 0-2.702 1.093-4.606 1.125-1.935 2.907-2.949 1.781-1.044 3.781-1.044 1.531 0 2.907.614 1.375.584 2.437 1.659 1.094 1.044 1.719 2.487.625 1.413.656 3.102-.031.615-.5 1.014-.469.4-1.094.4h-12.156l-.75-2.611h11.75l-.594.552v-.767q-.062-1.075-.718-1.874-.657-.829-1.626-1.259-.968-.46-2.03-.46-.938 0-1.813.306-.844.277-1.532.922-.656.645-1.062 1.72-.375 1.044-.375 2.61 0 1.69.718 2.949.72 1.259 1.938 1.965 1.219.676 2.688.676 1.156 0 1.906-.215.75-.246 1.25-.584.5-.338.875-.645.469-.276.938-.276.562 0 .937.4.375.368.375.89 0 .675-.687 1.228-.844.799-2.344 1.413-1.469.614-3.094.614zm13.907-1.874q0 .676-.469 1.137-.438.43-1.094.43-.656 0-1.125-.43-.437-.46-.437-1.136V12.147q0-.676.468-1.106.47-.46 1.125-.46.688 0 1.094.46.438.43.438 1.106z" aria-label="Chisel"/></svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12Z" fill="url(#paint0_linear_8002_5831)"/>
|
|
3
|
+
<path d="M10.6163 22.8932V14.9503H8V11.8199H10.6163V9.36025C10.6163 6.56522 12.2907 5 14.6977 5C15.4302 5 16.2674 5.1118 17 5.2236V8.07453H15.6395C14.3837 8.07453 14.0698 8.74534 14.0698 9.63975V11.8199H16.843L16.3721 14.9503H14.0698V22.7587C13.402 22.9168 12.7096 23 12 23C11.5305 23 11.0686 22.9636 10.6163 22.8932Z" fill="white"/>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="paint0_linear_8002_5831" x1="12.0004" y1="22.2178" x2="12.0007" y2="0.995951" gradientUnits="userSpaceOnUse">
|
|
6
|
+
<stop stop-color="#0062aa"/>
|
|
7
|
+
<stop offset="1" stop-color="#19AFDD"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
</defs>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M6.99857 2C4.23715 2 2.00007 4.23856 2.00005 6.99997L2 17C1.99998 19.7614 4.23857 22 7.00001 22H17C19.7614 22 22 19.7614 22 17V7C22 4.23858 19.7634 2 17.0019 2C14.0164 2 10.1956 2 6.99857 2Z" fill="url(#paint0_radial_8002_5833)"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 8.26135C9.93889 8.26135 8.27158 9.93376 8.27158 11.9898C8.27158 14.0458 9.944 15.7182 12 15.7182C14.056 15.7182 15.7284 14.0458 15.7284 11.9898C15.7284 9.93376 14.0611 8.26135 12 8.26135ZM12 14.414C10.66 14.414 9.58088 13.3298 9.58088 11.9949C9.58088 10.6549 10.6651 9.57576 12 9.57576C13.3349 9.57576 14.4191 10.66 14.4191 11.9949C14.4242 13.3298 13.34 14.414 12 14.414Z" fill="white"/>
|
|
4
|
+
<path d="M16.7513 8.11815C16.7513 8.59833 16.362 8.9876 15.8819 8.9876C15.4017 8.9876 15.0124 8.59833 15.0124 8.11815C15.0124 7.63796 15.4017 7.24869 15.8819 7.24869C16.362 7.24869 16.7513 7.63796 16.7513 8.11815Z" fill="white"/>
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 4.72727C10.0258 4.72727 9.78034 4.7375 9.00295 4.7733C8.23066 4.8091 7.70387 4.93185 7.23847 5.11086C6.76282 5.29497 6.35367 5.54558 5.94962 5.94962C5.54558 6.35367 5.29498 6.7577 5.11086 7.23846C4.93185 7.69876 4.80911 8.23066 4.7733 9.00294C4.7375 9.78034 4.72727 10.0258 4.72727 12C4.72727 13.9742 4.7375 14.2197 4.7733 14.9971C4.80911 15.7693 4.93185 16.2961 5.11086 16.7615C5.29498 17.2372 5.54558 17.6463 5.94962 18.0504C6.35367 18.4544 6.7577 18.705 7.23847 18.8891C7.69876 19.0682 8.23066 19.1909 9.00295 19.2267C9.78034 19.2625 10.0258 19.2727 12 19.2727C13.9742 19.2727 14.2197 19.2625 14.9971 19.2267C15.7693 19.1909 16.2961 19.0682 16.7615 18.8891C17.2372 18.705 17.6463 18.4544 18.0504 18.0504C18.4544 17.6463 18.705 17.2423 18.8891 16.7615C19.0681 16.3012 19.1909 15.7693 19.2267 14.9971C19.2625 14.2197 19.2727 13.9742 19.2727 12C19.2727 10.0258 19.2625 9.78034 19.2267 9.00294C19.1909 8.23066 19.0681 7.70387 18.8891 7.23846C18.705 6.76282 18.4544 6.35367 18.0504 5.94962C17.6463 5.54558 17.2423 5.29497 16.7615 5.11086C16.3012 4.93185 15.7693 4.8091 14.9971 4.7733C14.2197 4.7375 13.9742 4.72727 12 4.72727ZM12 6.03657C13.9384 6.03657 14.1685 6.04168 14.9357 6.07749C15.6415 6.10817 16.0302 6.2258 16.2859 6.32809C16.6234 6.46107 16.8689 6.61961 17.1196 6.87022C17.3753 7.12594 17.5287 7.36632 17.6617 7.70387C17.7589 7.95959 17.8816 8.34318 17.9123 9.05408C17.9481 9.82125 17.9532 10.0514 17.9532 11.9898C17.9532 13.9281 17.9481 14.1583 17.9123 14.9255C17.8816 15.6312 17.764 16.0199 17.6617 16.2757C17.5287 16.6132 17.3702 16.8587 17.1196 17.1093C16.8638 17.365 16.6234 17.5185 16.2859 17.6514C16.0302 17.7486 15.6466 17.8714 14.9357 17.9021C14.1685 17.9379 13.9384 17.943 12 17.943C10.0616 17.943 9.83148 17.9379 9.06432 17.9021C8.35852 17.8714 7.96982 17.7537 7.7141 17.6514C7.37655 17.5185 7.13106 17.3599 6.88046 17.1093C6.62473 16.8536 6.4713 16.6132 6.33832 16.2757C6.24115 16.0199 6.1184 15.6364 6.08772 14.9255C6.05191 14.1583 6.0468 13.9281 6.0468 11.9898C6.0468 10.0514 6.05191 9.82125 6.08772 9.05408C6.1184 8.3483 6.23603 7.95959 6.33832 7.70387C6.4713 7.36632 6.62984 7.12083 6.88046 6.87022C7.13618 6.6145 7.37655 6.46107 7.7141 6.32809C7.96982 6.23092 8.3534 6.10817 9.06432 6.07749L9.09401 6.0763C9.83776 6.04654 10.0869 6.03657 12 6.03657Z" fill="white"/>
|
|
6
|
+
<defs>
|
|
7
|
+
<radialGradient id="paint0_radial_8002_5833" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(2.3628 20.1666) rotate(-3.00072) scale(28.9125 24.5805)">
|
|
8
|
+
<stop stop-color="#FED576"/>
|
|
9
|
+
<stop offset="0.2634" stop-color="#F47133"/>
|
|
10
|
+
<stop offset="0.6091" stop-color="#BC3081"/>
|
|
11
|
+
<stop offset="1" stop-color="#4C63D2"/>
|
|
12
|
+
</radialGradient>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.905 10.47 21.35 2h-1.764L13.12 9.353 7.956 2H2l7.809 11.12L2 22h1.764l6.827-7.766L16.044 22H22M4.4 3.302h2.71l12.476 17.46h-2.71"/></svg>
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterBlocks.php
CHANGED
|
@@ -253,6 +253,24 @@ class RegisterBlocks {
|
|
|
253
253
|
return $blocks;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Get the blocks url.
|
|
258
|
+
*
|
|
259
|
+
* @return string
|
|
260
|
+
*/
|
|
261
|
+
public function get_blocks_url() {
|
|
262
|
+
return $this->blocks_url;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Get the blocks path.
|
|
267
|
+
*
|
|
268
|
+
* @return string
|
|
269
|
+
*/
|
|
270
|
+
public function get_blocks_path() {
|
|
271
|
+
return $this->blocks_path;
|
|
272
|
+
}
|
|
273
|
+
|
|
256
274
|
/**
|
|
257
275
|
* Get the blocks path src.
|
|
258
276
|
*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\Helper;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper functions.
|
|
7
|
+
*
|
|
8
|
+
* @package Chisel
|
|
9
|
+
*/
|
|
10
|
+
class AssetsHelpers {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get the final handle for the asset.
|
|
14
|
+
*
|
|
15
|
+
* @param string $handle
|
|
16
|
+
*
|
|
17
|
+
* @return string
|
|
18
|
+
*/
|
|
19
|
+
public static function get_final_handle( $handle ) {
|
|
20
|
+
$handle = 'chisel-' . $handle;
|
|
21
|
+
|
|
22
|
+
if ( ThemeHelpers::is_fast_refresh() ) {
|
|
23
|
+
$handle .= '-fast-refresh';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return $handle;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -95,4 +95,24 @@ class BlocksHelpers {
|
|
|
95
95
|
|
|
96
96
|
Timber::render( AcfBlocks::get_instance()->blocks_twig_base_path . $block_slug . '/' . $block_slug . '.twig', $context, CacheHelpers::expiry() );
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get block inline css from url. The critical.scss imported into script.js will be built into script.css.
|
|
101
|
+
*
|
|
102
|
+
* @param string $blocks_url
|
|
103
|
+
* @param string $block_name
|
|
104
|
+
*
|
|
105
|
+
* @return string
|
|
106
|
+
*/
|
|
107
|
+
public static function get_block_inline_css( $blocks_url, $block_name ) {
|
|
108
|
+
$css_url = $blocks_url . '/' . $block_name . '/script.css';
|
|
109
|
+
$response = wp_remote_get( $css_url );
|
|
110
|
+
$css = '';
|
|
111
|
+
|
|
112
|
+
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
|
|
113
|
+
$css = wp_remote_retrieve_body( $response );
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return $css;
|
|
117
|
+
}
|
|
98
118
|
}
|
|
@@ -11,6 +11,13 @@ use Timber\Timber;
|
|
|
11
11
|
*/
|
|
12
12
|
class ImageHelpers {
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Responsive image data.
|
|
16
|
+
*
|
|
17
|
+
* @var array
|
|
18
|
+
*/
|
|
19
|
+
private static $responsive_image_data = array();
|
|
20
|
+
|
|
14
21
|
/**
|
|
15
22
|
* Get image url of the theme images.
|
|
16
23
|
*
|
|
@@ -47,6 +54,49 @@ class ImageHelpers {
|
|
|
47
54
|
|
|
48
55
|
$image = Timber::get_image( $image_id );
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
self::$responsive_image_data = array(
|
|
58
|
+
'image_id' => $image_id,
|
|
59
|
+
'attrs' => $attrs,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Adjust image width and height to prevent layout shifts.
|
|
63
|
+
if ( isset( $attrs['width'] ) && isset( $attrs['height'] ) ) {
|
|
64
|
+
add_filter(
|
|
65
|
+
'wp_get_attachment_image_src',
|
|
66
|
+
array( self::class, 'responsive_image_dimensions' ),
|
|
67
|
+
10,
|
|
68
|
+
4
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
$responsive_image = $image ? $image->responsive( $image_size, $attrs ) : '';
|
|
73
|
+
|
|
74
|
+
remove_filter(
|
|
75
|
+
'wp_get_attachment_image_src',
|
|
76
|
+
array( self::class, 'responsive_image_dimensions' ),
|
|
77
|
+
10
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return $responsive_image;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Adjust image width and height to prevent layout shifts
|
|
85
|
+
*
|
|
86
|
+
* @param array $src
|
|
87
|
+
* @param int $id
|
|
88
|
+
*
|
|
89
|
+
* @return array
|
|
90
|
+
*/
|
|
91
|
+
public static function responsive_image_dimensions( $src, $id ) {
|
|
92
|
+
$image_id = self::$responsive_image_data['image_id'] ?? 0;
|
|
93
|
+
$attrs = self::$responsive_image_data['attrs'] ?? array();
|
|
94
|
+
|
|
95
|
+
if ( $id === $image_id && isset( $attrs['width'] ) && isset( $attrs['height'] ) ) {
|
|
96
|
+
$src[1] = $attrs['width'];
|
|
97
|
+
$src[2] = $attrs['height'];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return $src;
|
|
51
101
|
}
|
|
52
102
|
}
|
|
@@ -50,6 +50,15 @@ class ThemeHelpers {
|
|
|
50
50
|
return $theme->get( 'Version' );
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Get theme name / site title.
|
|
55
|
+
*
|
|
56
|
+
* @return bool
|
|
57
|
+
*/
|
|
58
|
+
public static function get_theme_name() {
|
|
59
|
+
return esc_attr( get_bloginfo( 'name' ) );
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
/**
|
|
54
63
|
* Generate BEM class names with modifiers
|
|
55
64
|
*
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\Trait;
|
|
4
|
+
|
|
5
|
+
trait PageBlocks {
|
|
6
|
+
/**
|
|
7
|
+
* Content blocks from current page
|
|
8
|
+
*
|
|
9
|
+
* @var array|null
|
|
10
|
+
*/
|
|
11
|
+
private static $content_blocks_names = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the instance of the class.
|
|
15
|
+
*
|
|
16
|
+
* @param string $prefix
|
|
17
|
+
*
|
|
18
|
+
* @return array
|
|
19
|
+
*/
|
|
20
|
+
public function get_content_blocks_names( $prefix = 'chisel' ) {
|
|
21
|
+
if ( self::$content_blocks_names ) {
|
|
22
|
+
return self::$content_blocks_names;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
global $post;
|
|
26
|
+
|
|
27
|
+
$content_blocks_names = array();
|
|
28
|
+
|
|
29
|
+
if ( is_a( $post, 'WP_Post' ) && $post->post_content && has_blocks( $post->post_content ) ) {
|
|
30
|
+
$blocks = parse_blocks( $post->post_content );
|
|
31
|
+
|
|
32
|
+
if ( $blocks ) {
|
|
33
|
+
$blocks_names = $this->get_blocks_names( $blocks );
|
|
34
|
+
|
|
35
|
+
if ( $blocks_names ) {
|
|
36
|
+
$blocks_names = array_filter(
|
|
37
|
+
$blocks_names,
|
|
38
|
+
function ( $block_name ) use ( $prefix ) {
|
|
39
|
+
return strpos( $block_name, $prefix ) !== false;
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if ( $blocks_names ) {
|
|
44
|
+
$blocks_names = array_values( array_unique( $blocks_names ) );
|
|
45
|
+
$blocks_names = array_map(
|
|
46
|
+
function ( $block_name ) use ( $prefix ) {
|
|
47
|
+
return str_replace( $prefix . '/', '', $block_name );
|
|
48
|
+
},
|
|
49
|
+
$blocks_names
|
|
50
|
+
);
|
|
51
|
+
$content_blocks_names = array_merge( $content_blocks_names, $blocks_names );
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
self::$content_blocks_names = $content_blocks_names;
|
|
58
|
+
|
|
59
|
+
return self::$content_blocks_names;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get blocks_names recursively.
|
|
64
|
+
*
|
|
65
|
+
* @param array $inner_blocks
|
|
66
|
+
*
|
|
67
|
+
* @return array
|
|
68
|
+
*/
|
|
69
|
+
private function get_blocks_names( $inner_blocks ) {
|
|
70
|
+
$blocks_names = array();
|
|
71
|
+
|
|
72
|
+
foreach ( $inner_blocks as $block ) {
|
|
73
|
+
$block_name = sanitize_text_field( $block['blockName'] );
|
|
74
|
+
|
|
75
|
+
if ( ! $block_name ) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
$blocks_names[] = $block_name;
|
|
80
|
+
|
|
81
|
+
if ( isset( $block['innerBlocks'] ) && $block['innerBlocks'] ) {
|
|
82
|
+
$inner_blocks_names = $this->get_blocks_names( $block['innerBlocks'] );
|
|
83
|
+
|
|
84
|
+
if ( $inner_blocks_names ) {
|
|
85
|
+
$blocks_names = array_merge( $blocks_names, $inner_blocks_names );
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return $blocks_names;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -7,6 +7,9 @@ use Chisel\Interface\InstanceInterface;
|
|
|
7
7
|
use Chisel\Interface\HooksInterface;
|
|
8
8
|
use Chisel\Trait\Singleton;
|
|
9
9
|
use Chisel\Factory\RegisterBlocks;
|
|
10
|
+
use Chisel\Trait\PageBlocks;
|
|
11
|
+
use Chisel\Helper\BlocksHelpers;
|
|
12
|
+
use Chisel\Helper\AssetsHelpers;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* ACF blocks related functionalities.
|
|
@@ -16,6 +19,7 @@ use Chisel\Factory\RegisterBlocks;
|
|
|
16
19
|
class AcfBlocks implements InstanceInterface, HooksInterface {
|
|
17
20
|
|
|
18
21
|
use Singleton;
|
|
22
|
+
use PageBlocks;
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Register blocks factory.
|
|
@@ -46,6 +50,7 @@ class AcfBlocks implements InstanceInterface, HooksInterface {
|
|
|
46
50
|
$this->blocks = $this->register_blocks_factory->get_blocks();
|
|
47
51
|
|
|
48
52
|
add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
|
|
53
|
+
add_action( 'wp_print_styles', array( $this, 'dequeue_blocks_styles' ), 999 );
|
|
49
54
|
|
|
50
55
|
$this->action_hooks();
|
|
51
56
|
$this->filter_hooks();
|
|
@@ -107,7 +112,7 @@ class AcfBlocks implements InstanceInterface, HooksInterface {
|
|
|
107
112
|
*/
|
|
108
113
|
public function load_acf_field_group( $paths ) {
|
|
109
114
|
if ( ! is_array( $this->blocks ) || ! $this->blocks ) {
|
|
110
|
-
return;
|
|
115
|
+
return $paths;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
foreach ( $this->blocks as $block ) {
|
|
@@ -140,7 +145,7 @@ class AcfBlocks implements InstanceInterface, HooksInterface {
|
|
|
140
145
|
return $path;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
|
-
return $this->
|
|
148
|
+
return $this->register_blocks_factory->get_blocks_path_src() . '/' . $block_name . '/acf-json';
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
151
|
}
|
|
@@ -148,4 +153,39 @@ class AcfBlocks implements InstanceInterface, HooksInterface {
|
|
|
148
153
|
|
|
149
154
|
return $path;
|
|
150
155
|
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Dequeue blocks styles that are not used on current page and add inline critical css for blocks.
|
|
159
|
+
*
|
|
160
|
+
* @return void
|
|
161
|
+
*/
|
|
162
|
+
public function dequeue_blocks_styles() {
|
|
163
|
+
if ( is_admin() ) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
$blocks_used_on_page = $this->get_content_blocks_names();
|
|
168
|
+
$blocks = $this->blocks;
|
|
169
|
+
|
|
170
|
+
if ( $blocks ) {
|
|
171
|
+
$blocks_path = $this->register_blocks_factory->get_blocks_path();
|
|
172
|
+
$blocks_url = $this->register_blocks_factory->get_blocks_url();
|
|
173
|
+
|
|
174
|
+
foreach ( $blocks as $block_name ) {
|
|
175
|
+
if ( ! in_array( $block_name, $blocks_used_on_page, true ) ) {
|
|
176
|
+
wp_dequeue_style( 'block-acf-' . $block_name . '-style' );
|
|
177
|
+
} else {
|
|
178
|
+
$block_critical_css = $blocks_path . '/' . $block_name . '/script.css';
|
|
179
|
+
|
|
180
|
+
if ( is_file( $block_critical_css ) ) {
|
|
181
|
+
$css = BlocksHelpers::get_block_inline_css( $blocks_url, $block_name );
|
|
182
|
+
|
|
183
|
+
if ( $css ) {
|
|
184
|
+
$add = wp_add_inline_style( AssetsHelpers::get_final_handle( 'main' ), $css );
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
151
191
|
}
|