@webx-ui/module-blocks 0.1.1 → 0.3.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.
@@ -18,6 +18,16 @@ type __VLS_Props = {
18
18
  disabled?: boolean;
19
19
  /** Where the section lives, for the picker's "make one" link. */
20
20
  blocksPath?: string;
21
+ /**
22
+ * Be as tall as what the field is drawn in, and let each of the three panels scroll inside
23
+ * itself.
24
+ *
25
+ * Off by default, because the ordinary case is a field on a form that scrolls: there the
26
+ * constructor is as tall as it needs to be and the preview sticks. A screen that has given
27
+ * the constructor the whole area below its head says so — otherwise the field grows, the
28
+ * page scrolls, and the tree, the form and the preview all leave the screen together.
29
+ */
30
+ fill?: boolean;
21
31
  };
22
32
  type __VLS_PublicProps = {
23
33
  modelValue?: BlockNode[];
@@ -27,6 +37,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
27
37
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
38
  "onUpdate:modelValue"?: ((value: BlockNode[]) => any) | undefined;
29
39
  }>, {
40
+ fill: boolean;
30
41
  name: string;
31
42
  disabled: boolean;
32
43
  node: ScreenNode;
@@ -42,11 +53,13 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
42
53
  selected?: string | null;
43
54
  mode?: "wide" | "phone";
44
55
  reload?: number;
56
+ fill?: boolean;
45
57
  }> & Readonly<{}>, {
46
58
  replace: (key: string, html: string) => boolean;
47
59
  refresh: () => void;
48
60
  open: () => boolean;
49
61
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
62
+ fill: boolean;
50
63
  mode: "wide" | "phone";
51
64
  selected: string | null;
52
65
  reload: number;
@@ -65,11 +78,13 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
65
78
  selected?: string | null;
66
79
  mode?: "wide" | "phone";
67
80
  reload?: number;
81
+ fill?: boolean;
68
82
  }> & Readonly<{}>, {
69
83
  replace: (key: string, html: string) => boolean;
70
84
  refresh: () => void;
71
85
  open: () => boolean;
72
86
  }, {}, {}, {}, {
87
+ fill: boolean;
73
88
  mode: "wide" | "phone";
74
89
  selected: string | null;
75
90
  reload: number;
@@ -15,6 +15,8 @@ type __VLS_Props = {
15
15
  mode?: 'wide' | 'phone';
16
16
  /** Bumped by the host to reload the page. */
17
17
  reload?: number;
18
+ /** Be as tall as what it is drawn in, and scroll the page inside rather than beside. */
19
+ fill?: boolean;
18
20
  };
19
21
  /** Swap one block's markup in place; false when the page has to be reloaded instead. */
20
22
  declare function replace(key: string, html: string): boolean;
@@ -24,6 +26,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
24
26
  refresh: typeof refresh;
25
27
  open: () => boolean;
26
28
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
29
+ fill: boolean;
27
30
  mode: "wide" | "phone";
28
31
  selected: string | null;
29
32
  reload: number;
@@ -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[];