@webx-ui/module-blocks 0.7.1 → 0.8.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/dist/BlocksTree.d.ts +1 -1
- package/dist/completions.d.ts +58 -0
- package/dist/frame.d.ts +10 -4
- package/dist/index.js +1925 -1590
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -4
package/dist/BlocksTree.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
32
32
|
}>, {
|
|
33
33
|
disabled: boolean;
|
|
34
34
|
field: string | null;
|
|
35
|
+
depth: number;
|
|
35
36
|
selected: string | null;
|
|
36
37
|
parentKey: string | null;
|
|
37
|
-
depth: number;
|
|
38
38
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
39
39
|
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CompletionSource } from '@codemirror/autocomplete';
|
|
2
|
+
import { Extension } from '@codemirror/state';
|
|
3
|
+
import { ScreenNode, TypeRegistry } from '@webx-ui/schema';
|
|
4
|
+
/**
|
|
5
|
+
* What the editor of a block type offers as you type, one source per file. Each reads the
|
|
6
|
+
* other files of the same type — the template's fields come from the schema, its classes from
|
|
7
|
+
* the styles, the styles' classes from the template — so the sources take getters, not
|
|
8
|
+
* values: the editor is built once and the files change under it.
|
|
9
|
+
*
|
|
10
|
+
* Registered as language data rather than as an `override`, so that what the language
|
|
11
|
+
* already offers (CSS properties, HTML tags) stays in the list beside ours.
|
|
12
|
+
*/
|
|
13
|
+
export declare function completions(source: CompletionSource): Extension;
|
|
14
|
+
export interface TemplateSources {
|
|
15
|
+
schema: () => ScreenNode[];
|
|
16
|
+
styles: () => string;
|
|
17
|
+
}
|
|
18
|
+
export declare function templateCompletions({ schema, styles }: TemplateSources): CompletionSource;
|
|
19
|
+
export interface StylesSources {
|
|
20
|
+
slug: () => string;
|
|
21
|
+
template: () => string;
|
|
22
|
+
}
|
|
23
|
+
export declare function stylesCompletions({ slug, template }: StylesSources): CompletionSource;
|
|
24
|
+
/** Classes a stylesheet declares, nested `&__part` resolved against its parent. */
|
|
25
|
+
export declare function styleClasses(styles: string): string[];
|
|
26
|
+
/** Classes the template writes literally; anything Blade computes is left out. */
|
|
27
|
+
export declare function templateClasses(template: string): string[];
|
|
28
|
+
export interface SchemaSources {
|
|
29
|
+
types: () => TypeRegistry;
|
|
30
|
+
}
|
|
31
|
+
export declare function schemaCompletions({ types }: SchemaSources): CompletionSource;
|
|
32
|
+
interface Frame {
|
|
33
|
+
kind: 'object' | 'array';
|
|
34
|
+
parent: Frame | null;
|
|
35
|
+
/** For an array: the key it is the value of. */
|
|
36
|
+
under: string | null;
|
|
37
|
+
keys: Set<string>;
|
|
38
|
+
phase: 'key' | 'colon' | 'value' | 'after';
|
|
39
|
+
key: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface JsonContext {
|
|
42
|
+
/** The caret stands in an object that is a screen node. */
|
|
43
|
+
node: boolean;
|
|
44
|
+
phase: Frame['phase'];
|
|
45
|
+
/** The key whose value is being written. */
|
|
46
|
+
key: string | null;
|
|
47
|
+
/** Every key the object has, before the caret and after it. */
|
|
48
|
+
keys: Set<string>;
|
|
49
|
+
/** Where the string under the caret starts, after its opening quote. */
|
|
50
|
+
string: number | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Where the caret stands in a schema, by one pass over the text — it has to work on a
|
|
54
|
+
* document that is broken right there, which is always the case while typing, and a parser
|
|
55
|
+
* gives up on exactly that.
|
|
56
|
+
*/
|
|
57
|
+
export declare function jsonContext(doc: string, pos: number): JsonContext | null;
|
|
58
|
+
export {};
|
package/dist/frame.d.ts
CHANGED
|
@@ -44,10 +44,13 @@ export interface FrameBinding {
|
|
|
44
44
|
/**
|
|
45
45
|
* Make the preview a picture of the page rather than the page itself.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
* stopped there it never reaches a link, a form or
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* A click inside a block is taken at the document, in the capture phase, and goes no further:
|
|
48
|
+
* stopped there it never reaches a link, a form or the block's own script. What it does
|
|
49
|
+
* instead is choose the block it landed in, which is the one thing the editor wants from it.
|
|
50
|
+
*
|
|
51
|
+
* A click on the site around the blocks goes on to the site, only never anywhere else (see
|
|
52
|
+
* `inert`): the layout may open a newsletter popup or a cookie bar over the page, and one whose
|
|
53
|
+
* close button never hears its click covers the preview for good.
|
|
51
54
|
*
|
|
52
55
|
* Bound per document: an iframe that reloads gets a new one, and the old binding is released
|
|
53
56
|
* with it.
|
|
@@ -59,6 +62,9 @@ export declare function bindFrame(doc: Document, handlers: {
|
|
|
59
62
|
* The same picture without the choosing: nothing in the page navigates, submits or is dragged
|
|
60
63
|
* away. What the block editor's stage needs — the site's header is full of links, and one
|
|
61
64
|
* click on them would leave the frame on another page of the site with the block gone.
|
|
65
|
+
*
|
|
66
|
+
* Clicks themselves still reach the page (see `inert`): the block's own script runs as it will
|
|
67
|
+
* on the site, and the site's popups close.
|
|
62
68
|
*/
|
|
63
69
|
export declare function freezeFrame(doc: Document): FrameBinding;
|
|
64
70
|
/** The key the stage draws its block under — `StageController::KEY` on the server. */
|