@burger-editor/client 4.0.0-alpha.71 → 4.0.0-alpha.73
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/README.md +22 -9
- package/dist/__tests__/setup.d.ts +2 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/burger-editor-root.d.ts +3 -7
- package/dist/burger-editor-root.d.ts.map +1 -1
- package/dist/client.css +1 -0
- package/dist/client.js +24180 -29905
- package/dist/client.js.map +1 -1
- package/dist/commands/register-engine-commands.d.ts +2 -1
- package/dist/commands/register-engine-commands.d.ts.map +1 -1
- package/dist/components/block-catalog.d.ts +3 -5
- package/dist/components/block-catalog.d.ts.map +1 -1
- package/dist/components/block-menu-button.d.ts +1 -1
- package/dist/components/block-menu-view.d.ts +82 -0
- package/dist/components/block-menu-view.d.ts.map +1 -0
- package/dist/components/block-menu.d.ts +7 -5
- package/dist/components/block-menu.d.ts.map +1 -1
- package/dist/components/block-options.d.ts +4 -6
- package/dist/components/block-options.d.ts.map +1 -1
- package/dist/components/draft-switcher.d.ts +11 -10
- package/dist/components/draft-switcher.d.ts.map +1 -1
- package/dist/components/editable-area-view.d.ts +11 -14
- package/dist/components/editable-area-view.d.ts.map +1 -1
- package/dist/components/file-list.d.ts +9 -9
- package/dist/components/file-list.d.ts.map +1 -1
- package/dist/components/file-uploader.d.ts +6 -6
- package/dist/components/file-uploader.d.ts.map +1 -1
- package/dist/components/front-matter-editor.d.ts +104 -0
- package/dist/components/front-matter-editor.d.ts.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/initial-insertion-button.d.ts +7 -2
- package/dist/components/initial-insertion-button.d.ts.map +1 -1
- package/dist/components/item-editor-host.d.ts +7 -6
- package/dist/components/item-editor-host.d.ts.map +1 -1
- package/dist/components/preview.d.ts +4 -7
- package/dist/components/preview.d.ts.map +1 -1
- package/dist/components/table-editor.d.ts.map +1 -1
- package/dist/components/wysiwyg-field.d.ts +11 -1
- package/dist/components/wysiwyg-field.d.ts.map +1 -1
- package/dist/editable-area-view-DssYcTqQ.js +2941 -0
- package/dist/editable-area-view-DssYcTqQ.js.map +1 -0
- package/dist/editor-dialog.d.ts +16 -7
- package/dist/editor-dialog.d.ts.map +1 -1
- package/dist/engine-context-gX6mWHke.js +15758 -0
- package/dist/engine-context-gX6mWHke.js.map +1 -0
- package/dist/engine-context.d.ts +40 -0
- package/dist/engine-context.d.ts.map +1 -0
- package/dist/file-browser/store.d.ts +127 -0
- package/dist/file-browser/store.d.ts.map +1 -0
- package/dist/file-browser/use-external-file-selection.d.ts +39 -0
- package/dist/file-browser/use-external-file-selection.d.ts.map +1 -0
- package/dist/file-browser/use-file-browser.d.ts +17 -0
- package/dist/file-browser/use-file-browser.d.ts.map +1 -0
- package/dist/form/text-field.d.ts +3 -1
- package/dist/form/text-field.d.ts.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/mount.d.ts +14 -8
- package/dist/mount.d.ts.map +1 -1
- package/dist/root-error-boundary.d.ts +34 -0
- package/dist/root-error-boundary.d.ts.map +1 -0
- package/dist/testing/create-mock-engine.d.ts +30 -0
- package/dist/testing/create-mock-engine.d.ts.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/render-with-engine.d.ts +20 -0
- package/dist/testing/render-with-engine.d.ts.map +1 -0
- package/dist/testing/suppress-console-error.d.ts +24 -0
- package/dist/testing/suppress-console-error.d.ts.map +1 -0
- package/dist/testing.js +119 -0
- package/dist/testing.js.map +1 -0
- package/dist/ui.d.ts +7 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +2680 -956
- package/dist/ui.js.map +1 -1
- package/dist/use-command.d.ts +13 -4
- package/dist/use-command.d.ts.map +1 -1
- package/dist/use-engine.d.ts +16 -32
- package/dist/use-engine.d.ts.map +1 -1
- package/dist/use-mount-effect.d.ts +20 -0
- package/dist/use-mount-effect.d.ts.map +1 -0
- package/dist/view/create-react-view.d.ts +33 -9
- package/dist/view/create-react-view.d.ts.map +1 -1
- package/package.json +44 -17
- package/dist/initial-insertion-button-DMGBvuDE.js +0 -9147
- package/dist/initial-insertion-button-DMGBvuDE.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../src/use-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../src/use-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIzC,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACvE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAC/C,QAAQ,EAAE,eAAe,GACvB,WAAW,CAAC,CAAC,CAAC,CAoBhB"}
|
package/dist/use-engine.d.ts
CHANGED
|
@@ -1,53 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIState } from '@burger-editor/core';
|
|
2
2
|
/**
|
|
3
3
|
* Subscribe to the engine's UI state store.
|
|
4
4
|
*
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Wraps `useSyncExternalStoreWithSelector` so call sites don't repeat the
|
|
6
|
+
* subscribe/getSnapshot/selector wiring. `engine.uiState.subscribe` and
|
|
7
|
+
* `.getSnapshot` are stable per-instance methods (see `UIStateStore`), so
|
|
8
|
+
* passing them directly — instead of a new inline closure each render —
|
|
9
|
+
* means React doesn't unsubscribe and resubscribe on every render. The
|
|
10
|
+
* engine is read from the nearest `EngineProvider`.
|
|
9
11
|
* @returns The current UI state snapshot
|
|
10
12
|
* @example
|
|
11
13
|
* ```tsx
|
|
12
|
-
* const { openDialog } = useUIState(
|
|
13
|
-
* return <ItemEditorHost
|
|
14
|
+
* const { openDialog } = useUIState();
|
|
15
|
+
* return <ItemEditorHost item={openDialog?.type === 'item-editor' ? openDialog.item : null} />;
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
16
|
-
export declare function useUIState(
|
|
18
|
+
export declare function useUIState(): UIState;
|
|
17
19
|
/**
|
|
18
20
|
* Subscribe to a projection of the engine's UI state store.
|
|
19
21
|
*
|
|
20
22
|
* 選択的な状態(`processing` や `sourceMode[type]` など)だけを読む
|
|
21
23
|
* コンポーネントは、`selector` でそのフィールドだけを取り出すと無関係な
|
|
22
|
-
* 状態変化(例:
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* 無限レンダーを引き起こす。
|
|
27
|
-
* @param engine - The engine instance
|
|
24
|
+
* 状態変化(例: ダイアログの開閉)での再レンダーを避けられる —
|
|
25
|
+
* `useSyncExternalStoreWithSelector` が選択後の値を `Object.is` で比較し、
|
|
26
|
+
* 変化がなければ再レンダーをスキップする(selector 自体は毎レンダー
|
|
27
|
+
* 新しい関数でよい。比較されるのは戻り値であって関数の同一性ではない)。
|
|
28
28
|
* @param selector - Projection of the snapshot
|
|
29
29
|
* @returns The selected value
|
|
30
30
|
* @example
|
|
31
31
|
* ```tsx
|
|
32
32
|
* // 無関係な状態変化での再レンダーを避ける
|
|
33
|
-
* const processing = useUIState(
|
|
33
|
+
* const processing = useUIState((s) => s.processing);
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export declare function useUIState<T>(
|
|
37
|
-
/**
|
|
38
|
-
* Subscribe to a component observer action for the lifetime of the
|
|
39
|
-
* component. The handler always sees the latest render's closure.
|
|
40
|
-
* @param engine - The engine instance
|
|
41
|
-
* @param action - The action name to listen for
|
|
42
|
-
* @param handler - Callback receiving the typed payload
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* useComponentEvent(engine, 'file-select', ({ path, isEmpty }) => {
|
|
46
|
-
* if (!isEmpty) {
|
|
47
|
-
* setState((prev) => ({ ...prev, path }));
|
|
48
|
-
* }
|
|
49
|
-
* });
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare function useComponentEvent<A extends keyof Actions>(engine: BurgerEditorEngine, action: A, handler: (payload: Actions[A]) => void): void;
|
|
36
|
+
export declare function useUIState<T>(selector: (state: UIState) => T): T;
|
|
53
37
|
//# sourceMappingURL=use-engine.d.ts.map
|
package/dist/use-engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-engine.d.ts","sourceRoot":"","sources":["../src/use-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-engine.d.ts","sourceRoot":"","sources":["../src/use-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAQnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAAC;AACtC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `fn` exactly once, when the component mounts, always reading `fn`'s
|
|
3
|
+
* latest closure (via `useEffectEvent`) rather than the one captured at
|
|
4
|
+
* mount time.
|
|
5
|
+
*
|
|
6
|
+
* Exists so a mount-only effect can honestly declare `useEffect(fn, [])`
|
|
7
|
+
* without an `eslint-disable-next-line react-hooks/exhaustive-deps` — that
|
|
8
|
+
* suppression is also a React Compiler bailout condition for the whole
|
|
9
|
+
* component containing it (see ARCHITECTURE.md's negative-knowledge note
|
|
10
|
+
* on React Compiler).
|
|
11
|
+
* @param fn - Called once on mount
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* useMountEffect(() => {
|
|
15
|
+
* fileBrowser.select(fileType, state.path ?? '', size);
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function useMountEffect(fn: () => void): void;
|
|
20
|
+
//# sourceMappingURL=use-mount-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mount-effect.d.ts","sourceRoot":"","sources":["../src/use-mount-effect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAKnD"}
|
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import { BurgerEditorView } from '@burger-editor/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A `ReactView` extends the core {@link BurgerEditorView} contract with a
|
|
5
|
+
* client-only escape hatch: `mountChrome` lets `createBurgerEditorClient`
|
|
6
|
+
* render the dialog chrome into the *same* React root the editable areas
|
|
7
|
+
* use, once the engine has finished constructing. `core` never sees this
|
|
8
|
+
* method — it only calls `createAreaHost` through the narrower
|
|
9
|
+
* `BurgerEditorView` type.
|
|
10
|
+
*/
|
|
11
|
+
export interface ReactView extends BurgerEditorView {
|
|
12
|
+
/**
|
|
13
|
+
* Render additional UI (currently: `BurgerEditorRoot`, the dialog
|
|
14
|
+
* chrome) into the single root this view owns. Replaces whatever was
|
|
15
|
+
* mounted by a previous call.
|
|
16
|
+
* @param node - The chrome to render
|
|
17
|
+
*/
|
|
18
|
+
mountChrome(node: ReactNode): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The React implementation of the engine's view port.
|
|
22
|
+
*
|
|
23
|
+
* Unlike the pre-single-root design (one `createRoot` per editable area
|
|
24
|
+
* plus a separate dialog-host root), this view owns exactly **one** React
|
|
25
|
+
* root per engine. Editable areas are portaled into their own `<div>`
|
|
26
|
+
* (still a direct child of `engine.viewArea`, preserving the DOM contract
|
|
27
|
+
* `viewAreaClassList` consumers rely on) so each area keeps its own
|
|
28
|
+
* subtree identity; the dialog chrome renders inline. Sharing one root
|
|
29
|
+
* means `EngineProvider` only needs to wrap the tree once, and every
|
|
30
|
+
* component below it — areas, block menu, dialogs — reads the engine via
|
|
31
|
+
* `useEngine()` instead of taking it as a prop.
|
|
7
32
|
* @returns The view to pass to `BurgerEditorEngine.new`
|
|
8
33
|
* @example
|
|
9
34
|
* ```ts
|
|
10
|
-
* const
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* });
|
|
35
|
+
* const view = createReactView();
|
|
36
|
+
* const engine = await BurgerEditorEngine.new({ ...options, view });
|
|
37
|
+
* view.mountChrome(<EngineProvider engine={engine}><BurgerEditorRoot /></EngineProvider>);
|
|
14
38
|
* ```
|
|
15
39
|
*/
|
|
16
|
-
export declare function createReactView():
|
|
40
|
+
export declare function createReactView(): ReactView;
|
|
17
41
|
//# sourceMappingURL=create-react-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-react-view.d.ts","sourceRoot":"","sources":["../../src/view/create-react-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"create-react-view.d.ts","sourceRoot":"","sources":["../../src/view/create-react-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,gBAAgB,EAIhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC;;;;;;;GAOG;AACH,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAClD;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;CACnC;AAaD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAgG3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burger-editor/client",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.73",
|
|
4
4
|
"description": "BurgerEditor client package",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "(MIT OR Apache-2.0)",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"import": "./dist/ui.js",
|
|
23
23
|
"types": "./dist/ui.d.ts"
|
|
24
24
|
},
|
|
25
|
+
"./testing": {
|
|
26
|
+
"import": "./dist/testing.js",
|
|
27
|
+
"types": "./dist/testing/index.d.ts"
|
|
28
|
+
},
|
|
25
29
|
"./style": {
|
|
26
30
|
"import": "./dist/client.css"
|
|
27
31
|
}
|
|
@@ -36,26 +40,49 @@
|
|
|
36
40
|
"dev": "vite build --watch"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@burger-editor/core": "4.0.0-alpha.
|
|
40
|
-
"@burger-editor/custom-element": "4.0.0-alpha.
|
|
41
|
-
"@burger-editor/migrator": "4.0.0-alpha.
|
|
42
|
-
"@burger-editor/utils": "4.0.0-alpha.
|
|
43
|
-
"@tabler/icons-react": "3.
|
|
43
|
+
"@burger-editor/core": "4.0.0-alpha.73",
|
|
44
|
+
"@burger-editor/custom-element": "4.0.0-alpha.73",
|
|
45
|
+
"@burger-editor/migrator": "4.0.0-alpha.73",
|
|
46
|
+
"@burger-editor/utils": "4.0.0-alpha.73",
|
|
47
|
+
"@tabler/icons-react": "3.46.0",
|
|
48
|
+
"react-error-boundary": "6.1.5",
|
|
49
|
+
"use-sync-external-store": "1.7.0"
|
|
44
50
|
},
|
|
45
51
|
"devDependencies": {
|
|
52
|
+
"@babel/core": "7.29.7",
|
|
53
|
+
"@babel/preset-typescript": "7.29.7",
|
|
54
|
+
"@rolldown/plugin-babel": "0.2.4",
|
|
46
55
|
"@testing-library/dom": "10.4.1",
|
|
47
|
-
"@testing-library/react": "16.3.
|
|
48
|
-
"@types/
|
|
49
|
-
"@types/react
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
52
|
-
"react
|
|
53
|
-
"
|
|
54
|
-
"
|
|
56
|
+
"@testing-library/react": "16.3.3",
|
|
57
|
+
"@types/babel__core": "7.20.5",
|
|
58
|
+
"@types/react": "19.3.0",
|
|
59
|
+
"@types/react-dom": "19.3.0",
|
|
60
|
+
"@types/use-sync-external-store": "1.7.0",
|
|
61
|
+
"@vitejs/plugin-react": "6.1.1",
|
|
62
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
63
|
+
"react": "19.3.0",
|
|
64
|
+
"react-dom": "19.3.0",
|
|
65
|
+
"vite": "8.3.0",
|
|
66
|
+
"vite-plugin-dts": "5.1.0",
|
|
67
|
+
"vitest": "4.1.11"
|
|
55
68
|
},
|
|
56
69
|
"peerDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"react
|
|
70
|
+
"@testing-library/dom": "10.4.1",
|
|
71
|
+
"@testing-library/react": "16.3.3",
|
|
72
|
+
"react": "19.3.0",
|
|
73
|
+
"react-dom": "19.3.0",
|
|
74
|
+
"vitest": "4.1.11"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"@testing-library/dom": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@testing-library/react": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"vitest": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
59
86
|
},
|
|
60
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "5258cd0a8bbfa28eb92b4f486148ee976644f2de"
|
|
61
88
|
}
|