mt-block-editor-block 1.1.17 → 1.3.0-alpha.1

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