@secretstache/wordpress-gutenberg 0.5.15 → 0.6.0

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 (34) hide show
  1. package/build/editor-canvas.css +1 -0
  2. package/build/editor-ui.css +1 -0
  3. package/build/index.js +7955 -3
  4. package/build/index.js.map +1 -1
  5. package/package.json +13 -13
  6. package/src/components/{DataQueryControls.js → DataQueryControls.jsx} +1 -1
  7. package/src/components/{IconPicker.js → IconPicker.jsx} +2 -1
  8. package/src/components/{MediaControl.js → MediaControl.jsx} +1 -1
  9. package/src/components/{MediaTypeControl.js → MediaTypeControl.jsx} +1 -1
  10. package/src/components/{MediaWithFocalPointControl.js → MediaWithFocalPointControl.jsx} +1 -1
  11. package/src/components/{ResponsiveSpacingControl.js → ResponsiveSpacingControl.jsx} +1 -1
  12. package/src/components/{SpacingControl.js → SpacingControl.jsx} +6 -5
  13. package/src/components/index.js +16 -16
  14. package/src/hooks/index.js +4 -5
  15. package/src/hooks/{usePreviewControl.js → usePreviewControl.jsx} +1 -1
  16. package/src/hooks/{useTabs.js → useTabs.jsx} +2 -2
  17. package/src/icons/index.jsx +38 -0
  18. package/src/index.js +3 -5
  19. package/src/styles/editor-canvas.scss +59 -0
  20. package/src/styles/editor-ui.scss +28 -0
  21. package/src/styles/styles.scss +1 -1
  22. package/src/utils/index.js +1 -1
  23. package/build/styles.css +0 -306
  24. package/src/hooks/useColorChange.js +0 -22
  25. /package/src/components/{ColorPaletteControl.js → ColorPaletteControl.jsx} +0 -0
  26. /package/src/components/{DividersControl.js → DividersControl.jsx} +0 -0
  27. /package/src/components/{EmptyBlockAppender.js → EmptyBlockAppender.jsx} +0 -0
  28. /package/src/components/{ImageActions.js → ImageActions.jsx} +0 -0
  29. /package/src/components/{InsertBlockToolbar.js → InsertBlockToolbar.jsx} +0 -0
  30. /package/src/components/{LinkControl.js → LinkControl.jsx} +0 -0
  31. /package/src/components/{PreviewControl.js → PreviewControl.jsx} +0 -0
  32. /package/src/components/{ResourcesWrapper.js → ResourcesWrapper.jsx} +0 -0
  33. /package/src/components/{SortableSelect.js → SortableSelect.jsx} +0 -0
  34. /package/src/utils/{filters.js → filters.jsx} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.5.15",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -15,7 +15,8 @@
15
15
  "module": "build/index.js",
16
16
  "exports": {
17
17
  ".": "./build/index.js",
18
- "./build/styles.css": "./build/styles.css"
18
+ "./build/editor-canvas.css": "./build/editor-canvas.css",
19
+ "./build/editor-ui.css": "./build/editor-ui.css"
19
20
  },
20
21
  "files": [
21
22
  "build",
@@ -23,8 +24,10 @@
23
24
  ],
24
25
  "type": "module",
25
26
  "scripts": {
26
- "build": "rollup -c",
27
- "start": "rollup -c -w",
27
+ "build": "yarn build:js && yarn build:css",
28
+ "build:js": "vite build",
29
+ "build:css": "sass src/styles/editor-canvas.scss build/editor-canvas.css --style=compressed --no-source-map && sass src/styles/editor-ui.scss build/editor-ui.css --style=compressed --no-source-map",
30
+ "dev": "vite",
28
31
  "prepublishOnly": "yarn build"
29
32
  },
