@bloklabs/vue 1.16.0 → 2.0.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/README.md +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +146 -104
- package/package.json +3 -4
- package/types/index.d.ts +57 -3
- package/src/BlockPortalHost.ts +0 -46
- package/src/BlokContent.ts +0 -103
- package/src/BlokEditor.ts +0 -326
- package/src/block-portal-registry.ts +0 -93
- package/src/blocks-snapshot.ts +0 -17
- package/src/blok-instance.ts +0 -40
- package/src/config-keys.ts +0 -82
- package/src/content-baseline-map.ts +0 -38
- package/src/createVueBlock.ts +0 -740
- package/src/holder-map.ts +0 -19
- package/src/index.ts +0 -30
- package/src/provide-blok.ts +0 -65
- package/src/registry-map.ts +0 -21
- package/src/types.ts +0 -36
- package/src/useBlocks.ts +0 -182
- package/src/useBlok.ts +0 -686
- package/src/useBlokReady.ts +0 -70
package/src/config-keys.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prop keys that `<BlokEditor>` copies straight into the Blok config (the plain
|
|
3
|
-
* seed/reactive options plus the two return-valued transform hooks). The
|
|
4
|
-
* emit-mapped callbacks — `onReady`/`onChange`/`onSave`/`onAfterRender` — are NOT
|
|
5
|
-
* here: they are derived from Vue emits, gated on listener presence.
|
|
6
|
-
*
|
|
7
|
-
* Any prop on `<BlokEditor>` whose key is NOT a declared prop falls through to
|
|
8
|
-
* the container div via `$attrs` (Vue removes declared props from `$attrs`
|
|
9
|
-
* automatically — the analog of React's manual config/div partition).
|
|
10
|
-
*
|
|
11
|
-
* The compile-time guard in this file (step 14) keeps this list in sync with the
|
|
12
|
-
* adapter's public config surface.
|
|
13
|
-
*/
|
|
14
|
-
import type { UseBlokConfig } from './types';
|
|
15
|
-
|
|
16
|
-
export const BLOK_EDITOR_CONFIG_KEYS = [
|
|
17
|
-
'autofocus',
|
|
18
|
-
'defaultBlock',
|
|
19
|
-
'dataModel',
|
|
20
|
-
'placeholder',
|
|
21
|
-
'sanitizer',
|
|
22
|
-
'hideToolbar',
|
|
23
|
-
'toolbarPosition',
|
|
24
|
-
'maxHistoryLength',
|
|
25
|
-
'historyDebounceTime',
|
|
26
|
-
'newGroupDelay',
|
|
27
|
-
'globalUndoRedo',
|
|
28
|
-
'tools',
|
|
29
|
-
'data',
|
|
30
|
-
'minHeight',
|
|
31
|
-
'loader',
|
|
32
|
-
'logLevel',
|
|
33
|
-
'readOnly',
|
|
34
|
-
'i18n',
|
|
35
|
-
'link',
|
|
36
|
-
'linkPaste',
|
|
37
|
-
'inlineToolbar',
|
|
38
|
-
'inlineEmoji',
|
|
39
|
-
'find',
|
|
40
|
-
'tunes',
|
|
41
|
-
'style',
|
|
42
|
-
'theme',
|
|
43
|
-
'scrollToBlock',
|
|
44
|
-
'user',
|
|
45
|
-
'resolveUser',
|
|
46
|
-
'notifierPosition',
|
|
47
|
-
'notifier',
|
|
48
|
-
'width',
|
|
49
|
-
'onBeforeRender',
|
|
50
|
-
'onBeforePaste',
|
|
51
|
-
'onEnter',
|
|
52
|
-
'onSubmit',
|
|
53
|
-
'onError',
|
|
54
|
-
'onImageFailure',
|
|
55
|
-
'migrations',
|
|
56
|
-
'uploader',
|
|
57
|
-
'media',
|
|
58
|
-
'server',
|
|
59
|
-
'ticket',
|
|
60
|
-
'persistence',
|
|
61
|
-
'collaboration',
|
|
62
|
-
'documentId',
|
|
63
|
-
'tabSync',
|
|
64
|
-
'captureClicksBelowEditor',
|
|
65
|
-
] as const satisfies readonly (keyof UseBlokConfig)[];
|
|
66
|
-
|
|
67
|
-
export type BlokEditorConfigKey = (typeof BLOK_EDITOR_CONFIG_KEYS)[number];
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Config callbacks that `<BlokEditor>` surfaces as Vue emits (gated on listener
|
|
71
|
-
* presence) instead of declared props.
|
|
72
|
-
*/
|
|
73
|
-
export type EmitMappedConfigKey = 'onReady' | 'onChange' | 'onSave' | 'onAfterRender' | 'onThemeChange';
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Compile-time exhaustiveness guard: every `UseBlokConfig` key must be either a
|
|
77
|
-
* declared `<BlokEditor>` prop (`BLOK_EDITOR_CONFIG_KEYS`) or emit-mapped. If a
|
|
78
|
-
* new `BlokConfig` key is added and not handled here, `_uncovered` reds under
|
|
79
|
-
* `tsc`, forcing the adapter (and `types/vue.d.ts`) to keep pace.
|
|
80
|
-
*/
|
|
81
|
-
type _UncoveredConfigKey = Exclude<keyof UseBlokConfig, BlokEditorConfigKey | EmitMappedConfigKey>;
|
|
82
|
-
const _uncovered: _UncoveredConfigKey extends never ? true : never = true;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { LooseOutputData, OutputData } from '@/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The controlled-content bookkeeping `useBlok` keeps for one editor: the
|
|
5
|
-
* baseline it believes the editor currently reflects.
|
|
6
|
-
*
|
|
7
|
-
* The reactive `data` watcher dedupes against that baseline, which is only sound
|
|
8
|
-
* while the watcher is the ONLY thing changing the content. `<BlokEditor>`'s
|
|
9
|
-
* exposed `render()` moves the editor out from under it: without this channel
|
|
10
|
-
* the baseline still names the document shown BEFORE the imperative call, so
|
|
11
|
-
* setting `data` back to that document is dismissed as an unchanged value and
|
|
12
|
-
* the editor keeps showing whatever `render()` installed.
|
|
13
|
-
*
|
|
14
|
-
* Registered per instance (mirrors the holder / portal-registry WeakMaps) so the
|
|
15
|
-
* exposed facade can reach it from the editor alone — `useBlok` returns only the
|
|
16
|
-
* instance ref, never its internal state.
|
|
17
|
-
*/
|
|
18
|
-
export interface ContentBaseline {
|
|
19
|
-
/**
|
|
20
|
-
* Record `content` as the document the editor now reflects.
|
|
21
|
-
* @param content - the document the editor now reflects
|
|
22
|
-
*/
|
|
23
|
-
markRendered(content: OutputData | LooseOutputData | null): void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const baselines = new WeakMap<WeakKey, ContentBaseline>();
|
|
27
|
-
|
|
28
|
-
export function setContentBaseline(editor: WeakKey, baseline: ContentBaseline): void {
|
|
29
|
-
baselines.set(editor, baseline);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getContentBaseline(editor: WeakKey): ContentBaseline | undefined {
|
|
33
|
-
return baselines.get(editor);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function removeContentBaseline(editor: WeakKey): void {
|
|
37
|
-
baselines.delete(editor);
|
|
38
|
-
}
|