@webikon/webentor-core 0.9.12

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 (132) hide show
  1. package/.husky/pre-commit +40 -0
  2. package/.prettierrc.js +5 -0
  3. package/CHANGELOG.md +88 -0
  4. package/LICENCE.md +7 -0
  5. package/README.md +26 -0
  6. package/core-js/_alpine.ts +20 -0
  7. package/core-js/_slider.ts +232 -0
  8. package/core-js/_utils.ts +126 -0
  9. package/core-js/blocks-components/block-appender.tsx +36 -0
  10. package/core-js/blocks-components/button.tsx +424 -0
  11. package/core-js/blocks-components/custom-image-sizes-panel.tsx +197 -0
  12. package/core-js/blocks-components/index.ts +4 -0
  13. package/core-js/blocks-components/typography-picker-select.tsx +31 -0
  14. package/core-js/blocks-filters/_filter-core-typography.tsx +108 -0
  15. package/core-js/blocks-filters/_slider-settings.tsx +283 -0
  16. package/core-js/blocks-filters/index.ts +3 -0
  17. package/core-js/blocks-filters/responsive-settings/components/DisabledSliderInfo.tsx +10 -0
  18. package/core-js/blocks-filters/responsive-settings/constants.ts +11 -0
  19. package/core-js/blocks-filters/responsive-settings/index.tsx +196 -0
  20. package/core-js/blocks-filters/responsive-settings/settings/block-link/index.ts +1 -0
  21. package/core-js/blocks-filters/responsive-settings/settings/block-link/panel.tsx +47 -0
  22. package/core-js/blocks-filters/responsive-settings/settings/border/border/index.tsx +1 -0
  23. package/core-js/blocks-filters/responsive-settings/settings/border/border/properties.ts +27 -0
  24. package/core-js/blocks-filters/responsive-settings/settings/border/border/settings.tsx +310 -0
  25. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/index.tsx +1 -0
  26. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/properties.ts +31 -0
  27. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/settings.tsx +211 -0
  28. package/core-js/blocks-filters/responsive-settings/settings/border/index.ts +1 -0
  29. package/core-js/blocks-filters/responsive-settings/settings/border/panel.tsx +54 -0
  30. package/core-js/blocks-filters/responsive-settings/settings/container/display/index.ts +2 -0
  31. package/core-js/blocks-filters/responsive-settings/settings/container/display/properties.ts +167 -0
  32. package/core-js/blocks-filters/responsive-settings/settings/container/display/settings.tsx +73 -0
  33. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/index.ts +2 -0
  34. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/properties.ts +187 -0
  35. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/settings.tsx +131 -0
  36. package/core-js/blocks-filters/responsive-settings/settings/container/grid/index.ts +2 -0
  37. package/core-js/blocks-filters/responsive-settings/settings/container/grid/properties.ts +187 -0
  38. package/core-js/blocks-filters/responsive-settings/settings/container/grid/settings.tsx +132 -0
  39. package/core-js/blocks-filters/responsive-settings/settings/container/index.ts +4 -0
  40. package/core-js/blocks-filters/responsive-settings/settings/container/panel.tsx +92 -0
  41. package/core-js/blocks-filters/responsive-settings/settings/spacing/index.ts +3 -0
  42. package/core-js/blocks-filters/responsive-settings/settings/spacing/panel.tsx +45 -0
  43. package/core-js/blocks-filters/responsive-settings/settings/spacing/properties.ts +74 -0
  44. package/core-js/blocks-filters/responsive-settings/settings/spacing/settings.tsx +85 -0
  45. package/core-js/blocks-filters/responsive-settings/types/index.ts +68 -0
  46. package/core-js/blocks-filters/responsive-settings/utils.ts +321 -0
  47. package/core-js/blocks-utils/_use-block-parent.ts +27 -0
  48. package/core-js/blocks-utils/_use-post-types.ts +43 -0
  49. package/core-js/blocks-utils/_use-taxonomies.ts +29 -0
  50. package/core-js/blocks-utils/index.ts +3 -0
  51. package/core-js/config/webentor-config.ts +718 -0
  52. package/core-js/index.ts +14 -0
  53. package/core-js/types/_block-components.ts +7 -0
  54. package/core-js/types/_webentor-config.ts +182 -0
  55. package/package.json +98 -0
  56. package/resources/blocks/e-accordion/block.json +34 -0
  57. package/resources/blocks/e-accordion/e-accordion.block.tsx +125 -0
  58. package/resources/blocks/e-accordion/script.ts +1 -0
  59. package/resources/blocks/e-accordion/style.css +8 -0
  60. package/resources/blocks/e-accordion-group/block.json +56 -0
  61. package/resources/blocks/e-accordion-group/e-accordion-group.block.tsx +99 -0
  62. package/resources/blocks/e-breadcrumbs/block.json +41 -0
  63. package/resources/blocks/e-breadcrumbs/e-breadcrumbs.block.tsx +53 -0
  64. package/resources/blocks/e-button/block.json +32 -0
  65. package/resources/blocks/e-button/e-button.block.tsx +55 -0
  66. package/resources/blocks/e-gallery/block.json +90 -0
  67. package/resources/blocks/e-gallery/e-gallery.block.tsx +316 -0
  68. package/resources/blocks/e-icon-picker/block.json +37 -0
  69. package/resources/blocks/e-icon-picker/e-icon-picker.block.tsx +230 -0
  70. package/resources/blocks/e-icon-picker/style.css +17 -0
  71. package/resources/blocks/e-image/block.json +78 -0
  72. package/resources/blocks/e-image/e-image.block.tsx +331 -0
  73. package/resources/blocks/e-picker-query-loop/block.json +25 -0
  74. package/resources/blocks/e-picker-query-loop/e-picker-query-loop.block.tsx +189 -0
  75. package/resources/blocks/e-post-template/block.json +25 -0
  76. package/resources/blocks/e-post-template/e-post-template.block.tsx +100 -0
  77. package/resources/blocks/e-query-loop/block.json +36 -0
  78. package/resources/blocks/e-query-loop/constants.tsx +8 -0
  79. package/resources/blocks/e-query-loop/e-query-loop.block.tsx +270 -0
  80. package/resources/blocks/e-query-loop/taxonomy-controls.tsx +184 -0
  81. package/resources/blocks/e-slider/block.json +42 -0
  82. package/resources/blocks/e-slider/e-slider.block.tsx +100 -0
  83. package/resources/blocks/e-svg/block.json +37 -0
  84. package/resources/blocks/e-svg/e-svg.block.tsx +156 -0
  85. package/resources/blocks/e-tab-container/block.json +49 -0
  86. package/resources/blocks/e-tab-container/e-tab-container.block.tsx +123 -0
  87. package/resources/blocks/e-table/block.json +30 -0
  88. package/resources/blocks/e-table/e-table.block.tsx +120 -0
  89. package/resources/blocks/e-table/script.ts +48 -0
  90. package/resources/blocks/e-table-cell/block.json +40 -0
  91. package/resources/blocks/e-table-cell/e-table-cell.block.tsx +180 -0
  92. package/resources/blocks/e-table-row/block.json +28 -0
  93. package/resources/blocks/e-table-row/e-table-row.block.tsx +118 -0
  94. package/resources/blocks/e-tabs/block.json +27 -0
  95. package/resources/blocks/e-tabs/e-tabs.block.tsx +90 -0
  96. package/resources/blocks/l-404/block.json +51 -0
  97. package/resources/blocks/l-404/l-404.block.tsx +75 -0
  98. package/resources/blocks/l-flexible-container/block.json +34 -0
  99. package/resources/blocks/l-flexible-container/l-flexible-container.block.tsx +97 -0
  100. package/resources/blocks/l-footer/block.json +23 -0
  101. package/resources/blocks/l-footer/l-footer.block.tsx +51 -0
  102. package/resources/blocks/l-formatted-content/block.json +28 -0
  103. package/resources/blocks/l-formatted-content/l-formatted-content.block.tsx +97 -0
  104. package/resources/blocks/l-header/block.json +26 -0
  105. package/resources/blocks/l-header/l-header.block.tsx +100 -0
  106. package/resources/blocks/l-mobile-nav/block.json +15 -0
  107. package/resources/blocks/l-mobile-nav/l-mobile-nav.block.tsx +56 -0
  108. package/resources/blocks/l-mobile-nav/style.css +54 -0
  109. package/resources/blocks/l-nav-menu/block.json +27 -0
  110. package/resources/blocks/l-nav-menu/l-nav-menu.block.tsx +109 -0
  111. package/resources/blocks/l-nav-menu/style.css +134 -0
  112. package/resources/blocks/l-post-card/block.json +13 -0
  113. package/resources/blocks/l-post-card/l-post-card.block.tsx +52 -0
  114. package/resources/blocks/l-section/block.json +89 -0
  115. package/resources/blocks/l-section/l-section.block.tsx +316 -0
  116. package/resources/blocks/l-site-logo/block.json +15 -0
  117. package/resources/blocks/l-site-logo/l-site-logo.block.tsx +54 -0
  118. package/resources/core-components/slider/slider.script.ts +11 -0
  119. package/resources/core-components/slider/slider.style.css +134 -0
  120. package/resources/scripts/editor.ts +29 -0
  121. package/resources/styles/app.css +21 -0
  122. package/resources/styles/common/_editor.css +86 -0
  123. package/resources/styles/common/_form.css +83 -0
  124. package/resources/styles/common/_global.css +73 -0
  125. package/resources/styles/common/_theme.css +75 -0
  126. package/resources/styles/common/_utilities.css +33 -0
  127. package/resources/styles/common/_wordpress.css +110 -0
  128. package/resources/styles/components/_table.css +102 -0
  129. package/resources/styles/editor.css +16 -0
  130. package/resources/styles/partials/.gitkeep +0 -0
  131. package/resources/styles/partials/_header.css +21 -0
  132. package/resources/styles/partials/_pagination.css +35 -0
