mt-block-editor-block 1.1.18 → 1.3.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/React.d.ts +2 -2
- package/React.js +2 -3
- package/dist/Block.d.ts +24 -0
- package/dist/Block.js +3 -0
- package/dist/Component.d.ts +2 -0
- package/dist/Component.js +16 -0
- package/dist/Context.d.ts +2 -0
- package/dist/Context.js +8 -0
- package/dist/Hook.d.ts +2 -0
- package/dist/Hook.js +5 -0
- package/dist/React.d.ts +3 -0
- package/dist/React.js +10 -0
- package/dist/decorator.d.ts +2 -0
- package/dist/decorator.js +5 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +4 -0
- package/dist/icon.d.ts +2 -0
- package/dist/icon.js +6 -0
- package/dist/index.d.ts +166 -0
- package/dist/jsx-dev-runtime.d.ts +9 -0
- package/dist/jsx-dev-runtime.js +6 -0
- package/dist/jsx-runtime.d.ts +5 -0
- package/dist/jsx-runtime.js +7 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +9 -0
- package/index.d.ts +8 -5
- package/package.json +56 -6
- package/src/index.d.ts +15 -0
- package/src/jsx-dev-runtime.ts +22 -0
- package/src/jsx-runtime.ts +19 -0
package/React.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
declare const React: import(".").Map;
|
|
2
|
-
declare const useState: any, useEffect: any, useRef: any
|
|
3
|
-
export { React as default, useState, useEffect, useRef
|
|
2
|
+
declare const useState: any, useEffect: any, useRef: any;
|
|
3
|
+
export { React as default, useState, useEffect, useRef };
|
package/React.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
3
|
+
exports.useRef = exports.useEffect = exports.useState = exports["default"] = void 0;
|
|
4
4
|
var React = window.MTBlockEditor.React;
|
|
5
5
|
exports["default"] = React;
|
|
6
|
-
var useState = React.useState, useEffect = React.useEffect, useRef = React.useRef
|
|
6
|
+
var useState = React.useState, useEffect = React.useEffect, useRef = React.useRef;
|
|
7
7
|
exports.useState = useState;
|
|
8
8
|
exports.useEffect = useEffect;
|
|
9
9
|
exports.useRef = useRef;
|
|
10
|
-
exports.useCallback = useCallback;
|
package/dist/Block.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Editor } from "./index";
|
|
2
|
+
export interface Metadata {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface EditorOptions {
|
|
6
|
+
focus: boolean;
|
|
7
|
+
focusBlock?: boolean;
|
|
8
|
+
canRemove?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface NewOptions {
|
|
11
|
+
editor: Editor;
|
|
12
|
+
event: Event;
|
|
13
|
+
}
|
|
14
|
+
export interface NewFromHtmlOptions {
|
|
15
|
+
html: string;
|
|
16
|
+
node: Element;
|
|
17
|
+
factory: any;
|
|
18
|
+
meta: Metadata;
|
|
19
|
+
}
|
|
20
|
+
export interface SerializeOptions {
|
|
21
|
+
editor: Editor;
|
|
22
|
+
}
|
|
23
|
+
declare const _default: typeof import("./index").Block;
|
|
24
|
+
export default _default;
|
package/dist/Block.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const BlockIframePreview: any, BlockToolbar: any, BlockToolbarButton: any, BlockConfigPanel: any, BlockSetup: any, BlockSetupCommon: any, BlockLabel: any, EditorMode: any, Dialog: any, DialogHeader: any, DialogBody: any, DialogFooter: any;
|
|
2
|
+
export { BlockIframePreview, BlockToolbar, BlockToolbarButton, BlockConfigPanel, BlockSetup, BlockSetupCommon, BlockLabel, EditorMode, Dialog, DialogHeader, DialogBody, DialogFooter, };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogFooter = exports.DialogBody = exports.DialogHeader = exports.Dialog = exports.EditorMode = exports.BlockLabel = exports.BlockSetupCommon = exports.BlockSetup = exports.BlockConfigPanel = exports.BlockToolbarButton = exports.BlockToolbar = exports.BlockIframePreview = void 0;
|
|
4
|
+
var _a = window.MTBlockEditor.Component, BlockIframePreview = _a.BlockIframePreview, BlockToolbar = _a.BlockToolbar, BlockToolbarButton = _a.BlockToolbarButton, BlockConfigPanel = _a.BlockConfigPanel, BlockSetup = _a.BlockSetup, BlockSetupCommon = _a.BlockSetupCommon, BlockLabel = _a.BlockLabel, EditorMode = _a.EditorMode, Dialog = _a.Dialog, DialogHeader = _a.DialogHeader, DialogBody = _a.DialogBody, DialogFooter = _a.DialogFooter;
|
|
5
|
+
exports.BlockIframePreview = BlockIframePreview;
|
|
6
|
+
exports.BlockToolbar = BlockToolbar;
|
|
7
|
+
exports.BlockToolbarButton = BlockToolbarButton;
|
|
8
|
+
exports.BlockConfigPanel = BlockConfigPanel;
|
|
9
|
+
exports.BlockSetup = BlockSetup;
|
|
10
|
+
exports.BlockSetupCommon = BlockSetupCommon;
|
|
11
|
+
exports.BlockLabel = BlockLabel;
|
|
12
|
+
exports.EditorMode = EditorMode;
|
|
13
|
+
exports.Dialog = Dialog;
|
|
14
|
+
exports.DialogHeader = DialogHeader;
|
|
15
|
+
exports.DialogBody = DialogBody;
|
|
16
|
+
exports.DialogFooter = DialogFooter;
|
package/dist/Context.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBlocksContext = exports.BlocksContext = exports.useEditorContext = exports.EditorContext = void 0;
|
|
4
|
+
var _a = window.MTBlockEditor.Context, EditorContext = _a.EditorContext, useEditorContext = _a.useEditorContext, BlocksContext = _a.BlocksContext, useBlocksContext = _a.useBlocksContext;
|
|
5
|
+
exports.EditorContext = EditorContext;
|
|
6
|
+
exports.useEditorContext = useEditorContext;
|
|
7
|
+
exports.BlocksContext = BlocksContext;
|
|
8
|
+
exports.useBlocksContext = useBlocksContext;
|
package/dist/Hook.d.ts
ADDED
package/dist/Hook.js
ADDED
package/dist/React.d.ts
ADDED
package/dist/React.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCallback = exports.useRef = exports.useEffect = exports.useState = exports.default = void 0;
|
|
4
|
+
var React = window.MTBlockEditor.React;
|
|
5
|
+
exports.default = React;
|
|
6
|
+
var useState = React.useState, useEffect = React.useEffect, useRef = React.useRef, useCallback = React.useCallback;
|
|
7
|
+
exports.useState = useState;
|
|
8
|
+
exports.useEffect = useEffect;
|
|
9
|
+
exports.useRef = useRef;
|
|
10
|
+
exports.useCallback = useCallback;
|
package/dist/i18n.d.ts
ADDED
package/dist/i18n.js
ADDED
package/dist/icon.d.ts
ADDED
package/dist/icon.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
import { i18n, InitOptions as InitOptionsI18n } from "i18next";
|
|
4
|
+
|
|
5
|
+
interface Map {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Metadata {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EditorOptions {
|
|
16
|
+
id: string;
|
|
17
|
+
mode: string;
|
|
18
|
+
stylesheets: string[];
|
|
19
|
+
rootClassName?: string;
|
|
20
|
+
rootAttributes?: Record<string, string>;
|
|
21
|
+
panelBlockTypes?: string[];
|
|
22
|
+
shortcutBlockTypes?: string[];
|
|
23
|
+
block: Metadata;
|
|
24
|
+
i18n: InitOptionsI18n;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface BoilerplateBlockOptions {
|
|
28
|
+
typeId: string;
|
|
29
|
+
className: string;
|
|
30
|
+
rootBlock?: string | null;
|
|
31
|
+
label: string;
|
|
32
|
+
icon?: string;
|
|
33
|
+
iconString?: string;
|
|
34
|
+
html: string;
|
|
35
|
+
canRemoveBlock: boolean;
|
|
36
|
+
panelBlockTypes?: string[];
|
|
37
|
+
shortcutBlockTypes?: string[];
|
|
38
|
+
shouldBeCompiled: boolean;
|
|
39
|
+
previewHeader: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SerializeOptions {
|
|
43
|
+
editor: Editor;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SetFocusedIdsOptions {
|
|
47
|
+
forceUpdate: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type SetFocusedIds = (ids: string[], opts?: SetFocusedIdsOptions) => void;
|
|
51
|
+
|
|
52
|
+
interface EditorContextProps {
|
|
53
|
+
editor: Editor;
|
|
54
|
+
setFocusedIds: SetFocusedIds;
|
|
55
|
+
getFocusedIds: () => string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface EditHistoryHandlers {
|
|
59
|
+
id: symbol;
|
|
60
|
+
merge?: (a: EditHistory, b: EditHistory) => EditHistory | undefined | null;
|
|
61
|
+
undo: (history: EditHistory, props: EditorContextProps) => void;
|
|
62
|
+
redo: (history: EditHistory, props: EditorContextProps) => void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface EditHistory {
|
|
66
|
+
block: Block;
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
data: any;
|
|
69
|
+
group?: number | undefined;
|
|
70
|
+
handlers: EditHistoryHandlers;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export class EditManager {
|
|
74
|
+
public unload(): void;
|
|
75
|
+
public canUndo(): boolean;
|
|
76
|
+
public canRedo(): boolean;
|
|
77
|
+
public add(history: EditHistory): void;
|
|
78
|
+
public undo(props: EditorContextProps, group?: number): void;
|
|
79
|
+
public redo(props: EditorContextProps, group?: number): void;
|
|
80
|
+
public generateGroup(): number;
|
|
81
|
+
public beginGrouping(): void;
|
|
82
|
+
public endGrouping(): void;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class Editor {
|
|
86
|
+
public id: string;
|
|
87
|
+
public opts: EditorOptions;
|
|
88
|
+
public serialize(): Promise<void>;
|
|
89
|
+
public editManager: EditManager;
|
|
90
|
+
|
|
91
|
+
/** Definitions from eventemitter */
|
|
92
|
+
static prefixed: string | boolean;
|
|
93
|
+
public eventNames(): any;
|
|
94
|
+
public listeners(event: any): any[];
|
|
95
|
+
public listenerCount(event: any): number;
|
|
96
|
+
public emit(event: any, ...args: any): boolean;
|
|
97
|
+
public on(event: any, fn: any, context?: any): this;
|
|
98
|
+
public addListener(event: any, fn: any, context?: any): this;
|
|
99
|
+
public once(event: any, fn: any, context?: any): this;
|
|
100
|
+
public removeListener(
|
|
101
|
+
event: any,
|
|
102
|
+
fn?: any,
|
|
103
|
+
context?: any,
|
|
104
|
+
once?: boolean
|
|
105
|
+
): this;
|
|
106
|
+
public off(event: any, fn?: any, context?: any, once?: boolean): this;
|
|
107
|
+
public removeAllListeners(event?: any): this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export class Block {
|
|
111
|
+
public static typeId: string;
|
|
112
|
+
public static label: string;
|
|
113
|
+
public static icon: string;
|
|
114
|
+
public static selectable: boolean;
|
|
115
|
+
public static shouldBeCompiled: boolean;
|
|
116
|
+
public id: string;
|
|
117
|
+
public compiledHtml: string | undefined;
|
|
118
|
+
public placeholderLabel(): string;
|
|
119
|
+
public placeholder(): JSX.Element;
|
|
120
|
+
public metadata(): Metadata | null;
|
|
121
|
+
public metadataByOwnKeys(opts?: { keys?: string[] }): Metadata | null;
|
|
122
|
+
public keysForSetup(): string[];
|
|
123
|
+
public compile(opts: SerializeOptions): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export class EditorUtil {
|
|
127
|
+
public static version: string;
|
|
128
|
+
public static i18n: i18n;
|
|
129
|
+
public static Component: Map;
|
|
130
|
+
public static decorator: Map;
|
|
131
|
+
public static icon: Map;
|
|
132
|
+
public static util: Map;
|
|
133
|
+
public static React: Map;
|
|
134
|
+
public static jsxRuntime: {
|
|
135
|
+
jsx: (type: any, props: any, key?: React.Key) => any;
|
|
136
|
+
jsxs: (type: any, props: any, key?: React.Key) => any;
|
|
137
|
+
jsxDEV?: (
|
|
138
|
+
type: any,
|
|
139
|
+
props: any,
|
|
140
|
+
key?: React.Key,
|
|
141
|
+
isStatic?: boolean,
|
|
142
|
+
source?: any,
|
|
143
|
+
self?: any
|
|
144
|
+
) => any;
|
|
145
|
+
Fragment: typeof React.Fragment;
|
|
146
|
+
};
|
|
147
|
+
public static Context: Map;
|
|
148
|
+
public static Hook: Map;
|
|
149
|
+
public static Block: typeof Block;
|
|
150
|
+
public static apply(opts: EditorOptions): Promise<Editor>;
|
|
151
|
+
public static get({ id }: { id: string }): Editor | undefined;
|
|
152
|
+
public static unload({ id }: { id: string }): Promise<void>;
|
|
153
|
+
public static serialize(): Promise<void>;
|
|
154
|
+
public static registerBlockType(block: typeof Block): void;
|
|
155
|
+
public static createBoilerplateBlock(
|
|
156
|
+
opts: BoilerplateBlockOptions
|
|
157
|
+
): typeof Block;
|
|
158
|
+
public static isSupportedEnvironment(): boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare global {
|
|
162
|
+
interface Window {
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164
|
+
MTBlockEditor: typeof EditorUtil;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface JSXSource {
|
|
3
|
+
fileName?: string | undefined;
|
|
4
|
+
lineNumber?: number | undefined;
|
|
5
|
+
columnNumber?: number | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare const jsxDEV: (type: React.ElementType, props: unknown, key: React.Key | undefined, isStatic: boolean, source?: JSXSource, self?: unknown) => React.ReactElement;
|
|
8
|
+
export declare const Fragment: typeof React.Fragment;
|
|
9
|
+
export type { JSX } from "react";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fragment = exports.jsxDEV = void 0;
|
|
4
|
+
var jsxRuntime = window.MTBlockEditor.jsxRuntime;
|
|
5
|
+
exports.jsxDEV = jsxRuntime.jsxDEV || jsxRuntime.jsx;
|
|
6
|
+
exports.Fragment = jsxRuntime.Fragment;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export declare const jsx: (type: React.ElementType, props: unknown, key?: React.Key) => React.ReactElement;
|
|
3
|
+
export declare const jsxs: (type: React.ElementType, props: unknown, key?: React.Key) => React.ReactElement;
|
|
4
|
+
export declare const Fragment: typeof React.Fragment;
|
|
5
|
+
export type { JSX } from "react";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fragment = exports.jsxs = exports.jsx = void 0;
|
|
4
|
+
var jsxRuntime = window.MTBlockEditor.jsxRuntime;
|
|
5
|
+
exports.jsx = jsxRuntime.jsx;
|
|
6
|
+
exports.jsxs = jsxRuntime.jsxs;
|
|
7
|
+
exports.Fragment = jsxRuntime.Fragment;
|
package/dist/util.d.ts
ADDED
package/dist/util.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.focusIfIos = exports.isTouchDevice = exports.isIos = exports.sanitize = exports.nl2br = void 0;
|
|
4
|
+
var _a = window.MTBlockEditor.util, nl2br = _a.nl2br, sanitize = _a.sanitize, isIos = _a.isIos, isTouchDevice = _a.isTouchDevice, focusIfIos = _a.focusIfIos;
|
|
5
|
+
exports.nl2br = nl2br;
|
|
6
|
+
exports.sanitize = sanitize;
|
|
7
|
+
exports.isIos = isIos;
|
|
8
|
+
exports.isTouchDevice = isTouchDevice;
|
|
9
|
+
exports.focusIfIos = focusIfIos;
|
package/index.d.ts
CHANGED
|
@@ -41,16 +41,19 @@ export interface SerializeOptions {
|
|
|
41
41
|
editor: Editor;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
interface
|
|
44
|
+
interface SetFocusedIdOptions {
|
|
45
45
|
forceUpdate: boolean;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
type
|
|
48
|
+
type SetFocusedId = (
|
|
49
|
+
id: string | null,
|
|
50
|
+
opts?: SetFocusedIdOptions
|
|
51
|
+
) => void;
|
|
49
52
|
|
|
50
53
|
interface EditorContextProps {
|
|
51
54
|
editor: Editor;
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
setFocusedId: SetFocusedId;
|
|
56
|
+
getFocusedId: () => string | null;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export interface EditHistoryHandlers {
|
|
@@ -112,7 +115,7 @@ export class Block {
|
|
|
112
115
|
public static selectable: boolean;
|
|
113
116
|
public static shouldBeCompiled: boolean;
|
|
114
117
|
public id: string;
|
|
115
|
-
public compiledHtml: string
|
|
118
|
+
public compiledHtml: string;
|
|
116
119
|
public placeholderLabel(): string;
|
|
117
120
|
public placeholder(): JSX.Element;
|
|
118
121
|
public metadata(): Metadata | null;
|
package/package.json
CHANGED
|
@@ -1,11 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mt-block-editor-block",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "This package helps you define custom block types.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./Block": {
|
|
13
|
+
"types": "./dist/Block.d.ts",
|
|
14
|
+
"default": "./dist/Block.js"
|
|
15
|
+
},
|
|
16
|
+
"./Component": {
|
|
17
|
+
"types": "./dist/Component.d.ts",
|
|
18
|
+
"default": "./dist/Component.js"
|
|
19
|
+
},
|
|
20
|
+
"./Context": {
|
|
21
|
+
"types": "./dist/Context.d.ts",
|
|
22
|
+
"default": "./dist/Context.js"
|
|
23
|
+
},
|
|
24
|
+
"./decorator": {
|
|
25
|
+
"types": "./dist/decorator.d.ts",
|
|
26
|
+
"default": "./dist/decorator.js"
|
|
27
|
+
},
|
|
28
|
+
"./Hook": {
|
|
29
|
+
"types": "./dist/Hook.d.ts",
|
|
30
|
+
"default": "./dist/Hook.js"
|
|
31
|
+
},
|
|
32
|
+
"./i18n": {
|
|
33
|
+
"types": "./dist/i18n.d.ts",
|
|
34
|
+
"default": "./dist/i18n.js"
|
|
35
|
+
},
|
|
36
|
+
"./icon": {
|
|
37
|
+
"types": "./dist/icon.d.ts",
|
|
38
|
+
"default": "./dist/icon.js"
|
|
39
|
+
},
|
|
40
|
+
"./React": {
|
|
41
|
+
"types": "./dist/React.d.ts",
|
|
42
|
+
"default": "./dist/React.js"
|
|
43
|
+
},
|
|
44
|
+
"./util": {
|
|
45
|
+
"types": "./dist/util.d.ts",
|
|
46
|
+
"default": "./dist/util.js"
|
|
47
|
+
},
|
|
48
|
+
"./jsx-runtime": {
|
|
49
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
50
|
+
"default": "./dist/jsx-runtime.js"
|
|
51
|
+
},
|
|
52
|
+
"./jsx-dev-runtime": {
|
|
53
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
54
|
+
"default": "./dist/jsx-dev-runtime.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
7
57
|
"scripts": {
|
|
8
|
-
"build": "rimraf dist && tsc -d src/*.ts --outDir dist && cpy \"./src/index.d.ts\"
|
|
58
|
+
"build": "rimraf dist && tsc -d src/*.ts --outDir dist --lib esnext,dom && cpy \"./src/index.d.ts\" ./dist/ --flat",
|
|
9
59
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
60
|
},
|
|
11
61
|
"author": "",
|
|
@@ -14,10 +64,10 @@
|
|
|
14
64
|
"cpy": "^11.0.1",
|
|
15
65
|
"cpy-cli": "^5.0.0",
|
|
16
66
|
"rimraf": "^3.0.2",
|
|
17
|
-
"typescript": "^
|
|
67
|
+
"typescript": "^5.9.3"
|
|
18
68
|
},
|
|
19
69
|
"dependencies": {
|
|
20
70
|
"@types/i18next": "^13.0.0",
|
|
21
|
-
"@types/react": "^
|
|
71
|
+
"@types/react": "^19.2.8"
|
|
22
72
|
}
|
|
23
73
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type * as React from "react";
|
|
1
3
|
import { i18n, InitOptions as InitOptionsI18n } from "i18next";
|
|
2
4
|
|
|
3
5
|
interface Map {
|
|
@@ -129,6 +131,19 @@ export class EditorUtil {
|
|
|
129
131
|
public static icon: Map;
|
|
130
132
|
public static util: Map;
|
|
131
133
|
public static React: Map;
|
|
134
|
+
public static jsxRuntime: {
|
|
135
|
+
jsx: (type: any, props: any, key?: React.Key) => any;
|
|
136
|
+
jsxs: (type: any, props: any, key?: React.Key) => any;
|
|
137
|
+
jsxDEV?: (
|
|
138
|
+
type: any,
|
|
139
|
+
props: any,
|
|
140
|
+
key?: React.Key,
|
|
141
|
+
isStatic?: boolean,
|
|
142
|
+
source?: any,
|
|
143
|
+
self?: any
|
|
144
|
+
) => any;
|
|
145
|
+
Fragment: typeof React.Fragment;
|
|
146
|
+
};
|
|
132
147
|
public static Context: Map;
|
|
133
148
|
public static Hook: Map;
|
|
134
149
|
public static Block: typeof Block;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = window.MTBlockEditor.jsxRuntime;
|
|
4
|
+
|
|
5
|
+
export interface JSXSource {
|
|
6
|
+
fileName?: string | undefined;
|
|
7
|
+
lineNumber?: number | undefined;
|
|
8
|
+
columnNumber?: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const jsxDEV: (
|
|
12
|
+
type: React.ElementType,
|
|
13
|
+
props: unknown,
|
|
14
|
+
key: React.Key | undefined,
|
|
15
|
+
isStatic: boolean,
|
|
16
|
+
source?: JSXSource,
|
|
17
|
+
self?: unknown
|
|
18
|
+
) => React.ReactElement = jsxRuntime.jsxDEV || jsxRuntime.jsx;
|
|
19
|
+
|
|
20
|
+
export const Fragment: typeof React.Fragment = jsxRuntime.Fragment;
|
|
21
|
+
|
|
22
|
+
export type { JSX } from "react";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = window.MTBlockEditor.jsxRuntime;
|
|
4
|
+
|
|
5
|
+
export const jsx: (
|
|
6
|
+
type: React.ElementType,
|
|
7
|
+
props: unknown,
|
|
8
|
+
key?: React.Key
|
|
9
|
+
) => React.ReactElement = jsxRuntime.jsx;
|
|
10
|
+
|
|
11
|
+
export const jsxs: (
|
|
12
|
+
type: React.ElementType,
|
|
13
|
+
props: unknown,
|
|
14
|
+
key?: React.Key
|
|
15
|
+
) => React.ReactElement = jsxRuntime.jsxs;
|
|
16
|
+
|
|
17
|
+
export const Fragment: typeof React.Fragment = jsxRuntime.Fragment;
|
|
18
|
+
|
|
19
|
+
export type { JSX } from "react";
|