@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,14 @@
1
+ export {
2
+ WebentorBlockAppender,
3
+ WebentorButton,
4
+ WebentorTypographyPickerSelect,
5
+ } from './blocks-components';
6
+ export { initCustomTypographyFilter } from './blocks-filters';
7
+ export { useBlockParent, usePostTypes, useTaxonomies } from './blocks-utils';
8
+
9
+ export { Alpine } from './_alpine';
10
+ export { SliderComponent, Swiper } from './_slider';
11
+ export { setImmutably, debounce, throttle, camelize } from './_utils';
12
+
13
+ export type { ButtonAttributes } from './types/_block-components';
14
+ export type { WebentorConfig } from './types/_webentor-config';
@@ -0,0 +1,7 @@
1
+ export type ButtonAttributes = {
2
+ showButton: boolean;
3
+ title: string;
4
+ variant: 'primary' | 'secondary' | 'tertiary';
5
+ url: string;
6
+ newTab: boolean;
7
+ };
@@ -0,0 +1,182 @@
1
+ // Heavily inspired by Tailwind config
2
+ // https://github.com/tailwindlabs/tailwindcss/blob/v3.4.17/types/config.d.ts
3
+
4
+ // Helpers
5
+ type KeyValuePair<K extends keyof any = string, V = string> = Record<K, V>;
6
+ interface RecursiveKeyValuePair<K extends keyof any = string, V = string> {
7
+ [key: string]: V | RecursiveKeyValuePair<K, V>;
8
+ }
9
+ export type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
10
+
11
+ interface PluginUtils {
12
+ theme(path: string, defaultValue?: unknown): any;
13
+ }
14
+
15
+ type Screen =
16
+ | { raw: string }
17
+ | { min: string }
18
+ | { max: string }
19
+ | { min: string; max: string };
20
+ type ScreensConfig =
21
+ | string[]
22
+ | KeyValuePair<string, string | Screen | Screen[]>;
23
+
24
+ // Theme related config
25
+ export interface ThemeConfig {
26
+ // Responsiveness
27
+ screens: ResolvableTo<ScreensConfig>;
28
+
29
+ // Reusable base configs
30
+ colors: ResolvableTo<RecursiveKeyValuePair>;
31
+ spacing: ResolvableTo<KeyValuePair>;
32
+
33
+ // Utilities
34
+ // accentColor: ThemeConfig['colors'];
35
+ // animation: ResolvableTo<KeyValuePair>;
36
+ aspectRatio: ResolvableTo<KeyValuePair>;
37
+ // backdropBlur: ThemeConfig['blur'];
38
+ // backdropBrightness: ThemeConfig['brightness'];
39
+ // backdropContrast: ThemeConfig['contrast'];
40
+ // backdropGrayscale: ThemeConfig['grayscale'];
41
+ // backdropHueRotate: ThemeConfig['hueRotate'];
42
+ // backdropInvert: ThemeConfig['invert'];
43
+ // backdropOpacity: ThemeConfig['opacity'];
44
+ // backdropSaturate: ThemeConfig['saturate'];
45
+ // backdropSepia: ThemeConfig['sepia'];
46
+ // backgroundColor: ThemeConfig['colors'];
47
+ // backgroundImage: ResolvableTo<KeyValuePair>;
48
+ // backgroundOpacity: ThemeConfig['opacity'];
49
+ // backgroundPosition: ResolvableTo<KeyValuePair>;
50
+ // backgroundSize: ResolvableTo<KeyValuePair>;
51
+ // blur: ResolvableTo<KeyValuePair>;
52
+ // borderColor: ThemeConfig['colors'];
53
+ // borderOpacity: ThemeConfig['opacity'];
54
+ borderRadius: ResolvableTo<KeyValuePair>;
55
+ // borderSpacing: ThemeConfig['spacing'];
56
+ borderStyle: ResolvableTo<KeyValuePair>;
57
+ borderWidth: ResolvableTo<KeyValuePair>;
58
+ // boxShadow: ResolvableTo<KeyValuePair<string, string | string[]>>;
59
+ // boxShadowColor: ThemeConfig['colors'];
60
+ // brightness: ResolvableTo<KeyValuePair>;
61
+ // caretColor: ThemeConfig['colors'];
62
+ // columns: ResolvableTo<KeyValuePair>;
63
+ // content: ResolvableTo<KeyValuePair>;
64
+ // contrast: ResolvableTo<KeyValuePair>;
65
+ // cursor: ResolvableTo<KeyValuePair>;
66
+ // divideColor: ThemeConfig['borderColor'];
67
+ // divideOpacity: ThemeConfig['borderOpacity'];
68
+ // divideWidth: ThemeConfig['borderWidth'];
69
+ // dropShadow: ResolvableTo<KeyValuePair<string, string | string[]>>;
70
+ // fill: ThemeConfig['colors'];
71
+ // flex: ResolvableTo<KeyValuePair>;
72
+ flexBasis: ThemeConfig['spacing'];
73
+ // flexGrow: ResolvableTo<KeyValuePair>;
74
+ // flexShrink: ResolvableTo<KeyValuePair>;
75
+ fontFamily: ResolvableTo<
76
+ KeyValuePair<
77
+ string,
78
+ | string
79
+ | string[]
80
+ | [
81
+ fontFamily: string | string[],
82
+ configuration: Partial<{
83
+ fontFeatureSettings: string;
84
+ fontVariationSettings: string;
85
+ }>,
86
+ ]
87
+ >
88
+ >;
89
+ fontSize: ResolvableTo<
90
+ KeyValuePair<
91
+ string,
92
+ | string
93
+ | [fontSize: string, lineHeight: string]
94
+ | [
95
+ fontSize: string,
96
+ configuration: Partial<{
97
+ lineHeight: string;
98
+ letterSpacing: string;
99
+ fontWeight: string | number;
100
+ }>,
101
+ ]
102
+ >
103
+ >;
104
+ fontWeight: ResolvableTo<KeyValuePair>;
105
+ gap: ThemeConfig['spacing'];
106
+ // gradientColorStops: ThemeConfig['colors'];
107
+ // grayscale: ResolvableTo<KeyValuePair>;
108
+ // gridAutoColumns: ResolvableTo<KeyValuePair>;
109
+ // gridAutoRows: ResolvableTo<KeyValuePair>;
110
+ gridColumn: ResolvableTo<KeyValuePair>;
111
+ // gridColumnEnd: ResolvableTo<KeyValuePair>;
112
+ // gridColumnStart: ResolvableTo<KeyValuePair>;
113
+ gridRow: ResolvableTo<KeyValuePair>;
114
+ // gridRowEnd: ResolvableTo<KeyValuePair>;
115
+ // gridRowStart: ResolvableTo<KeyValuePair>;
116
+ gridTemplateColumns: ResolvableTo<KeyValuePair>;
117
+ gridTemplateRows: ResolvableTo<KeyValuePair>;
118
+ height: ThemeConfig['spacing'];
119
+ // hueRotate: ResolvableTo<KeyValuePair>;
120
+ // inset: ThemeConfig['spacing'];
121
+ // invert: ResolvableTo<KeyValuePair>;
122
+ // keyframes: ResolvableTo<KeyValuePair<string, KeyValuePair<string, KeyValuePair>>>;
123
+ // letterSpacing: ResolvableTo<KeyValuePair>;
124
+ // lineHeight: ResolvableTo<KeyValuePair>;
125
+ // listStyleType: ResolvableTo<KeyValuePair>;
126
+ margin: ThemeConfig['spacing'];
127
+ // maxHeight: ThemeConfig['spacing'];
128
+ // maxWidth: ResolvableTo<KeyValuePair>;
129
+ // minHeight: ResolvableTo<KeyValuePair>;
130
+ // minWidth: ResolvableTo<KeyValuePair>;
131
+ objectPosition: ResolvableTo<KeyValuePair>;
132
+ // opacity: ResolvableTo<KeyValuePair>;
133
+ order: ResolvableTo<KeyValuePair>;
134
+ // outlineColor: ThemeConfig['colors'];
135
+ // outlineOffset: ResolvableTo<KeyValuePair>;
136
+ // outlineWidth: ResolvableTo<KeyValuePair>;
137
+ padding: ThemeConfig['spacing'];
138
+ // placeholderColor: ThemeConfig['colors'];
139
+ // placeholderOpacity: ThemeConfig['opacity'];
140
+ // ringColor: ThemeConfig['colors'];
141
+ // ringOffsetColor: ThemeConfig['colors'];
142
+ // ringOffsetWidth: ResolvableTo<KeyValuePair>;
143
+ // ringOpacity: ThemeConfig['opacity'];
144
+ // ringWidth: ResolvableTo<KeyValuePair>;
145
+ // rotate: ResolvableTo<KeyValuePair>;
146
+ // saturate: ResolvableTo<KeyValuePair>;
147
+ // scale: ResolvableTo<KeyValuePair>;
148
+ // scrollMargin: ThemeConfig['spacing'];
149
+ // scrollPadding: ThemeConfig['spacing'];
150
+ // sepia: ResolvableTo<KeyValuePair>;
151
+ // skew: ResolvableTo<KeyValuePair>;
152
+ // space: ThemeConfig['spacing'];
153
+ // stroke: ThemeConfig['colors'];
154
+ // strokeWidth: ResolvableTo<KeyValuePair>;
155
+ // textColor: ThemeConfig['colors'];
156
+ // textDecorationColor: ThemeConfig['colors'];
157
+ // textDecorationThickness: ResolvableTo<KeyValuePair>;
158
+ // textIndent: ThemeConfig['spacing'];
159
+ // textOpacity: ThemeConfig['opacity'];
160
+ // textUnderlineOffset: ResolvableTo<KeyValuePair>;
161
+ // transformOrigin: ResolvableTo<KeyValuePair>;
162
+ // transitionDelay: ResolvableTo<KeyValuePair>;
163
+ // transitionDuration: ResolvableTo<KeyValuePair>;
164
+ // transitionProperty: ResolvableTo<KeyValuePair>;
165
+ // transitionTimingFunction: ResolvableTo<KeyValuePair>;
166
+ // translate: ThemeConfig['spacing'];
167
+ // width: ThemeConfig['spacing'];
168
+ // willChange: ResolvableTo<KeyValuePair>;
169
+ // zIndex: ResolvableTo<KeyValuePair>;
170
+ }
171
+
172
+ interface CustomThemeConfig extends ThemeConfig {
173
+ [key: string]: any;
174
+ }
175
+
176
+ interface OptionalConfig {
177
+ theme: Partial<CustomThemeConfig & { extend: Partial<CustomThemeConfig> }>;
178
+ // Custom
179
+ [key: string]: any;
180
+ }
181
+
182
+ export type WebentorConfig = OptionalConfig;
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@webikon/webentor-core",
3
+ "homepage": "https://webikon.sk",
4
+ "version": "0.9.12",
5
+ "description": "Core functionality and useful utilities for Webentor Stack",
6
+ "license": "MIT",
7
+ "author": "Webikon s.r.o.",
8
+ "maintainers": [
9
+ {
10
+ "name": "Webikon s.r.o.",
11
+ "email": "support@webikon.sk"
12
+ },
13
+ {
14
+ "name": "Pavol Caban",
15
+ "email": "pavol.caban@webikon.sk"
16
+ }
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/webikon/webentor-core.git"
21
+ },
22
+ "keywords": [
23
+ "wordpress",
24
+ "gutenberg",
25
+ "blocks",
26
+ "webentor",
27
+ "sage"
28
+ ],
29
+ "engines": {
30
+ "node": ">=20.0.0"
31
+ },
32
+ "type": "module",
33
+ "devDependencies": {
34
+ "@10up/block-components": "^1.21.4",
35
+ "@eslint/js": "^9.39.1",
36
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
37
+ "@kucrut/vite-for-wp": "^0.12.0",
38
+ "@roots/vite-plugin": "^1.2.3",
39
+ "@shufo/prettier-plugin-blade": "^1.16.1",
40
+ "@tailwindcss/postcss": "^4.1.17",
41
+ "@tailwindcss/vite": "^4.1.17",
42
+ "@types/wordpress__block-editor": "^14.21.2",
43
+ "@vitejs/plugin-react": "^5.1.1",
44
+ "@webikon/webentor-configs": "^1.0.0",
45
+ "@wordpress/block-editor": "^15.9.0",
46
+ "@wordpress/block-library": "^9.36.0",
47
+ "@wordpress/blocks": "^15.9.0",
48
+ "@wordpress/components": "^30.9.0",
49
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.36.0",
50
+ "@wordpress/i18n": "^6.9.0",
51
+ "@wordpress/icons": "^11.3.0",
52
+ "eslint": "^9.39.1",
53
+ "eslint-config-prettier": "^10.1.8",
54
+ "eslint-plugin-prettier": "^5.5.4",
55
+ "eslint-plugin-react": "^7.37.5",
56
+ "husky": "^9.1.7",
57
+ "lint-staged": "^16.2.7",
58
+ "patch-package": "^8.0.1",
59
+ "postcss": "^8.5.6",
60
+ "postcss-pxtorem": "^6.1.0",
61
+ "prettier": "^3.7.4",
62
+ "prettier-plugin-tailwindcss": "^0.7.2",
63
+ "react": "^18.3.1",
64
+ "react-dom": "^18.3.1",
65
+ "rollup-plugin-external-globals": "^0.13.0",
66
+ "stylelint": "^16.26.1",
67
+ "stylelint-config-recommended": "^17.0.0",
68
+ "tailwindcss": "^4.1.17",
69
+ "typescript": "^5.9.3",
70
+ "typescript-eslint": "^8.48.1",
71
+ "vite": "^7.2.6",
72
+ "vite-plugin-external": "^6.2.2"
73
+ },
74
+ "dependencies": {
75
+ "@alpinejs/collapse": "^3.15.2",
76
+ "alpinejs": "^3.15.2",
77
+ "swiper": "^12.0.3"
78
+ },
79
+ "lint-staged": {
80
+ "*.{js,ts,tsx}": "npm run lint:js --",
81
+ "*.css": "npm run lint:css --"
82
+ },
83
+ "scripts": {
84
+ "dev": "vite",
85
+ "build": "vite build",
86
+ "lint": "npm run lint:js && npm run lint:css",
87
+ "lint:js": "eslint resources/scripts resources/blocks",
88
+ "lint:css": "stylelint \"resources/**/*.{vue,css,sass,scss,less}\"",
89
+ "prettier-check": "prettier --check 'resources/**/*.{js,ts,tsx,css}'",
90
+ "prettier-check:js": "prettier --check 'resources/**/*.{js,ts,tsx}'",
91
+ "prettier-check:css": "prettier --check 'resources/**/*.css'",
92
+ "prettier-check:blade": "prettier --check 'resources/**/*.blade.php'",
93
+ "prettier-fix": "prettier --write 'resources/**/*.{js,ts,tsx,css}'",
94
+ "prettier-fix:js": "prettier --write 'resources/**/*.{js,ts,tsx}'",
95
+ "prettier-fix:css": "prettier --write 'resources/**/*.css'",
96
+ "prettier-fix:blade": "prettier --write 'resources/**/*.blade.php'"
97
+ }
98
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/e-accordion",
5
+ "title": "Accordion",
6
+ "description": "Accordion block.",
7
+ "category": "webentor-elements",
8
+ "icon": "excerpt-view",
9
+ "keywords": [
10
+ "accordion",
11
+ "toggle",
12
+ "elements"
13
+ ],
14
+ "attributes": {
15
+ "title": {
16
+ "type": "string",
17
+ "default": ""
18
+ },
19
+ "defaultOpen": {
20
+ "type": "boolean",
21
+ "default": false
22
+ },
23
+ "template": {
24
+ "type": "array",
25
+ "default": null
26
+ }
27
+ },
28
+ "supports": {
29
+ "anchor": true,
30
+ "webentor": {
31
+ "spacing": true
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,125 @@
1
+ import {
2
+ InnerBlocks,
3
+ InspectorControls,
4
+ RichText,
5
+ useBlockProps,
6
+ useInnerBlocksProps,
7
+ } from '@wordpress/block-editor';
8
+ import {
9
+ BlockEditProps,
10
+ registerBlockType,
11
+ TemplateArray,
12
+ } from '@wordpress/blocks';
13
+ import { PanelBody, PanelRow, ToggleControl } from '@wordpress/components';
14
+ import { applyFilters } from '@wordpress/hooks';
15
+ import { __ } from '@wordpress/i18n';
16
+
17
+ import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
18
+
19
+ import block from './block.json';
20
+
21
+ /**
22
+ * Edit component.
23
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
24
+ *
25
+ * @param {object} props The block props.
26
+ * @returns {Function} Render the edit screen
27
+ */
28
+
29
+ type AttributesType = {
30
+ coverImage: string;
31
+ defaultOpen: boolean;
32
+ title: string;
33
+ template?: TemplateArray;
34
+ };
35
+
36
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
37
+ const { attributes, setAttributes } = props;
38
+
39
+ const blockProps = useBlockProps();
40
+ const parentBlockProps = useBlockParent();
41
+
42
+ /**
43
+ * Filter allowed blocks used in webentor/e-accordion inner block
44
+ */
45
+ const allowedBlocks: string[] = applyFilters(
46
+ 'webentor.core.e-accordion.allowedBlocks',
47
+ null,
48
+ blockProps,
49
+ parentBlockProps,
50
+ );
51
+
52
+ /**
53
+ * Filter template used in webentor/e-accordion inner block
54
+ */
55
+ const defaultTemplate: TemplateArray = attributes?.template;
56
+ const template: TemplateArray = applyFilters(
57
+ 'webentor.core.e-accordion.template',
58
+ defaultTemplate,
59
+ blockProps,
60
+ parentBlockProps,
61
+ );
62
+
63
+ const innerBlocksProps = useInnerBlocksProps(blockProps, {
64
+ allowedBlocks,
65
+ template,
66
+ });
67
+
68
+ // Preview image for block inserter
69
+ if (attributes.coverImage) {
70
+ return <img src={attributes.coverImage} width="467" />;
71
+ }
72
+
73
+ return (
74
+ <>
75
+ <InspectorControls>
76
+ <PanelBody title="Block Settings" initialOpen={true}>
77
+ <PanelRow>
78
+ <ToggleControl
79
+ label={__('Default Open?', 'webentor')}
80
+ help={__('Shoud accordion be opened by default?', 'webentor')}
81
+ checked={attributes.defaultOpen}
82
+ onChange={(defaultOpen) => setAttributes({ defaultOpen })}
83
+ />
84
+ </PanelRow>
85
+ </PanelBody>
86
+ </InspectorControls>
87
+
88
+ <div
89
+ {...blockProps}
90
+ className={`${blockProps.className} md:wbtr:pt-8 wbtr:flex wbtr:w-full wbtr:flex-col wbtr:border wbtr:border-editor-border wbtr:px-4 wbtr:pt-5 wbtr:pb-4`}
91
+ >
92
+ <div className="wbtr:absolute wbtr:top-[2px] wbtr:left-2 wbtr:mb-1 wbtr:text-10 wbtr:opacity-50">
93
+ {__('Accordion', 'webentor')}
94
+ </div>
95
+
96
+ <RichText
97
+ tagName="h2"
98
+ placeholder={__('Accordion Title (required)', 'webentor')}
99
+ value={attributes.title}
100
+ onChange={(title) => setAttributes({ title })}
101
+ />
102
+
103
+ <div
104
+ {...innerBlocksProps}
105
+ className={`${innerBlocksProps.className} wbtr:w-full wbtr:border wbtr:border-editor-border wbtr:p-4`}
106
+ />
107
+ </div>
108
+ </>
109
+ );
110
+ };
111
+
112
+ /**
113
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
114
+ *
115
+ * @return {null} Dynamic blocks do not save the HTML.
116
+ */
117
+ const BlockSave = () => <InnerBlocks.Content />;
118
+
119
+ /**
120
+ * Register block.
121
+ */
122
+ registerBlockType(block, {
123
+ edit: BlockEdit,
124
+ save: BlockSave,
125
+ });
@@ -0,0 +1 @@
1
+ // console.log('accordion script');
@@ -0,0 +1,8 @@
1
+ /* Basic colors vars */
2
+ :root {
3
+ --webentor-accordion-border-radius: 10px;
4
+ }
5
+
6
+ .w-accordion {
7
+ border-radius: var(--webentor-accordion-border-radius);
8
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/e-accordion-group",
5
+ "title": "Accordion Group",
6
+ "description": "Allows grouping of multiple accordions and enables to have only one accordion opened at a time.",
7
+ "category": "webentor-elements",
8
+ "icon": "list-view",
9
+ "keywords": ["accordion", "toggle", "elements"],
10
+ "attributes": {
11
+ "template": {
12
+ "type": "array",
13
+ "default": null
14
+ },
15
+ "display": {
16
+ "type": "object",
17
+ "default": {
18
+ "width": {
19
+ "value": {
20
+ "basic": "w-full"
21
+ }
22
+ }
23
+ }
24
+ },
25
+ "flexbox": {
26
+ "type": "object",
27
+ "default": {
28
+ "flex-direction": {
29
+ "value": {
30
+ "basic": "flex-col"
31
+ }
32
+ },
33
+ "gap": {
34
+ "value": {
35
+ "basic": "gap-5"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "supports": {
42
+ "anchor": true,
43
+ "webentor": {
44
+ "display": {
45
+ "display": true,
46
+ "minHeight": true,
47
+ "width": true
48
+ },
49
+ "grid": true,
50
+ "gridItem": true,
51
+ "flexbox": true,
52
+ "flexboxItem": true,
53
+ "spacing": true
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,99 @@
1
+ import {
2
+ InnerBlocks,
3
+ useBlockProps,
4
+ useInnerBlocksProps,
5
+ } from '@wordpress/block-editor';
6
+ import {
7
+ BlockEditProps,
8
+ registerBlockType,
9
+ TemplateArray,
10
+ } from '@wordpress/blocks';
11
+ import { applyFilters } from '@wordpress/hooks';
12
+ import { __ } from '@wordpress/i18n';
13
+
14
+ import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
15
+
16
+ import block from './block.json';
17
+
18
+ /**
19
+ * Edit component.
20
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
21
+ *
22
+ * @param {object} props The block props.
23
+ * @returns {Function} Render the edit screen
24
+ */
25
+
26
+ type AttributesType = {
27
+ coverImage: string;
28
+ template?: TemplateArray;
29
+ };
30
+
31
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
32
+ const { attributes } = props;
33
+
34
+ const blockProps = useBlockProps();
35
+ const parentBlockProps = useBlockParent();
36
+
37
+ /**
38
+ * Filter allowed blocks used in webentor/e-accordion-group inner block
39
+ */
40
+ const allowedBlocks: string[] = applyFilters(
41
+ 'webentor.core.e-accordion-group.allowedBlocks',
42
+ ['webentor/e-accordion'],
43
+ blockProps,
44
+ parentBlockProps,
45
+ );
46
+
47
+ /**
48
+ * Filter template used in webentor/e-accordion-group inner block
49
+ */
50
+ const defaultTemplate: TemplateArray = attributes?.template ?? [
51
+ ['webentor/e-accordion'],
52
+ ];
53
+ const template: TemplateArray = applyFilters(
54
+ 'webentor.core.e-accordion-group.template',
55
+ defaultTemplate,
56
+ blockProps,
57
+ parentBlockProps,
58
+ );
59
+
60
+ const { children, ...innerBlocksProps } = useInnerBlocksProps(blockProps, {
61
+ allowedBlocks,
62
+ template,
63
+ });
64
+
65
+ // Preview image for block inserter
66
+ if (attributes.coverImage) {
67
+ return <img src={attributes.coverImage} width="468" />;
68
+ }
69
+
70
+ return (
71
+ <>
72
+ <div
73
+ {...innerBlocksProps}
74
+ className={`${innerBlocksProps.className} e-accordion-group wbtr:relative wbtr:border wbtr:border-dashed wbtr:border-editor-border wbtr:p-4`}
75
+ >
76
+ <div className="wbtr:absolute wbtr:top-[2px] wbtr:left-2 wbtr:mb-1 wbtr:text-10 wbtr:opacity-50">
77
+ {__('Accordion Group', 'webentor')}
78
+ </div>
79
+
80
+ {children}
81
+ </div>
82
+ </>
83
+ );
84
+ };
85
+
86
+ /**
87
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
88
+ *
89
+ * @return {null} Dynamic blocks do not save the HTML.
90
+ */
91
+ const BlockSave = () => <InnerBlocks.Content />;
92
+
93
+ /**
94
+ * Register block.
95
+ */
96
+ registerBlockType(block, {
97
+ edit: BlockEdit,
98
+ save: BlockSave,
99
+ });
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "name": "webentor/e-breadcrumbs",
4
+ "apiVersion": 3,
5
+ "title": "Breadcrumbs",
6
+ "description": "Block showing breadcrumbs.",
7
+ "category": "webentor-elements",
8
+ "icon": "open-folder",
9
+ "keywords": [
10
+ "breadcrumbs"
11
+ ],
12
+ "attributes": {
13
+ "anchor": {
14
+ "type": "string",
15
+ "default": ""
16
+ },
17
+ "spacing": {
18
+ "type": "object",
19
+ "default": {
20
+ "padding-top": {
21
+ "value": {
22
+ "basic": "pt-3.5",
23
+ "lg": "pt-4"
24
+ }
25
+ },
26
+ "padding-bottom": {
27
+ "value": {
28
+ "basic": "pb-3.5",
29
+ "lg": "pb-4"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ },
35
+ "supports": {
36
+ "anchor": true,
37
+ "webentor": {
38
+ "spacing": true
39
+ }
40
+ }
41
+ }