@webx-ui/module-blocks 0.2.0 → 0.4.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/dist/BlocksField.d.ts +9 -3
- package/dist/BlocksPreview.d.ts +5 -1
- package/dist/BlocksTree.d.ts +2 -0
- package/dist/content.d.ts +10 -0
- package/dist/frame.d.ts +31 -0
- package/dist/index.js +1701 -1519
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +4 -4
package/dist/BlocksField.d.ts
CHANGED
|
@@ -54,11 +54,15 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
54
54
|
mode?: "wide" | "phone";
|
|
55
55
|
reload?: number;
|
|
56
56
|
fill?: boolean;
|
|
57
|
-
}> & Readonly<{
|
|
57
|
+
}> & Readonly<{
|
|
58
|
+
onSelect?: ((key: string | null) => any) | undefined;
|
|
59
|
+
}>, {
|
|
58
60
|
replace: (key: string, html: string) => boolean;
|
|
59
61
|
refresh: () => void;
|
|
60
62
|
open: () => boolean;
|
|
61
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
63
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
64
|
+
select: (key: string | null) => any;
|
|
65
|
+
}, import('vue').PublicProps, {
|
|
62
66
|
fill: boolean;
|
|
63
67
|
mode: "wide" | "phone";
|
|
64
68
|
selected: string | null;
|
|
@@ -79,7 +83,9 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
79
83
|
mode?: "wide" | "phone";
|
|
80
84
|
reload?: number;
|
|
81
85
|
fill?: boolean;
|
|
82
|
-
}> & Readonly<{
|
|
86
|
+
}> & Readonly<{
|
|
87
|
+
onSelect?: ((key: string | null) => any) | undefined;
|
|
88
|
+
}>, {
|
|
83
89
|
replace: (key: string, html: string) => boolean;
|
|
84
90
|
refresh: () => void;
|
|
85
91
|
open: () => boolean;
|
package/dist/BlocksPreview.d.ts
CHANGED
|
@@ -25,7 +25,11 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
25
25
|
replace: typeof replace;
|
|
26
26
|
refresh: typeof refresh;
|
|
27
27
|
open: () => boolean;
|
|
28
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
28
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
|
+
select: (key: string | null) => any;
|
|
30
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
onSelect?: ((key: string | null) => any) | undefined;
|
|
32
|
+
}>, {
|
|
29
33
|
fill: boolean;
|
|
30
34
|
mode: "wide" | "phone";
|
|
31
35
|
selected: string | null;
|
package/dist/BlocksTree.d.ts
CHANGED
|
@@ -20,12 +20,14 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
20
20
|
add: (parentKey: string | null, field: string | null, node: ScreenNode | null) => any;
|
|
21
21
|
remove: (key: string) => any;
|
|
22
22
|
duplicate: (key: string) => any;
|
|
23
|
+
visibility: (key: string, hidden: boolean) => any;
|
|
23
24
|
reorder: (parentKey: string | null, field: string | null, list: BlockNode[]) => any;
|
|
24
25
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
26
|
onSelect?: ((key: string) => any) | undefined;
|
|
26
27
|
onAdd?: ((parentKey: string | null, field: string | null, node: ScreenNode | null) => any) | undefined;
|
|
27
28
|
onRemove?: ((key: string) => any) | undefined;
|
|
28
29
|
onDuplicate?: ((key: string) => any) | undefined;
|
|
30
|
+
onVisibility?: ((key: string, hidden: boolean) => any) | undefined;
|
|
29
31
|
onReorder?: ((parentKey: string | null, field: string | null, list: BlockNode[]) => any) | undefined;
|
|
30
32
|
}>, {
|
|
31
33
|
disabled: boolean;
|
package/dist/content.d.ts
CHANGED
|
@@ -28,12 +28,22 @@ export declare function locate(tree: BlockNode[], key: string): Located | null;
|
|
|
28
28
|
export declare function walk(tree: BlockNode[], visit: (node: BlockNode, depth: number, parent: BlockNode | null) => void, depth?: number, parent?: BlockNode | null): void;
|
|
29
29
|
/** How many instances of a type the tree holds, nested ones included. */
|
|
30
30
|
export declare function countType(tree: BlockNode[], slug: string): number;
|
|
31
|
+
/** How many blocks sit inside a node, at any depth — what removing it takes with it. */
|
|
32
|
+
export declare function countInside(node: BlockNode): number;
|
|
31
33
|
/** The distinct types a tree uses, in first-seen order. */
|
|
32
34
|
export declare function typesIn(tree: BlockNode[]): string[];
|
|
33
35
|
/** The `wx-blocks` nodes of a schema, through cards and tabs. */
|
|
34
36
|
export declare function nestedFields(schema: ScreenNode[]): ScreenNode[];
|
|
35
37
|
/** A copy with fresh keys all the way down — what a duplicate is. */
|
|
36
38
|
export declare function cloneNode(node: BlockNode): BlockNode;
|
|
39
|
+
/**
|
|
40
|
+
* Switch a block off, or back on.
|
|
41
|
+
*
|
|
42
|
+
* Showing it removes the key rather than writing `false`, so a block that was never hidden and
|
|
43
|
+
* one that was hidden and shown again are the same content — and the revision that guards a
|
|
44
|
+
* save says so.
|
|
45
|
+
*/
|
|
46
|
+
export declare function setHidden(tree: BlockNode[], key: string, hidden: boolean): BlockNode[];
|
|
37
47
|
export declare function insertNode(tree: BlockNode[], parentKey: string | null, field: string | null, index: number, node: BlockNode): BlockNode[];
|
|
38
48
|
export declare function removeNode(tree: BlockNode[], key: string): BlockNode[];
|
|
39
49
|
export declare function updateValues(tree: BlockNode[], key: string, values: Record<string, unknown>): BlockNode[];
|
package/dist/frame.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* reachable and nothing has to be injected into the site's markup beyond one stylesheet.
|
|
9
9
|
*/
|
|
10
10
|
export declare const SELECTED_CLASS = "wx-preview-selected";
|
|
11
|
+
export declare const HOVER_CLASS = "wx-preview-hover";
|
|
11
12
|
export interface MarkerRange {
|
|
12
13
|
start: Comment;
|
|
13
14
|
end: Comment;
|
|
@@ -24,6 +25,36 @@ export declare function replaceBlock(doc: Document, key: string, html: string):
|
|
|
24
25
|
export declare function blockElement(root: Node, key: string): Element | null;
|
|
25
26
|
/** Mark one block as the selected one, and nothing else. Null clears the selection. */
|
|
26
27
|
export declare function highlightBlock(doc: Document, key: string | null): Element | null;
|
|
28
|
+
/** Mark one block as the one under the pointer. Null clears it. */
|
|
29
|
+
export declare function hoverBlock(doc: Document, key: string | null): void;
|
|
30
|
+
/**
|
|
31
|
+
* Which block an element inside the page belongs to — the innermost one, since a block nested
|
|
32
|
+
* in a container is what somebody pointing at it means.
|
|
33
|
+
*
|
|
34
|
+
* The markers are comments among an element's siblings rather than around it, so this walks
|
|
35
|
+
* back through the previous siblings counting closers: a `/wx:` met on the way out belongs to
|
|
36
|
+
* a block that has already ended, and its opener is not ours. Nothing found at this level
|
|
37
|
+
* means the search carries on in the parent.
|
|
38
|
+
*/
|
|
39
|
+
export declare function keyAt(node: Node | null): string | null;
|
|
40
|
+
/** What was bound to the page, so that a reload can let go of the old document. */
|
|
41
|
+
export interface FrameBinding {
|
|
42
|
+
release(): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Make the preview a picture of the page rather than the page itself.
|
|
46
|
+
*
|
|
47
|
+
* Every pointer event is taken at the document, in the capture phase, and goes no further:
|
|
48
|
+
* stopped there it never reaches a link, a form or a block's own script, so nothing in the
|
|
49
|
+
* preview navigates, submits or opens anything. What a click does instead is choose the block
|
|
50
|
+
* it landed in, which is the one thing the editor wants from it.
|
|
51
|
+
*
|
|
52
|
+
* Bound per document: an iframe that reloads gets a new one, and the old binding is released
|
|
53
|
+
* with it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function bindFrame(doc: Document, handlers: {
|
|
56
|
+
select: (key: string | null) => void;
|
|
57
|
+
}): FrameBinding;
|
|
27
58
|
export interface StageInput {
|
|
28
59
|
html: string;
|
|
29
60
|
styles: string;
|