@ideasonpurpose/wp-theme-addons 0.3.0 → 0.4.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.
- package/CssLocalProps/css-local-props.js +1 -1
- package/README.md +43 -14
- package/editor/Block/Extension/Button/button-icon-picker.js +125 -0
- package/editor/Block/Extension/Button/button-icon-picker.scss +65 -0
- package/editor/Block/Variation/Group/LinkedGroup/LinkedGroup.php +0 -8
- package/editor/Block/Variation/Group/LinkedGroup/linked-group.js +5 -6
- package/editor/Block/Variation/Group/LinkedGroup/linked-group.scss +22 -0
- package/editor/Block/Variation/Query/RelatedPostsQuery/RelatedPostsQuery.php +1 -1
- package/editor/Block/Variation/Query/RelatedPostsQuery/related-posts-query.js +10 -14
- package/index.d.ts +36 -0
- package/index.js +4 -5
- package/package.json +3 -1
- package/editor/Block/Variation/Group/LinkedGroup/linked-group.css +0 -22
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# WordPress Theme Addons
|
|
2
2
|
|
|
3
|
-
#### Version 0.
|
|
3
|
+
#### Version 0.4.0
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@ideasonpurpose/wp-theme-addons)
|
|
6
6
|
[](https://packagist.org/packages/ideasonpurpose/wp-theme-addons)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
This repository contains JavaScript and PHP add-ons for the WordPress Block Editor and Hybrid themes. The project is used in production, but is under active development and implementations are likely to change.
|
|
8
|
+
This repository contains JavaScript and PHP add-ons for the WordPress Block Editor and Hybrid themes. The project is used in production, but is under active development and implementations are likely to change.
|
|
10
9
|
|
|
11
10
|
## What's in here
|
|
12
11
|
|
|
@@ -20,6 +19,33 @@ A variation on the Group block which adds standard Link controls. The link imple
|
|
|
20
19
|
|
|
21
20
|
A variation on the Query Loop block which replaces the query with ranked related posts. Ranking lives in `lib/RelatedPosts` (`IdeasOnPurpose\WP\RelatedPosts`) — weighted shared taxonomies, post type, and recency, with optional REST at `GET /wp-json/ideasonpurpose/v1/related_posts/{id}`.
|
|
22
21
|
|
|
22
|
+
### Block Extensions
|
|
23
|
+
|
|
24
|
+
#### Button Icons
|
|
25
|
+
|
|
26
|
+
This extension adds an icon-picker to the `core/button` block. Markup is unchanged, icons are specified by adding classes. Classes are added in the Block Editor as well as the front end, so authors can work with a true representation of the final button.
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import { initButtonIconPicker } from "@ideasonpurpose/wp-theme-addons";
|
|
30
|
+
|
|
31
|
+
initButtonIconPicker(
|
|
32
|
+
[
|
|
33
|
+
{ label: "Arrow Right", value: "arrow-right" },
|
|
34
|
+
{ label: "Mail", value: "mail" },
|
|
35
|
+
{ label: "Download", value: "download" },
|
|
36
|
+
],
|
|
37
|
+
"arrow-right", // optional default icon, defaults to ""
|
|
38
|
+
);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Icons are displayed using CSS in the theme. Each icon maps to a mask variable the theme defines:
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
.wp-block-button.iop-button-icon.icon-arrow-right .wp-block-button__link::before {
|
|
45
|
+
mask-image: var(--i-arrow-right);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
23
49
|
### CSS Local Props
|
|
24
50
|
|
|
25
51
|
Injects block color attributes as CSS custom properties (`--local-text-color`, `--local-bg-color`, `--local-border-color`) so theme styles can use them.
|
|
@@ -90,23 +116,15 @@ Add the VCS repository and require the package in your project's `composer.json`
|
|
|
90
116
|
|
|
91
117
|
### JavaScript
|
|
92
118
|
|
|
93
|
-
Import
|
|
119
|
+
Import into **editor.js**. Minimal required styles are bundled with the JS:
|
|
94
120
|
|
|
95
121
|
```javascript
|
|
96
122
|
// @link https://github.com/ideasonpurpose/wp-theme-addons
|
|
97
|
-
import { initLinkedGroupBlock, initCssLocalProps } from "@ideasonpurpose/wp-theme-addons";
|
|
123
|
+
import { initLinkedGroupBlock, initCssLocalProps, initButtonIconPicker } from "@ideasonpurpose/wp-theme-addons";
|
|
98
124
|
|
|
99
|
-
// Instantiate the function
|
|
100
125
|
initLinkedGroupBlock();
|
|
101
126
|
initCssLocalProps();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Also add the matching Sass frontend styles:
|
|
105
|
-
|
|
106
|
-
```scss
|
|
107
|
-
// Import linked-group-front-end styles
|
|
108
|
-
// @link https://github.com/ideasonpurpose/wp-theme-addons
|
|
109
|
-
@use "@ideasonpurpose/wp-theme-addons/editor/block/variation/group-linked-group/linked-group-front-end";
|
|
127
|
+
initButtonIconPicker([...]);
|
|
110
128
|
```
|
|
111
129
|
|
|
112
130
|
### PHP
|
|
@@ -170,3 +188,14 @@ graph TD
|
|
|
170
188
|
- **npm** reads `package.json` → installs to `node_modules/` → JS/SCSS imports resolve via `@ideasonpurpose/wp-theme-addons`
|
|
171
189
|
- **Composer** reads `composer.json` → installs to `vendor/` → PHP classes autoload via PSR-4
|
|
172
190
|
- No conflicts: separate config files, separate dependency directories, separate language ecosystems.
|
|
191
|
+
|
|
192
|
+
<!-- START IOP CREDIT BLURB 2026-07-->
|
|
193
|
+
|
|
194
|
+
##
|
|
195
|
+
|
|
196
|
+
#### Brought to you by IOP
|
|
197
|
+
|
|
198
|
+
| <a href="https://www.ideasonpurpose.com"><img src="https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/iop-logo-white-on-black-88px.png" width="44" height="44" align="top" alt="IOP Logo"></a> <br> | This project is actively developed and used in production at <a href="https://www.ideasonpurpose.com">Ideas On Purpose</a>. <br> |
|
|
199
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
200
|
+
|
|
201
|
+
<!-- END IOP CREDIT BLURB -->
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import "./button-icon-picker.scss";
|
|
4
|
+
import { InspectorControls } from "@wordpress/block-editor";
|
|
5
|
+
import { PanelBody, SelectControl } from "@wordpress/components";
|
|
6
|
+
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
7
|
+
import { addFilter } from "@wordpress/hooks";
|
|
8
|
+
|
|
9
|
+
/** @type {{ label?: string; value: string }[]} */
|
|
10
|
+
let _icons = [];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {{ label?: string; value: string }[]} [icons]
|
|
14
|
+
* @param {string} [defaultIcon]
|
|
15
|
+
*/
|
|
16
|
+
export function initButtonIconPicker(icons = [], defaultIcon = "") {
|
|
17
|
+
// No icons, do nothing
|
|
18
|
+
if (icons.length === 0) return;
|
|
19
|
+
|
|
20
|
+
_icons = [{ label: "None", value: "" }, ...icons];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Add attributes to core/button
|
|
24
|
+
*/
|
|
25
|
+
addFilter(
|
|
26
|
+
"blocks.registerBlockType",
|
|
27
|
+
"ideasonpurpose.buttonIconPicker",
|
|
28
|
+
(/** @type {any} */ settings, /** @type {string} */ name) => {
|
|
29
|
+
if (name !== "core/button") return settings;
|
|
30
|
+
const newSettings = { ...settings };
|
|
31
|
+
newSettings.attributes = {
|
|
32
|
+
...newSettings.attributes,
|
|
33
|
+
buttonIcon: { type: "string", default: defaultIcon },
|
|
34
|
+
};
|
|
35
|
+
return newSettings;
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const buttonIconPickerInterface = createHigherOrderComponent(
|
|
41
|
+
(/** @type {any} */ BlockEdit) => {
|
|
42
|
+
return (/** @type {any} */ props) => {
|
|
43
|
+
if (props.name !== "core/button") {
|
|
44
|
+
return <BlockEdit {...props} />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const { attributes, setAttributes } = props;
|
|
48
|
+
const { buttonIcon } = attributes;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<BlockEdit {...props} />
|
|
53
|
+
<InspectorControls group="styles">
|
|
54
|
+
<PanelBody title="IOP Button Icon" initialOpen={true}>
|
|
55
|
+
<SelectControl
|
|
56
|
+
label="Select an icon"
|
|
57
|
+
value={buttonIcon}
|
|
58
|
+
__next40pxDefaultSize={true}
|
|
59
|
+
options={_icons}
|
|
60
|
+
onChange={(/** @type {any} */ value) =>
|
|
61
|
+
setAttributes({ buttonIcon: value })
|
|
62
|
+
}
|
|
63
|
+
/>
|
|
64
|
+
</PanelBody>
|
|
65
|
+
</InspectorControls>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
"buttonIconPickerInterface",
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
addFilter(
|
|
74
|
+
"editor.BlockEdit",
|
|
75
|
+
"ideasonpurpose.buttonIconPicker.BlockEdit",
|
|
76
|
+
buttonIconPickerInterface,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Add icon class to the button wrapper for both save and editor preview
|
|
81
|
+
*/
|
|
82
|
+
addFilter(
|
|
83
|
+
"blocks.getSaveContent.extraProps",
|
|
84
|
+
"ideasonpurpose.buttonIconPicker.extraProps",
|
|
85
|
+
(
|
|
86
|
+
/** @type {any} */ extraProps,
|
|
87
|
+
/** @type {any} */ blockType,
|
|
88
|
+
/** @type {any} */ attributes,
|
|
89
|
+
) => {
|
|
90
|
+
if (blockType.name !== "core/button") return extraProps;
|
|
91
|
+
const { buttonIcon } = attributes;
|
|
92
|
+
if (buttonIcon) {
|
|
93
|
+
extraProps.className = [
|
|
94
|
+
extraProps.className,
|
|
95
|
+
"iop-button-icon",
|
|
96
|
+
`icon-${buttonIcon}`,
|
|
97
|
+
]
|
|
98
|
+
.filter(Boolean)
|
|
99
|
+
.join(" ");
|
|
100
|
+
}
|
|
101
|
+
return extraProps;
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const buttonIconClass = createHigherOrderComponent(
|
|
106
|
+
(/** @type {any} */ BlockListBlock) => {
|
|
107
|
+
return (/** @type {any} */ props) => {
|
|
108
|
+
if (props.name !== "core/button") {
|
|
109
|
+
return <BlockListBlock {...props} />;
|
|
110
|
+
}
|
|
111
|
+
const { attributes, className } = props;
|
|
112
|
+
const { buttonIcon } = attributes;
|
|
113
|
+
const iconClass = buttonIcon ? `iop-button-icon icon-${buttonIcon}` : "";
|
|
114
|
+
const newClassName = [className, iconClass].filter(Boolean).join(" ");
|
|
115
|
+
return <BlockListBlock {...props} className={newClassName} />;
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
"buttonIconClass",
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
addFilter(
|
|
122
|
+
"editor.BlockListBlock",
|
|
123
|
+
"ideasonpurpose.buttonIconPicker.BlockListBlock",
|
|
124
|
+
buttonIconClass,
|
|
125
|
+
);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Button Icon Picker — generic front-end + editor boilerplate.
|
|
2
|
+
//
|
|
3
|
+
// Pairs with editor/Block/Extension/Button/button-icon-picker.js, which writes
|
|
4
|
+
// `iop-button-icon icon-{name}` classes onto the core/button wrapper.
|
|
5
|
+
//
|
|
6
|
+
// The ::before element renders the glyph via `mask-image`. Each icon needs a
|
|
7
|
+
// corresponding mask variable (usually a `url("data:image/svg+xml,...")`
|
|
8
|
+
// defined by the theme), e.g.:
|
|
9
|
+
//
|
|
10
|
+
// .wp-block-button.iop-button-icon.icon-arrow-right .wp-block-button__link::before {
|
|
11
|
+
// mask-image: var(--i-arrow-right);
|
|
12
|
+
// }
|
|
13
|
+
//
|
|
14
|
+
// Icon sizing uses `1.2em` so the glyph scales with the button's font-size.
|
|
15
|
+
// Override width/height per project as needed.
|
|
16
|
+
|
|
17
|
+
.wp-block-button {
|
|
18
|
+
&.iop-button-icon .wp-block-button__link {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
gap: 0.5em;
|
|
22
|
+
align-items: center;
|
|
23
|
+
|
|
24
|
+
&.has-text-align-right {
|
|
25
|
+
flex-direction: row-reverse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&::before {
|
|
29
|
+
content: "";
|
|
30
|
+
|
|
31
|
+
display: block;
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
width: 1.2em;
|
|
34
|
+
height: 1.2em;
|
|
35
|
+
|
|
36
|
+
background: currentColor;
|
|
37
|
+
|
|
38
|
+
mask-repeat: no-repeat;
|
|
39
|
+
mask-size: contain;
|
|
40
|
+
mask-position: center;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Example icon rules, add these to the active theme.
|
|
46
|
+
// vars represent SVG files loaded with url() like this
|
|
47
|
+
// :root {
|
|
48
|
+
// --i-arrow-right: url("../svg/arrow-right.svg");
|
|
49
|
+
// }
|
|
50
|
+
//
|
|
51
|
+
// .wp-block-button {
|
|
52
|
+
// &.iop-button-icon {
|
|
53
|
+
// &.icon-arrow-right .wp-block-button__link::before {
|
|
54
|
+
// mask-image: var(--i-arrow-right);
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// &.icon-mail .wp-block-button__link::before {
|
|
58
|
+
// mask-image: var(--i-mail);
|
|
59
|
+
// }
|
|
60
|
+
//
|
|
61
|
+
// &.icon-download .wp-block-button__link::before {
|
|
62
|
+
// mask-image: var(--i-download);
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
@@ -20,14 +20,6 @@ class LinkedGroup
|
|
|
20
20
|
* Callbacks are per block, and cannot be specific to a single variation
|
|
21
21
|
*/
|
|
22
22
|
add_filter('register_block_type_args', [$this, 'wrap_render_callback'], 10, 2);
|
|
23
|
-
add_action('wp_enqueue_scripts', [$this, 'enqueue_styles']);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public function enqueue_styles()
|
|
27
|
-
{
|
|
28
|
-
$css_file = __DIR__ . '/linked-group.css';
|
|
29
|
-
$css_url = home_url(str_replace(ABSPATH, '', $css_file));
|
|
30
|
-
wp_enqueue_style('iop-linked-group', $css_url, [], filemtime($css_file));
|
|
31
23
|
}
|
|
32
24
|
|
|
33
25
|
public function wrap_render_callback($args, $block_type)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import "./linked-group.scss";
|
|
3
4
|
import {
|
|
4
5
|
BlockControls,
|
|
5
6
|
InspectorControls,
|
|
6
7
|
LinkControl,
|
|
7
8
|
} from "@wordpress/block-editor";
|
|
8
|
-
import {
|
|
9
|
+
import { createBlock, registerBlockVariation } from "@wordpress/blocks";
|
|
9
10
|
import {
|
|
10
11
|
ExternalLink,
|
|
11
12
|
Popover,
|
|
@@ -17,12 +18,11 @@ import {
|
|
|
17
18
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
18
19
|
} from "@wordpress/components";
|
|
19
20
|
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
20
|
-
import {
|
|
21
|
+
// import { select, useSelect, withSelect } from "@wordpress/data";
|
|
22
|
+
import { createInterpolateElement, useState } from "@wordpress/element";
|
|
21
23
|
import { addFilter } from "@wordpress/hooks";
|
|
22
|
-
import { SVG, Path } from "@wordpress/primitives";
|
|
23
24
|
import { __ } from "@wordpress/i18n";
|
|
24
|
-
|
|
25
|
-
import { createInterpolateElement } from "@wordpress/element";
|
|
25
|
+
import { Path, SVG } from "@wordpress/primitives";
|
|
26
26
|
|
|
27
27
|
export default {};
|
|
28
28
|
|
|
@@ -271,7 +271,6 @@ const makeSaveElement = (element, blockType, attributes) => {
|
|
|
271
271
|
|
|
272
272
|
const href = linkToSelf ? "#__LINKED_GROUP_PLACEHOLDER__" : url;
|
|
273
273
|
|
|
274
|
-
|
|
275
274
|
const link = (
|
|
276
275
|
<a
|
|
277
276
|
href={href}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.iop-linked-group {
|
|
2
|
+
position: relative;
|
|
3
|
+
|
|
4
|
+
& a.iop-linked-group__link {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
z-index: 10;
|
|
9
|
+
|
|
10
|
+
width: 100%;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* every clickable element in the group needs to be position:relative */
|
|
17
|
+
& button,
|
|
18
|
+
& a:not(.iop-linked-group__link) {
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: 20;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -74,7 +74,7 @@ class RelatedPostsQuery
|
|
|
74
74
|
global $post;
|
|
75
75
|
$postTypes = $request->get_param('postTypes') ?? [];
|
|
76
76
|
$weights = $request->get_param('weights') ?? [];
|
|
77
|
-
$relatedPost = $request->get_param('relatedPost') ??
|
|
77
|
+
$relatedPost = $request->get_param('relatedPost') ?? $post->ID ?? 0;
|
|
78
78
|
|
|
79
79
|
if ($weights) {
|
|
80
80
|
$rpArgs = [
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { registerBlockVariation } from "@wordpress/blocks";
|
|
2
|
-
import { addFilter } from "@wordpress/hooks";
|
|
3
|
-
import { SVG, Path } from "@wordpress/primitives";
|
|
4
|
-
|
|
5
|
-
import { usePublicPostTypes } from "../../../../../lib/use-public-post-types.js";
|
|
6
|
-
import { usePublicTaxonomies } from "../../../../../lib/use-public-taxonomies.js";
|
|
7
|
-
|
|
8
|
-
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
9
|
-
|
|
10
|
-
import { store as coreStore } from "@wordpress/core-data";
|
|
11
|
-
import { store as editorStore } from "@wordpress/editor";
|
|
12
|
-
|
|
13
1
|
import { InspectorControls } from "@wordpress/block-editor";
|
|
14
|
-
import {
|
|
2
|
+
import { registerBlockVariation } from "@wordpress/blocks";
|
|
15
3
|
import {
|
|
4
|
+
PanelBody,
|
|
16
5
|
RangeControl,
|
|
17
6
|
SelectControl,
|
|
18
7
|
Spinner,
|
|
19
8
|
Tip,
|
|
20
|
-
PanelBody,
|
|
21
9
|
} from "@wordpress/components";
|
|
10
|
+
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
11
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
12
|
+
import { select } from "@wordpress/data";
|
|
13
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
14
|
+
import { addFilter } from "@wordpress/hooks";
|
|
15
|
+
import { Path, SVG } from "@wordpress/primitives";
|
|
16
|
+
import { usePublicPostTypes } from "../../../../../lib/use-public-post-types.js";
|
|
17
|
+
import { usePublicTaxonomies } from "../../../../../lib/use-public-taxonomies.js";
|
|
22
18
|
|
|
23
19
|
const icon = (
|
|
24
20
|
<SVG
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare module "*.scss" {}
|
|
2
|
+
|
|
3
|
+
declare module "@ideasonpurpose/wp-theme-addons" {
|
|
4
|
+
interface WP_Post_Type {
|
|
5
|
+
slug: string;
|
|
6
|
+
name: string;
|
|
7
|
+
viewable: boolean;
|
|
8
|
+
taxonomies: string[];
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface WP_Taxonomy {
|
|
13
|
+
slug: string;
|
|
14
|
+
name: string;
|
|
15
|
+
visibility: {
|
|
16
|
+
publicly_queryable: boolean;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
labels: {
|
|
20
|
+
singular_name: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function usePublicPostTypes(): WP_Post_Type[] | undefined;
|
|
27
|
+
export function usePublicTaxonomies(): WP_Taxonomy[] | undefined;
|
|
28
|
+
|
|
29
|
+
export function initButtonIconPicker(
|
|
30
|
+
icons?: { label?: string; value: string }[],
|
|
31
|
+
defaultIcon?: string,
|
|
32
|
+
): void;
|
|
33
|
+
export function initCssLocalProps(blockNames?: string[]): void;
|
|
34
|
+
export function initLinkedGroupBlock(): void;
|
|
35
|
+
export function initRelatedPostsQueryBlock(): void;
|
|
36
|
+
}
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { initCssLocalProps } from "./CssLocalProps/css-local-props.js";
|
|
2
|
+
export { initButtonIconPicker } from "./editor/Block/Extension/Button/button-icon-picker.js";
|
|
4
3
|
export { initLinkedGroupBlock } from "./editor/Block/Variation/Group/LinkedGroup/linked-group.js";
|
|
5
4
|
export { initRelatedPostsQueryBlock } from "./editor/Block/Variation/Query/RelatedPostsQuery/related-posts-query.js";
|
|
6
|
-
|
|
7
|
-
export {
|
|
5
|
+
export { usePublicPostTypes } from "./lib/use-public-post-types.js";
|
|
6
|
+
export { usePublicTaxonomies } from "./lib/use-public-taxonomies.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ideasonpurpose/wp-theme-addons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "WordPress Block Editor add-ons — JavaScript blocks, utilities, and PHP components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wordpress",
|
|
@@ -28,11 +28,13 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"exports": "./index.js",
|
|
30
30
|
"main": "index.js",
|
|
31
|
+
"types": "index.d.ts",
|
|
31
32
|
"directories": {
|
|
32
33
|
"lib": "lib"
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
36
|
"index.js",
|
|
37
|
+
"index.d.ts",
|
|
36
38
|
"lib",
|
|
37
39
|
"editor",
|
|
38
40
|
"CssLocalProps",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.iop-linked-group {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.iop-linked-group a.iop-linked-group__link {
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
z-index: 10;
|
|
10
|
-
|
|
11
|
-
width: 100%;
|
|
12
|
-
max-width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
|
-
margin: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* every clickable element in the group needs to be position:relative */
|
|
18
|
-
.iop-linked-group button,
|
|
19
|
-
.iop-linked-group a:not(.iop-linked-group__link) {
|
|
20
|
-
position: relative;
|
|
21
|
-
z-index: 20;
|
|
22
|
-
}
|