eddev 0.2.2-beta.6 → 0.2.2-beta.7
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/blocks/ContentBlocks.js +1 -1
- package/blocks/blockAttributes.d.ts +2 -0
- package/blocks/blockAttributes.js +17 -7
- package/blocks/inlineEditing.d.ts +3 -2
- package/blocks/inlineEditing.js +15 -2
- package/blocks/installGutenbergHooks.js +1 -1
- package/cli/preinstall.js +11 -6
- package/package.json +3 -3
package/blocks/ContentBlocks.js
CHANGED
|
@@ -48,7 +48,7 @@ function ContentBlocks(props) {
|
|
|
48
48
|
var Component = blocks_1.default[block.blockName];
|
|
49
49
|
if (!Component)
|
|
50
50
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, void 0);
|
|
51
|
-
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
51
|
+
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
52
52
|
// innerBlocks={block.innerBlocks}
|
|
53
53
|
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? ((0, jsx_runtime_1.jsx)(ContentBlocks, { blocks: block.innerBlocks }, void 0)) : null }), void 0) }), void 0));
|
|
54
54
|
}
|
|
@@ -6,6 +6,7 @@ interface Attributes {
|
|
|
6
6
|
declare type ProviderProps = PropsWithChildren<{
|
|
7
7
|
values: Attributes;
|
|
8
8
|
innerBlocks: ContentBlock[];
|
|
9
|
+
block: [string, Attributes];
|
|
9
10
|
onChange?: (attrs: Attributes) => void;
|
|
10
11
|
insertBlocksAfter?: (block: any) => void;
|
|
11
12
|
}>;
|
|
@@ -13,4 +14,5 @@ export declare function InlineEditingContextProvider(props: ProviderProps): JSX.
|
|
|
13
14
|
export declare function useInlineEditableValue<T>(key: string, defaultValue?: T): [T, (value: T) => void];
|
|
14
15
|
export declare function useBlockAppender(): ((block: any) => void) | undefined;
|
|
15
16
|
export declare function useInnerBlocks(): ContentBlock[];
|
|
17
|
+
export declare function useBlockParents(): [string, Attributes][];
|
|
16
18
|
export {};
|
|
@@ -10,15 +10,26 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
23
|
+
exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
15
24
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
25
|
var react_1 = require("react");
|
|
17
26
|
var InlineEditingContext = (0, react_1.createContext)(undefined);
|
|
18
27
|
function InlineEditingContextProvider(props) {
|
|
28
|
+
var parentContext = (0, react_1.useContext)(InlineEditingContext);
|
|
19
29
|
return ((0, jsx_runtime_1.jsx)(InlineEditingContext.Provider, __assign({ value: {
|
|
20
30
|
values: props.values,
|
|
21
31
|
innerBlocks: props.innerBlocks,
|
|
32
|
+
parents: __spreadArray(__spreadArray([], ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.parents) || []), true), [props.block], false).filter(Boolean),
|
|
22
33
|
getValue: function (key) {
|
|
23
34
|
var _a;
|
|
24
35
|
return (_a = props.values) === null || _a === void 0 ? void 0 : _a[key];
|
|
@@ -52,11 +63,10 @@ exports.useBlockAppender = useBlockAppender;
|
|
|
52
63
|
function useInnerBlocks() {
|
|
53
64
|
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
54
65
|
return (ctx === null || ctx === void 0 ? void 0 : ctx.innerBlocks) || [];
|
|
55
|
-
// return [
|
|
56
|
-
// attrs?.getValue(key),
|
|
57
|
-
// (value: any) => {
|
|
58
|
-
// attrs?.setValue(key, value)
|
|
59
|
-
// },
|
|
60
|
-
// ] as [T, (value: T) => void]
|
|
61
66
|
}
|
|
62
67
|
exports.useInnerBlocks = useInnerBlocks;
|
|
68
|
+
function useBlockParents() {
|
|
69
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
70
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents) || [];
|
|
71
|
+
}
|
|
72
|
+
exports.useBlockParents = useBlockParents;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementType } from "react";
|
|
1
|
+
import { ElementType, FunctionComponent } from "react";
|
|
2
2
|
import { ContentBlocksSettings } from ".";
|
|
3
3
|
declare type PropTypes<T extends ElementType> = {
|
|
4
4
|
/** The 'key' of this editable text value */
|
|
@@ -16,7 +16,8 @@ declare type PropTypes<T extends ElementType> = {
|
|
|
16
16
|
} & React.ComponentPropsWithoutRef<T>;
|
|
17
17
|
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, ...props }: PropTypes<T>): JSX.Element | null;
|
|
18
18
|
declare type AppenderConfig = {
|
|
19
|
-
button
|
|
19
|
+
type: "default" | "button" | FunctionComponent<any>;
|
|
20
|
+
block?: boolean;
|
|
20
21
|
};
|
|
21
22
|
declare type InnerBlocksProps = {
|
|
22
23
|
allowedBlocks?: string[];
|
package/blocks/inlineEditing.js
CHANGED
|
@@ -24,7 +24,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.InnerBlocks = exports.EditableText = void 0;
|
|
26
26
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
-
// @ts-ignore
|
|
28
27
|
var block_editor_1 = require("@wordpress/block-editor");
|
|
29
28
|
// @ts-ignore
|
|
30
29
|
var blocks_1 = require("@wordpress/blocks");
|
|
@@ -75,11 +74,22 @@ function EditableText(_a) {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
exports.EditableText = EditableText;
|
|
77
|
+
var Appender = function (props) {
|
|
78
|
+
if (props.type === "button") {
|
|
79
|
+
return (0, jsx_runtime_1.jsx)(block_editor_1.ButtonBlockAppender, {}, void 0);
|
|
80
|
+
}
|
|
81
|
+
else if (typeof props.type === "function") {
|
|
82
|
+
return props.type({});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(block_editor_1.DefaultBlockAppender, {}, void 0);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
78
88
|
function InnerBlocks(props) {
|
|
79
89
|
if (process.admin) {
|
|
80
90
|
var allowedBlocks = props.allowedBlocks;
|
|
81
91
|
return ((0, jsx_runtime_1.jsx)(InnerBlocksAdminWrapper, __assign({ orientation: props.orientation || "vertical" }, { children: (0, jsx_runtime_1.jsx)(block_editor_1.InnerBlocks, { orientation: props.orientation, allowedBlocks: allowedBlocks,
|
|
82
|
-
// renderAppender={
|
|
92
|
+
// renderAppender={() => <Appender {...props.appender} />}
|
|
83
93
|
templateLock: props.templateLock, template: props.template }, void 0) }), void 0));
|
|
84
94
|
}
|
|
85
95
|
else {
|
|
@@ -97,6 +107,9 @@ var InnerBlocksAdminWrapper = (0, react_2.styled)("div", {
|
|
|
97
107
|
// marginRight: "auto",
|
|
98
108
|
maxWidth: "var(--grid-inner-width)",
|
|
99
109
|
},
|
|
110
|
+
".block-editor-block-list__block .block-list-appender:only-child": {
|
|
111
|
+
alignSelf: "auto !important",
|
|
112
|
+
},
|
|
100
113
|
variants: {
|
|
101
114
|
orientation: {
|
|
102
115
|
vertical: {
|
|
@@ -97,7 +97,7 @@ function installEDGutenbergHooks() {
|
|
|
97
97
|
});
|
|
98
98
|
return children;
|
|
99
99
|
}, []);
|
|
100
|
-
return ((0, jsx_runtime_1.jsx)(BlockContext.Provider, __assign({ value: { name: name, props: props } }, { children: (0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: props.attributes.inline || {}, innerBlocks: children, onChange: function (attrs) {
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(BlockContext.Provider, __assign({ value: { name: name, props: props } }, { children: (0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], onChange: function (attrs) {
|
|
101
101
|
props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
|
|
102
102
|
}, insertBlocksAfter: props.insertBlocksAfter }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
103
103
|
};
|
package/cli/preinstall.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.main = void 0;
|
|
4
|
-
var
|
|
5
|
-
var path_1 = require("path");
|
|
4
|
+
var child_process_1 = require("child_process");
|
|
6
5
|
function main() {
|
|
6
|
+
var _a, _b;
|
|
7
7
|
if (process.env.VERCEL) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
pkg.devDependencies["next"] = "^12.1.0"
|
|
11
|
-
|
|
8
|
+
// const pkgFile = join(process.cwd(), "package.json")
|
|
9
|
+
// const pkg = JSON.parse(readFileSync(pkgFile).toString()) as any
|
|
10
|
+
// pkg.devDependencies["next"] = "^12.1.0"
|
|
11
|
+
// writeFile(pkgFile, JSON.stringify(pkg, null, " "), () => {})
|
|
12
|
+
var proc = (0, child_process_1.spawn)("yarn", ["add", "--dev", "next@^12.1.0"], {
|
|
13
|
+
cwd: process.cwd(),
|
|
14
|
+
});
|
|
15
|
+
(_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout);
|
|
16
|
+
(_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.pipe(process.stderr);
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.main = main;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "0.2.2-beta.
|
|
3
|
+
"version": "0.2.2-beta.7",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
49
49
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
|
50
50
|
"@soda/friendly-errors-webpack-plugin": "^1.8.0",
|
|
51
|
-
"@stitches/core": "^1.2.
|
|
52
|
-
"@stitches/react": "^1.2.
|
|
51
|
+
"@stitches/core": "^1.2.7",
|
|
52
|
+
"@stitches/react": "^1.2.7",
|
|
53
53
|
"@trpc/client": "^9.19.0",
|
|
54
54
|
"@trpc/next": "^9.19.0",
|
|
55
55
|
"@trpc/react": "^9.19.0",
|