30
33
  "devDependencies": {
@@ -33,10 +36,7 @@
33
36
  "@babel/preset-env": "^7.24.4",
34
37
  "@babel/preset-react": "^7.24.1",
35
38
  "@babel/runtime": "^7.24.4",
36
- "@rollup/plugin-babel": "^6.0.4",
37
- "@rollup/plugin-commonjs": "^25.0.7",
38
- "@rollup/plugin-node-resolve": "^15.2.3",
39
- "@rollup/plugin-terser": "^0.4.4",
39
+ "@vitejs/plugin-react": "^4.7.0",
40
40
  "@wordpress/api-fetch": "^7.24.0",
41
41
  "@wordpress/block-editor": "^14.19.0",
42
42
  "@wordpress/blocks": "^14.13.0",
@@ -45,14 +45,15 @@
45
45
  "@wordpress/dom-ready": "^4.24.0",
46
46
  "@wordpress/element": "^6.24.0",
47
47
  "@wordpress/hooks": "^4.24.0",
48
- "@wordpress/icons": "^10.24.0",
49
48
  "babel-core": "^6.26.3",
50
49
  "babel-loader": "^9.1.3",
51
50
  "node-sass": "^9.0.0",
52
51
  "postcss": "^8.4.38",
53
- "rollup": "^4.16.4",
54
- "rollup-plugin-peer-deps-external": "^2.2.4",
55
- "rollup-plugin-postcss": "^4.0.2"
52
+ "react": "^18.0.0",
53
+ "react-dom": "^18.0.0",
54
+ "sass": "^1.90.0",
55
+ "vite": "^7.0.6",
56
+ "vite-plugin-externals": "^0.6.2"
56
57
  },
57
58
  "dependencies": {
58
59
  "classnames": "^2.5.1",
@@ -70,7 +71,6 @@
70
71
  "@wordpress/dom-ready": "^4.24.0",
71
72
  "@wordpress/element": "^6.24.0",
72
73
  "@wordpress/hooks": "^4.24.0",
73
- "@wordpress/icons": "^10.24.0",
74
74
  "react": "^18.0.0",
75
75
  "react-dom": "^18.0.0"
76
76
  },
@@ -9,7 +9,7 @@ import { useSelect } from '@wordpress/data';
9
9
  import { arrayMove } from 'react-sortable-hoc';
10
10
  import Select from 'react-select';
11
11
 
12
- import { SortableSelectAsync } from './SortableSelect.js';
12
+ import { SortableSelectAsync } from './SortableSelect.jsx';
13
13
  import { decodeHtmlEntities, loadSelectOptions } from '../utils/index.js';
14
14
 
15
15
  const DataQueryContext = createContext({});
@@ -4,7 +4,8 @@ import {
4
4
  MediaUploadCheck,
5
5
  } from '@wordpress/block-editor';
6
6
  import { Button, Icon } from '@wordpress/components';
7
- import { edit as editIcon, trash as trashIcon } from '@wordpress/icons';
7
+
8
+ import { editIcon, trashIcon } from '../icons/index.jsx';
8
9
 