@@ -0,0 +1,54 @@
1
+ .w-mobile-nav-icon {
2
+ width: 28px;
3
+ height: 20px;
4
+ position: relative;
5
+ transform: rotate(0deg);
6
+ transition: 0.5s ease-in-out;
7
+ cursor: pointer;
8
+
9
+ span {
10
+ display: block;
11
+ position: absolute;
12
+ height: 2px;
13
+ width: 100%;
14
+ background: var(--color-white);
15
+ border-radius: 0;
16
+ opacity: 1;
17
+ left: 0;
18
+ transform: rotate(0deg);
19
+ transition: 0.25s ease-in-out;
20
+ }
21
+
22
+ span:nth-child(1) {
23
+ top: 0;
24
+ }
25
+
26
+ span:nth-child(2),
27
+ span:nth-child(3) {
28
+ top: 9px;
29
+ }
30
+
31
+ span:nth-child(4) {
32
+ top: 18px;
33
+ }
34
+
35
+ &.open span:nth-child(1) {
36
+ top: 18px;
37
+ width: 0%;
38
+ left: 50%;
39
+ }
40
+
41
+ &.open span:nth-child(2) {
42
+ transform: rotate(45deg);
43
+ }
44
+
45
+ &.open span:nth-child(3) {
46
+ transform: rotate(-45deg);
47
+ }
48
+
49
+ &.open span:nth-child(4) {
50
+ top: 18px;
51
+ width: 0%;
52
+ left: 50%;
53
+ }
54
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "name": "webentor/l-nav-menu",
4
+ "title": "Navigation Menu",
5
+ "description": "Navigation menu block",
6
+ "category": "webentor-layout",
7
+ "icon": "menu",
8
+ "keywords": [
9
+ "menu",
10
+ "navigation"
11
+ ],
12
+ "attributes": {
13
+ "menuId": {
14
+ "type": "string",
15
+ "default": "0"
16
+ },
17
+ "direction": {
18
+ "type": "string",
19
+ "default": "direction-row"
20
+ }
21
+ },
22
+ "supports": {
23
+ "webentor": {
24
+ "display": true
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,109 @@
1
+ import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
2
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
3
+ import { PanelBody, PanelRow, SelectControl } from '@wordpress/components';
4
+ import { useSelect } from '@wordpress/data';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ import block from './block.json';
8
+
9
+ /**
10
+ * Edit component.
11
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
12
+ *
13
+ * @param {object} props The block props.
14
+ * @returns {Function} Render the edit screen
15
+ */
16
+
17
+ type AttributesType = {
18
+ coverImage: string;
19
+ menuId: string;
20
+ direction: string;
21
+ };
22
+
23
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
24
+ const { attributes, setAttributes, clientId } = props;
25
+
26
+ const blockProps = useBlockProps();
27
+
28
+ // Preview image for block inserter
29
+ if (attributes.coverImage) {
30
+ return <img src={attributes.coverImage} width="468" />;
31
+ }
32
+
33
+ const menus = useSelect(
34
+ (select) => {
35
+ const { getMenus } = select('core');
36
+ const menus = getMenus();
37
+
38
+ return menus;
39
+ },
40
+ [clientId],
41
+ );
42
+
43
+ // TODO: check if works with Polylang
44
+ const menuOptions = menus?.map((menu) => ({
45
+ label: menu.name,
46
+ value: menu.id,
47
+ }));
48
+ // Prepend default option
49
+ menuOptions?.unshift({ label: '-', value: '' });
50
+
51
+ if (!menus) {
52
+ return 'Loading menus...';
53
+ }
54
+
55
+ return (
56
+ <>
57
+ <InspectorControls>
58
+ <PanelBody title="Block Settings" initialOpen={true}>
59
+ <PanelRow>
60
+ <SelectControl
61
+ label={__('Nav Menu', 'webentor')}
62
+ value={attributes.menuId}
63
+ options={menuOptions}
64
+ onChange={(menuId) => setAttributes({ menuId })}
65
+ />
66
+ </PanelRow>
67
+
68
+ <PanelRow>
69
+ <SelectControl
70
+ label={__('Direction', 'webentor')}
71
+ value={attributes.direction}
72
+ options={[
73
+ { label: 'Row', value: 'direction-row' },
74
+ { label: 'Column', value: 'direction-col' },
75
+ ]}
76
+ onChange={(direction) => setAttributes({ direction })}
77
+ />
78
+ </PanelRow>
79
+ </PanelBody>
80
+ </InspectorControls>
81
+
82
+ <div {...blockProps} className={`${blockProps.className}`}>
83
+ <div className="wbtr:bg-editor-border wbtr:p-2">
84
+ {`Menu: `}
85
+ {/* Find item in menuOptions which matches menuId */}
86
+ {
87
+ menuOptions?.find((item) => +item.value == +attributes.menuId)
88
+ ?.label
89
+ }
90
+ </div>
91
+ </div>
92
+ </>
93
+ );
94
+ };
95
+
96
+ /**
97
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
98
+ *
99
+ * @return {null} Dynamic blocks do not save the HTML.
100
+ */
101
+ const BlockSave = () => null;
102
+
103
+ /**
104
+ * Register block.
105
+ */
106
+ registerBlockType(block, {
107
+ edit: BlockEdit,
108
+ save: BlockSave,
109
+ });
@@ -0,0 +1,134 @@
1
+ /* TODO maybe adjust nested CSS to be compatible with native nesting */
2
+ .menu-container {
3
+ .menu-item {
4
+ font-family: var(--font-primary);
5
+ font-size: 18px;
6
+ font-weight: 500;
7
+
8
+ > a {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: 4px;
12
+ padding: 4px;
13
+ color: var(--color-primary);
14
+
15
+ &:hover {
16
+ color: var(--color-primary-alt);
17
+ text-decoration: underline;
18
+ }
19
+ }
20
+ }
21
+
22
+ /* Horizontal menu style */
23
+ &.direction-row {
24
+ ul {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ gap: 12px;
28
+ }
29
+
30
+ .menu-item {
31
+ position: relative;
32
+
33
+ > a {
34
+ color: var(--color-white);
35
+
36
+ &:hover {
37
+ color: var(--color-primary-alt);
38
+ text-decoration: underline;
39
+ }
40
+ }
41
+ }
42
+
43
+ .menu-item-has-children {
44
+ > a {
45
+ &::after {
46
+ width: 12px;
47
+ height: 13px;
48
+ display: inline-block;
49
+ content: '';
50
+ mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.75 3.875L6 9.125L11.25 3.875' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
51
+ no-repeat 50% 50%;
52
+ mask-size: cover;
53
+ background-color: var(--color-white);
54
+ }
55
+
56
+ &:hover::after {
57
+ background-color: var(--color-primary-alt);
58
+ }
59
+ }
60
+
61
+ .sub-menu {
62
+ display: none;
63
+ position: absolute;
64
+ background-color: var(--color-white);
65
+ white-space: nowrap;
66
+ border-bottom: 2px solid var(--color-primary);
67
+
68
+ .menu-item a {
69
+ color: var(--color-primary);
70
+ font-size: 16px;
71
+
72
+ &:hover {
73
+ color: var(--color-primary-alt);
74
+ text-decoration: underline;
75
+ }
76
+ }
77
+ }
78
+
79
+ &:hover {
80
+ .sub-menu {
81
+ display: flex;
82
+ flex-direction: column;
83
+ gap: 12px;
84
+ padding: 12px 18px;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ /* Vertical menu style */
91
+ &.direction-col {
92
+ ul {
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: 8px;
96
+ }
97
+
98
+ .menu-item-has-children {
99
+ > a {
100
+ color: var(--color-gray-200);
101
+ }
102
+
103
+ .sub-menu {
104
+ display: flex;
105
+ flex-direction: column;
106
+ gap: 8px;
107
+
108
+ .menu-item a {
109
+ font-size: 16px;
110
+ padding-left: 16px;
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+ /* Footer menu style */
117
+ footer & .menu {
118
+ gap: 16px;
119
+
120
+ .menu-item {
121
+ font-size: 16px;
122
+ font-weight: 400;
123
+
124
+ a {
125
+ color: var(--color-primary);
126
+ padding: 0;
127
+
128
+ &:hover {
129
+ color: var(--color-white);
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/l-post-card",
5
+ "title": "Post Card",
6
+ "description": "Post card for use in e.g. posts loop.",
7
+ "category": "webentor-layout",
8
+ "icon": "embed-post",
9
+ "keywords": ["post-card", "post", "post-template"],
10
+ "usesContext": ["itemNumber"],
11
+ "attributes": {},
12
+ "supports": {}
13
+ }
@@ -0,0 +1,52 @@
1
+ import { useBlockProps } from '@wordpress/block-editor';
2
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
3
+
4
+ import block from './block.json';
5
+
6
+ /**
7
+ * Edit component.
8
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
9
+ *
10
+ * @param {object} props The block props.
11
+ * @returns {Function} Render the edit screen
12
+ */
13
+
14
+ type AttributesType = {
15
+ coverImage: string;
16
+ };
17
+
18
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
19
+ const { attributes } = props;
20
+
21
+ const blockProps = useBlockProps();
22
+
23
+ // Preview image for block inserter
24
+ if (attributes.coverImage) {
25
+ return <img src={attributes.coverImage} width="468" />;
26
+ }
27
+
28
+ return (
29
+ <>
30
+ <div {...blockProps} className={`${blockProps.className}`}>
31
+ <div className="wbtr:bg-editor-border wbtr:p-4">
32
+ Post Card placeholder
33
+ </div>
34
+ </div>
35
+ </>
36
+ );
37
+ };
38
+
39
+ /**
40
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
41
+ *
42
+ * @return {null} Dynamic blocks do not save the HTML.
43
+ */
44
+ const BlockSave = () => null;
45
+
46
+ /**
47
+ * Register block.
48
+ */
49
+ registerBlockType(block, {
50
+ edit: BlockEdit,
51
+ save: BlockSave,
52
+ });
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/l-section",
5
+ "title": "Section",
6
+ "description": "Section wrapper",
7
+ "category": "webentor-layout",
8
+ "icon": "align-wide",
9
+ "keywords": [
10
+ "section",
11
+ "container",
12
+ "layout"
13
+ ],
14
+ "attributes": {
15
+ "img": {
16
+ "type": "object",
17
+ "default": null
18
+ },
19
+ "mobileImg": {
20
+ "type": "object",
21
+ "default": null
22
+ },
23
+ "imgSize": {
24
+ "type": "object",
25
+ "default": null
26
+ },
27
+ "spacing": {
28
+ "type": "object",
29
+ "default": {
30
+ "padding-top": {
31
+ "value": {
32
+ "basic": "pt-10",
33
+ "lg": "pt-20"
34
+ }
35
+ },
36
+ "padding-bottom": {
37
+ "value": {
38
+ "basic": "pb-10",
39
+ "lg": "pb-20"
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "display": {
45
+ "type": "object",
46
+ "default": {
47
+ "display": {
48
+ "value": {
49
+ "basic": "flex"
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "flexbox": {
55
+ "type": "object",
56
+ "default": {
57
+ "flex-direction": {
58
+ "value": {
59
+ "basic": "flex-col"
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "anchor": {
65
+ "type": "string",
66
+ "default": ""
67
+ }
68
+ },
69
+ "supports": {
70
+ "anchor": true,
71
+ "color": {
72
+ "text": true,
73
+ "background": true
74
+ },
75
+ "webentor": {
76
+ "spacing": true,
77
+ "display": {
78
+ "height": true,
79
+ "minHeight": true,
80
+ "display": true
81
+ },
82
+ "flexbox": true,
83
+ "flexboxItem": true,
84
+ "grid": true,
85
+ "border": true,
86
+ "borderRadius": true
87
+ }
88
+ }
89
+ }