@burger-editor/client 4.0.0-alpha.75 → 4.0.0-alpha.77
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/dist/burger-editor-root.d.ts +1 -1
- package/dist/client.js +10720 -10434
- package/dist/client.js.map +1 -1
- package/dist/components/block-catalog.d.ts +1 -1
- package/dist/components/block-menu-button.d.ts +1 -1
- package/dist/components/block-menu-view.d.ts +1 -1
- package/dist/components/block-menu.d.ts +1 -1
- package/dist/components/block-menu.d.ts.map +1 -1
- package/dist/components/block-options.d.ts +1 -1
- package/dist/components/draft-switcher.d.ts +1 -1
- package/dist/components/editable-area-view.d.ts +1 -1
- package/dist/components/editable-area-view.d.ts.map +1 -1
- package/dist/components/file-list.d.ts +1 -1
- package/dist/components/file-uploader.d.ts +1 -1
- package/dist/components/front-matter-editor.d.ts +1 -1
- package/dist/components/initial-insertion-button.d.ts +1 -1
- package/dist/components/item-editor-host.d.ts +1 -1
- package/dist/components/preview.d.ts +1 -1
- package/dist/components/table-editor.d.ts +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/thumbnail.d.ts +1 -1
- package/dist/components/wysiwyg-field.d.ts +1 -1
- package/dist/{editable-area-view-DssYcTqQ.js → editable-area-view-BRYT222Y.js} +174 -159
- package/dist/editable-area-view-BRYT222Y.js.map +1 -0
- package/dist/editor-dialog.d.ts +1 -1
- package/dist/{engine-context-gX6mWHke.js → engine-context-j4-LLPEh.js} +248 -74
- package/dist/engine-context-j4-LLPEh.js.map +1 -0
- package/dist/engine-context.d.ts +9 -6
- package/dist/engine-context.d.ts.map +1 -1
- package/dist/file-browser/store.d.ts +5 -0
- package/dist/file-browser/store.d.ts.map +1 -1
- package/dist/form/checkbox.d.ts +1 -1
- package/dist/form/fieldset.d.ts +1 -1
- package/dist/form/number-field.d.ts +1 -1
- package/dist/form/radio-group.d.ts +1 -1
- package/dist/form/select-field.d.ts +1 -1
- package/dist/form/text-area.d.ts +1 -1
- package/dist/form/text-field.d.ts +1 -1
- package/dist/root-error-boundary.d.ts +1 -1
- package/dist/testing/render-with-engine.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui.js +20 -10
- package/dist/ui.js.map +1 -1
- package/package.json +11 -11
- package/dist/editable-area-view-DssYcTqQ.js.map +0 -1
- package/dist/engine-context-gX6mWHke.js.map +0 -1
package/dist/engine-context.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { ReactNode } from 'react';
|
|
|
5
5
|
* rendered under a `BurgerEditorRoot` / editable-area tree reads the engine
|
|
6
6
|
* through {@link useEngine} instead of taking it as a prop — this is the
|
|
7
7
|
* single dependency-injection point for the whole client UI.
|
|
8
|
-
* @param root0
|
|
9
|
-
* @param root0.engine
|
|
10
|
-
* @param root0.children
|
|
8
|
+
* @param root0 - Provider props
|
|
9
|
+
* @param root0.engine - The engine instance to expose to the subtree
|
|
10
|
+
* @param root0.children - The subtree that reads the engine
|
|
11
11
|
* @example
|
|
12
12
|
* ```tsx
|
|
13
13
|
* <EngineProvider engine={engine}>
|
|
@@ -30,9 +30,12 @@ export declare function EngineProvider({ engine, children, }: {
|
|
|
30
30
|
* @throws {Error} When called outside an `EngineProvider`
|
|
31
31
|
* @example
|
|
32
32
|
* ```tsx
|
|
33
|
-
* function
|
|
34
|
-
* const
|
|
35
|
-
*
|
|
33
|
+
* function SamplePreview() {
|
|
34
|
+
* const { config } = useEngine();
|
|
35
|
+
* if (!config.sampleImagePath) {
|
|
36
|
+
* return null;
|
|
37
|
+
* }
|
|
38
|
+
* return <img src={config.sampleImagePath} alt="" />;
|
|
36
39
|
* }
|
|
37
40
|
* ```
|
|
38
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context.d.ts","sourceRoot":"","sources":["../src/engine-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC9B,MAAM,EACN,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,sGAEA;AAED
|
|
1
|
+
{"version":3,"file":"engine-context.d.ts","sourceRoot":"","sources":["../src/engine-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC9B,MAAM,EACN,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,sGAEA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|
|
@@ -108,6 +108,11 @@ export declare class FileBrowserStore {
|
|
|
108
108
|
* `Preview` can both show it) and selecting the resulting URL once the
|
|
109
109
|
* server responds — a blob URL is selected immediately so the UI has
|
|
110
110
|
* something to show while the upload is in flight.
|
|
111
|
+
*
|
|
112
|
+
* The blob URL is revoked once the upload settles. On failure the
|
|
113
|
+
* selection is restored to what it was before the upload (empty path if
|
|
114
|
+
* nothing was selected), so a revoked blob URL is never left selected
|
|
115
|
+
* for the dialog to confirm.
|
|
111
116
|
* @param fileType - The file type to upload into
|
|
112
117
|
* @param file - The file to upload
|
|
113
118
|
* @throws {Error} When no `postFile` API is configured, or the server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/file-browser/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,cAAc,EAC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AO,gBAAgB,CAAgB;IAE3D,QAAQ,CAAC,SAAS,GAAI,UAAU,QAAQ,KAAG,CAAC,MAAM,IAAI,CAAC,CAKrD;IAYF,gEAAgE;IAChE,IAAI,SAAS,IAAI,OAAO,CAEvB;gBAEW,MAAM,EAAE,kBAAkB;IAItC;;;;;;OAMG;IACG,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAUpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BtD;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,IAAI;IAU5D;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAkD3D;AAID;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAOhF"}
|
package/dist/form/checkbox.d.ts
CHANGED
|
@@ -30,5 +30,5 @@ export declare function Checkbox({ label, checked, onChange, name, disabled, des
|
|
|
30
30
|
readonly name?: string;
|
|
31
31
|
readonly disabled?: boolean;
|
|
32
32
|
readonly describedBy?: string;
|
|
33
|
-
}): import(
|
|
33
|
+
}): import('react').JSX.Element;
|
|
34
34
|
//# sourceMappingURL=checkbox.d.ts.map
|
package/dist/form/fieldset.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export declare function Fieldset({ legend, id, disabled, children, }: {
|
|
|
27
27
|
readonly id?: string;
|
|
28
28
|
readonly disabled?: boolean;
|
|
29
29
|
readonly children: ReactNode;
|
|
30
|
-
}): import(
|
|
30
|
+
}): import('react').JSX.Element;
|
|
31
31
|
//# sourceMappingURL=fieldset.d.ts.map
|
|
@@ -33,5 +33,5 @@ export declare function NumberField({ label, value, onChange, name, min, max, st
|
|
|
33
33
|
readonly max?: number;
|
|
34
34
|
readonly step?: number;
|
|
35
35
|
readonly disabled?: boolean;
|
|
36
|
-
}): import(
|
|
36
|
+
}): import('react').JSX.Element;
|
|
37
37
|
//# sourceMappingURL=number-field.d.ts.map
|
|
@@ -34,5 +34,5 @@ export declare function RadioGroup({ label, value, onChange, options, name, disa
|
|
|
34
34
|
readonly options: readonly SelectableValue[];
|
|
35
35
|
readonly name?: string;
|
|
36
36
|
readonly disabled?: boolean;
|
|
37
|
-
}): import(
|
|
37
|
+
}): import('react').JSX.Element;
|
|
38
38
|
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -34,5 +34,5 @@ export declare function SelectField({ label, value, onChange, options, name, dis
|
|
|
34
34
|
readonly options: readonly SelectableValue[];
|
|
35
35
|
readonly name?: string;
|
|
36
36
|
readonly disabled?: boolean;
|
|
37
|
-
}): import(
|
|
37
|
+
}): import('react').JSX.Element;
|
|
38
38
|
//# sourceMappingURL=select-field.d.ts.map
|
package/dist/form/text-area.d.ts
CHANGED
|
@@ -29,5 +29,5 @@ export declare function TextArea({ label, value, onChange, name, rows, disabled,
|
|
|
29
29
|
readonly name?: string;
|
|
30
30
|
readonly rows?: number;
|
|
31
31
|
readonly disabled?: boolean;
|
|
32
|
-
}): import(
|
|
32
|
+
}): import('react').JSX.Element;
|
|
33
33
|
//# sourceMappingURL=text-area.d.ts.map
|
|
@@ -33,5 +33,5 @@ export declare function TextField({ label, value, onChange, type, name, disabled
|
|
|
33
33
|
readonly disabled?: boolean;
|
|
34
34
|
readonly placeholder?: string;
|
|
35
35
|
readonly describedBy?: string;
|
|
36
|
-
}): import(
|
|
36
|
+
}): import('react').JSX.Element;
|
|
37
37
|
//# sourceMappingURL=text-field.d.ts.map
|
|
@@ -30,5 +30,5 @@ export declare function reportRenderError(engine: BurgerEditorEngine, error: unk
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function RootErrorBoundary({ children }: {
|
|
32
32
|
readonly children: ReactNode;
|
|
33
|
-
}): import(
|
|
33
|
+
}): import('react').JSX.Element;
|
|
34
34
|
//# sourceMappingURL=root-error-boundary.d.ts.map
|
|
@@ -16,5 +16,5 @@ import { ReactElement } from 'react';
|
|
|
16
16
|
* renderWithEngine(engine, <FileList fileType="image" />);
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function renderWithEngine(engine: BurgerEditorEngine, ui: ReactElement, options?: RenderOptions): import('@testing-library/react').RenderResult<typeof import(
|
|
19
|
+
export declare function renderWithEngine(engine: BurgerEditorEngine, ui: ReactElement, options?: RenderOptions): import('@testing-library/react').RenderResult<typeof import('@testing-library/dom/types/queries.js'), HTMLElement, HTMLElement>;
|
|
20
20
|
//# sourceMappingURL=render-with-engine.d.ts.map
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UIStateStore, c as CommandBus, t as EngineProvider } from "./engine-context-
|
|
1
|
+
import { a as UIStateStore, c as CommandBus, t as EngineProvider } from "./engine-context-j4-LLPEh.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { render } from "@testing-library/react";
|
|
4
4
|
import { afterEach, beforeEach, vi } from "vitest";
|
package/dist/ui.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as formatDate, n as useEngine, t as EngineProvider, u as formatByteSize } from "./engine-context-
|
|
2
|
-
import { _ as IconTrash, a as BlockMenuButton, c as reportRenderError, d as registerEngineCommands, f as useUIState, g as BlockCatalog, h as BlockOptions, i as BlockMenuView, l as reactMount, m as EditorDialog, n as InitialInsertionButton, o as useCommand, p as ItemEditorHost, r as BlockMenu, s as RootErrorBoundary, t as EditableAreaView, u as DraftSwitcher, v as IconRowInsertBottom, y as createReactComponent } from "./editable-area-view-
|
|
1
|
+
import { d as formatDate, n as useEngine, t as EngineProvider, u as formatByteSize } from "./engine-context-j4-LLPEh.js";
|
|
2
|
+
import { _ as IconTrash, a as BlockMenuButton, c as reportRenderError, d as registerEngineCommands, f as useUIState, g as BlockCatalog, h as BlockOptions, i as BlockMenuView, l as reactMount, m as EditorDialog, n as InitialInsertionButton, o as useCommand, p as ItemEditorHost, r as BlockMenu, s as RootErrorBoundary, t as EditableAreaView, u as DraftSwitcher, v as IconRowInsertBottom, y as createReactComponent } from "./editable-area-view-BRYT222Y.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { Fragment, use, useDeferredValue, useEffect, useEffectEvent, useId, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createRoot } from "react-dom/client";
|
|
7
7
|
/**
|
|
8
|
-
* @license @tabler/icons-react v3.
|
|
8
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license.
|
|
11
11
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -37,7 +37,7 @@ var IconArrowsTransferDown = createReactComponent("outline", "arrows-transfer-do
|
|
|
37
37
|
}]
|
|
38
38
|
]);
|
|
39
39
|
/**
|
|
40
|
-
* @license @tabler/icons-react v3.
|
|
40
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license.
|
|
43
43
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -65,7 +65,7 @@ var IconFileTypeDoc = createReactComponent("outline", "file-type-doc", "FileType
|
|
|
65
65
|
}]
|
|
66
66
|
]);
|
|
67
67
|
/**
|
|
68
|
-
* @license @tabler/icons-react v3.
|
|
68
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
69
69
|
*
|
|
70
70
|
* This source code is licensed under the MIT license.
|
|
71
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -97,7 +97,7 @@ var IconFileTypePdf = createReactComponent("outline", "file-type-pdf", "FileType
|
|
|
97
97
|
}]
|
|
98
98
|
]);
|
|
99
99
|
/**
|
|
100
|
-
* @license @tabler/icons-react v3.
|
|
100
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
101
101
|
*
|
|
102
102
|
* This source code is licensed under the MIT license.
|
|
103
103
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -133,7 +133,7 @@ var IconFileTypePpt = createReactComponent("outline", "file-type-ppt", "FileType
|
|
|
133
133
|
}]
|
|
134
134
|
]);
|
|
135
135
|
/**
|
|
136
|
-
* @license @tabler/icons-react v3.
|
|
136
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
137
137
|
*
|
|
138
138
|
* This source code is licensed under the MIT license.
|
|
139
139
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -165,7 +165,7 @@ var IconFileTypeXls = createReactComponent("outline", "file-type-xls", "FileType
|
|
|
165
165
|
}]
|
|
166
166
|
]);
|
|
167
167
|
/**
|
|
168
|
-
* @license @tabler/icons-react v3.
|
|
168
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
169
169
|
*
|
|
170
170
|
* This source code is licensed under the MIT license.
|
|
171
171
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -178,7 +178,7 @@ var IconFile = createReactComponent("outline", "file", "File", [["path", {
|
|
|
178
178
|
"key": "svg-1"
|
|
179
179
|
}]]);
|
|
180
180
|
/**
|
|
181
|
-
* @license @tabler/icons-react v3.
|
|
181
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
182
182
|
*
|
|
183
183
|
* This source code is licensed under the MIT license.
|
|
184
184
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -198,7 +198,7 @@ var IconHeadphones = createReactComponent("outline", "headphones", "Headphones",
|
|
|
198
198
|
}]
|
|
199
199
|
]);
|
|
200
200
|
/**
|
|
201
|
-
* @license @tabler/icons-react v3.
|
|
201
|
+
* @license @tabler/icons-react v3.48.0 - MIT
|
|
202
202
|
*
|
|
203
203
|
* This source code is licensed under the MIT license.
|
|
204
204
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -380,6 +380,11 @@ var FileBrowserStore = class {
|
|
|
380
380
|
* `Preview` can both show it) and selecting the resulting URL once the
|
|
381
381
|
* server responds — a blob URL is selected immediately so the UI has
|
|
382
382
|
* something to show while the upload is in flight.
|
|
383
|
+
*
|
|
384
|
+
* The blob URL is revoked once the upload settles. On failure the
|
|
385
|
+
* selection is restored to what it was before the upload (empty path if
|
|
386
|
+
* nothing was selected), so a revoked blob URL is never left selected
|
|
387
|
+
* for the dialog to confirm.
|
|
383
388
|
* @param fileType - The file type to upload into
|
|
384
389
|
* @param file - The file to upload
|
|
385
390
|
* @throws {Error} When no `postFile` API is configured, or the server
|
|
@@ -388,6 +393,7 @@ var FileBrowserStore = class {
|
|
|
388
393
|
async upload(fileType, file) {
|
|
389
394
|
const postFile = this.#engine.serverAPI.postFile;
|
|
390
395
|
const blob = URL.createObjectURL(file);
|
|
396
|
+
const previous = this.#state.selected[fileType];
|
|
391
397
|
this.select(fileType, blob, file.size);
|
|
392
398
|
this.#patch({ uploads: [...this.#state.uploads, {
|
|
393
399
|
fileType,
|
|
@@ -407,8 +413,12 @@ var FileBrowserStore = class {
|
|
|
407
413
|
if (res.error) throw new Error(`Failed to upload file: ${file.name}`);
|
|
408
414
|
this.invalidate(fileType);
|
|
409
415
|
this.select(fileType, res.uploaded.url, res.uploaded.size);
|
|
416
|
+
} catch (error) {
|
|
417
|
+
this.select(fileType, previous?.path ?? "", previous?.fileSize);
|
|
418
|
+
throw error;
|
|
410
419
|
} finally {
|
|
411
420
|
this.#patch({ uploads: this.#state.uploads.filter((u) => u.blob !== blob) });
|
|
421
|
+
URL.revokeObjectURL(blob);
|
|
412
422
|
}
|
|
413
423
|
}
|
|
414
424
|
#emit() {
|