9
10
  export const IconPicker = ({ imageId, imageUrl, imageAlt, svgCode, onSelect, onRemove }) => {
10
11
  const hasImage = imageId && imageUrl;
@@ -1,7 +1,7 @@
1
1
  import { BaseControl, Button, FocalPointPicker, Icon as WPIcon } from '@wordpress/components';
2
2
  import { MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
3
- import { page as pageIcon } from '@wordpress/icons';
4
3
 
4
+ import { pageIcon } from '../icons/index.jsx';
5
5
  import { MEDIA_TYPE } from '../utils/index.js';
6
6
 
7
7
  export const ImageRenderer = ({
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from '@wordpress/element';
2
2
  import { SelectControl } from '@wordpress/components';
3
3
 
4
- import { MediaControl } from './MediaControl.js';
4
+ import { MediaControl } from './MediaControl.jsx';
5
5
  import { MEDIA_TYPE_LABEL, MEDIA_TYPE } from '../utils/index.js';
6
6
 
7
7
  export const MediaTypeControl = (props) => {
@@ -1,7 +1,7 @@
1
1
  import { BaseControl, FocalPointPicker } from '@wordpress/components';
2
2
  import { useCallback, memo } from '@wordpress/element';
3
3
 
4
- import { MediaControl } from './MediaControl.js';
4
+ import { MediaControl } from './MediaControl.jsx';
5
5
  import { MEDIA_TYPE } from '../utils/index.js';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { TabPanel } from '@wordpress/components';
2
2
  import { useCallback, useEffect, useState } from '@wordpress/element';
3
3
 
4
- import { SpacingControl } from './SpacingControl.js';
4
+ import { SpacingControl } from './SpacingControl.jsx';
5
5
 
6
6
  const getTabName = (deviceType = 'Desktop') => {
7
7
  return deviceType === 'Desktop' ? 'desktop' : 'mobile';
@@ -1,6 +1,7 @@
1
1
  import { RangeControl, Tooltip } from '@wordpress/components';
2
2
  import { useCallback } from '@wordpress/element';
3
- import { sidesBottom, sidesTop } from '@wordpress/icons';
3
+
4
+ import { sidesBottomIcon, sidesTopIcon } from '../icons/index.jsx';
4
5
 
5
6
  const generateMarks = (min, max) => [
6
7
  { value: min, label: min === -1 ? 'Default' : min.toString() },
@@ -77,7 +78,7 @@ export const SpacingControl = ({
77
78
  onChange={handleChange('margin', 'top')}
78
79
  disabled={disabledMargin.top}
79
80
  tooltip={marginTooltips.top}
80
- afterIcon={sidesTop}
81
+ afterIcon={sidesTopIcon}
81
82
  withInputField={false}
82
83
  />
83
84
 
@@ -89,7 +90,7 @@ export const SpacingControl = ({
89
90
  onChange={handleChange('margin', 'bottom')}
90
91
  disabled={disabledMargin.bottom}
91
92
  tooltip={marginTooltips.bottom}
92
- afterIcon={sidesBottom}
93
+ afterIcon={sidesBottomIcon}
93
94
  withInputField={false}
94
95
  />
95
96
  </>
@@ -105,7 +106,7 @@ export const SpacingControl = ({
105
106
  onChange={handleChange('padding', 'top')}
106
107
  disabled={disabledPadding.top}
107
108
  tooltip={paddingTooltips.top}
108
- afterIcon={sidesTop}
109
+ afterIcon={sidesTopIcon}
109
110
  withInputField={false}
110
111
  />
111
112
 
@@ -117,7 +118,7 @@ export const SpacingControl = ({
117
118
  onChange={handleChange('padding', 'bottom')}
118
119
  disabled={disabledPadding.bottom}
119
120
  tooltip={paddingTooltips.bottom}
120
- afterIcon={sidesBottom}
121
+ afterIcon={sidesBottomIcon}
121
122
  withInputField={false}
122
123
  />
123
124
  </>
@@ -1,16 +1,16 @@
1
- export { ColorPaletteControl } from './ColorPaletteControl';
2
- export { IconPicker } from './IconPicker';
3
- export { ImageActions } from './ImageActions';
4
- export { LinkControl } from './LinkControl';
5
- export { ImageRenderer, VideoRenderer, AnimationRenderer, MediaControl } from './MediaControl.js';
6
- export { SortableSelect, SortableSelectAsync } from './SortableSelect';
7
- export { DataQueryControls } from './DataQueryControls.js';
8
- export { SpacingControl } from './SpacingControl.js';
9
- export { ResponsiveSpacingControl } from './ResponsiveSpacingControl.js';
10
- export { ResourcesWrapper } from './ResourcesWrapper.js';
11
- export { DividersControl } from './DividersControl.js';
12
- export { MediaTypeControl } from './MediaTypeControl.js';
13
- export { InsertBlockToolbar } from './InsertBlockToolbar.js';
14
- export { PreviewControl } from './PreviewControl.js';
15
- export { EmptyBlockAppender } from './EmptyBlockAppender.js';
16
- export { MediaWithFocalPointControl } from './MediaWithFocalPointControl.js';
1
+ export { ColorPaletteControl } from './ColorPaletteControl.jsx';
2
+ export { IconPicker } from './IconPicker.jsx';
3
+ export { ImageActions } from './ImageActions.jsx';
4
+ export { LinkControl } from './LinkControl.jsx';
5
+ export { ImageRenderer, VideoRenderer, AnimationRenderer, MediaControl } from './MediaControl.jsx';
6
+ export { SortableSelect, SortableSelectAsync } from './SortableSelect.jsx';
7
+ export { DataQueryControls } from './DataQueryControls.jsx';
8
+ export { SpacingControl } from './SpacingControl.jsx';
9
+ export { ResponsiveSpacingControl } from './ResponsiveSpacingControl.jsx';
10
+ export { ResourcesWrapper } from './ResourcesWrapper.jsx';
11
+ export { DividersControl } from './DividersControl.jsx';
12
+ export { MediaTypeControl } from './MediaTypeControl.jsx';
13
+ export { InsertBlockToolbar } from './InsertBlockToolbar.jsx';
14
+ export { PreviewControl } from './PreviewControl.jsx';
15
+ export { EmptyBlockAppender } from './EmptyBlockAppender.jsx';
16
+ export { MediaWithFocalPointControl } from './MediaWithFocalPointControl.jsx';
@@ -1,11 +1,10 @@
1
- export { usePreviewControl } from './usePreviewControl.js';
1
+ export { usePreviewControl } from './usePreviewControl.jsx';
2
2
  export { useSlider } from './useSlider.js';
3
3
  export { useParentBlock } from './useParentBlock.js';
4
- export { useColorChange } from './useColorChange';
5
- export { useThemeColors } from './useThemeColors';
6
- export { useDataQuery } from './useDataQuery';
4
+ export { useThemeColors } from './useThemeColors.js';
5
+ export { useDataQuery } from './useDataQuery.js';
7
6
  export { useAccordionItem } from './useAccordionItem.js';
8
- export { useTabs } from './useTabs.js';
7
+ export { useTabs } from './useTabs.jsx';
9
8
  export { useAllowedBlocks } from './useAllowedBlocks.js';
10
9
  export { useChildBlockPosition } from './useChildBlockPosition.js';
11
10
  export { useFilterBlocks } from './useFilterBlocks.js';
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useState } from '@wordpress/element';
2
- import { PreviewControl } from '../components/PreviewControl.js';
2
+ import { PreviewControl } from '../components/PreviewControl.jsx';
3
3
 
4
4
  export const usePreviewControl = () => {
5
5
  const [ isPreview, setIsPreview ] = useState(false);
@@ -2,10 +2,10 @@ import { useSelect, useDispatch, select } from '@wordpress/data';
2
2
  import { store as blockEditorStore } from '@wordpress/block-editor';
3
3
  import { useLayoutEffect, useState } from '@wordpress/element';
4
4
  import { Button } from '@wordpress/components';
5
- import { plus as plusIcon } from '@wordpress/icons';
6
5
  import { createBlock } from '@wordpress/blocks';
7
6
 
8
- import { useParentBlock } from './useParentBlock';
7
+ import { plusIcon } from '../icons/index.jsx';
8
+ import { useParentBlock } from './useParentBlock.js';
9
9
 
10
10
  export const useTabs = (tabsClientId, tabItemName) => {
11
11
  const { insertBlock } = useDispatch(blockEditorStore);
@@ -0,0 +1,38 @@
1
+ export const editIcon = () => (
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
3
+ <path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"></path>
4
+ </svg>
5
+ );
6
+
7
+ export const trashIcon = () => (
8
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
9
+ <path fillRule="evenodd" clipRule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"></path>
10
+ </svg>
11
+ );
12
+
13
+ export const pageIcon = () => (
14
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
15
+ <path d="M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"></path>
16
+ <path d="M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"></path>
17
+ </svg>
18
+ );
19
+
20
+ export const plusIcon = () => (
21
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
22
+ <path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"></path>
23
+ </svg>
24
+ );
25
+
26
+ export const sidesBottomIcon = () => (
27
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
28
+ <path d="m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" style={{ opacity: 0.25 }}></path>
29
+ <path d="m16.5 19.5h-9v-1.5h9z"></path>
30
+ </svg>
31
+ );
32
+
33
+ export const sidesTopIcon = () => (
34
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
35
+ <path d="m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" style={{ opacity: 0.25 }}></path>
36
+ <path d="m16.5 6h-9v-1.5h9z"></path>
37
+ </svg>
38
+ );
package/src/index.js CHANGED
@@ -1,6 +1,4 @@
1
- export * from './components';
2
- export * from './hooks';
1
+ export * from './components/index.js';
2
+ export * from './hooks/index.js';
3
3
 
4
- export * from './utils';
5
-
6
- import './styles/styles.scss';
4
+ export * from './utils/index.js';
@@ -0,0 +1,59 @@
1
+ .editor-styles-wrapper {
2
+ // Hide default appender clickable area
3
+ &::after {
4
+ display: none;
5
+ }
6
+
7
+ .editor-visual-editor__post-title-wrapper {
8
+ margin-top: 10px !important;
9
+ margin-bottom: 10px !important;
10
+
11
+ h1.editor-post-title {
12
+ margin: 0;
13
+ border-bottom: 1px dashed #ddd;
14
+ padding-bottom: 10px;
15
+ font-weight: normal;
16
+ font-size: 30px;
17
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
18
+ text-align: center;
19
+ }
20
+ }
21
+
22
+
23
+ .block-editor-block-list__layout.is-root-container {
24
+ @import "root-block-appender";
25
+ @import "empty-block-appender";
26
+ @import "new-child-btn";
27
+ @import "image-wrapper";
28
+
29
+ margin-bottom: 0;
30
+ padding-bottom: 0;
31
+
32
+ &:has(.root-block-appender) {
33
+ margin-bottom: 3rem;
34
+ padding-bottom: 200px;
35
+ }
36
+
37
+ &.has-background {
38
+ transition:
39
+ background 1s,
40
+ color 1s;
41
+ }
42
+
43
+ & > .block-list-appender.wp-block:only-child {
44
+ p {
45
+ margin-top: 0;
46
+ margin-bottom: 0;
47
+ }
48
+ }
49
+
50
+ & > .block-list-appender.wp-block:only-child,
51
+ & > p.wp-block:only-child {
52
+ margin: 2rem 0;
53
+ }
54
+
55
+ .components-notice {
56
+ color: #000;
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,28 @@
1
+ .editor-sidebar {
2
+ @import "link-control";
3
+ @import "animation-file-renderer";
4
+ @import "icon-picker";
5
+ @import "media-picker";
6
+ @import "sortable-select";
7
+ @import "responsive-spacing";
8
+ @import "image-wrapper";
9
+ }
10
+
11
+ .editor-visual-editor {
12
+ z-index: 1;
13
+
14
+ // Hide metaboxes in Pattern editor
15
+ &.is-resizable {
16
+ & + .edit-post-layout__metaboxes {
17
+ display: none;
18
+ }
19
+ }
20
+ }
21
+
22
+ .block-editor-block-types-list > [role=presentation] {
23
+ justify-content: center;
24
+ }
25
+
26
+ .block-editor-inserter__insertable-blocks-at-selection + .block-editor-inserter__all-blocks {
27
+ display: none;
28
+ }
@@ -16,7 +16,7 @@
16
16
  .editor-visual-editor {
17
17
  z-index: 1;
18
18
 
19
- // Pattern editor
19
+ // Hide metaboxes in Pattern editor
20
20
  &.is-resizable {
21
21
  & + .edit-post-layout__metaboxes {
22
22
  display: none;
@@ -4,4 +4,4 @@ export * from './rootContainer/index.js';
4
4
  export * from './attributes.js';
5
5
  export * from './constants.js';
6
6
  export * from './helpers.js';
7
- export * from './filters.js';
7
+ export * from './filters.jsx';