@webx-ui/module-blocks 0.8.9 → 0.9.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/BlockCard.d.ts +11 -2
- package/dist/BlockDataField.d.ts +27 -0
- package/dist/BlockDeclaredCard.d.ts +25 -0
- package/dist/BlockEditorPage.d.ts +5 -0
- package/dist/BlockPicker.d.ts +1 -1
- package/dist/BlocksField.d.ts +2 -2
- package/dist/BlocksPage.d.ts +4 -0
- package/dist/BlocksTree.d.ts +3 -3
- package/dist/api.d.ts +5 -1
- package/dist/completions.d.ts +29 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2735 -2096
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +23 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +56 -0
- package/package.json +2 -2
package/dist/BlockCard.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { BlockType } from './types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* One type in the list: its picture, its name, where it stands and which versions it has.
|
|
4
|
+
*
|
|
5
|
+
* A component stands on no page — it stands in other blocks — so its line counts those instead,
|
|
6
|
+
* and one a module declared says which module's view it replaced.
|
|
7
|
+
*/
|
|
3
8
|
type __VLS_Props = {
|
|
4
9
|
block: BlockType;
|
|
10
|
+
/** The name of the module that declared this slug, when one did. */
|
|
11
|
+
module?: string | null;
|
|
5
12
|
};
|
|
6
13
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
14
|
open: (block: BlockType) => any;
|
|
8
15
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
16
|
onOpen?: ((block: BlockType) => any) | undefined;
|
|
10
|
-
}>, {
|
|
17
|
+
}>, {
|
|
18
|
+
module: string | null;
|
|
19
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
11
20
|
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `wx-data` in a component's sample form: a structure the caller passes from code, which nobody
|
|
3
|
+
* edits in the panel except to try the component on something else. So it is JSON, as it
|
|
4
|
+
* travels, in the code editor the rest of this screen is written in (§3.3).
|
|
5
|
+
*
|
|
6
|
+
* The text is kept as typed and the value changes only on JSON that parses: half a bracket is
|
|
7
|
+
* what the text looks like on every keystroke on the way to the next valid one, and a sample
|
|
8
|
+
* that became `null` in the middle of typing would redraw the stage empty each time. An empty
|
|
9
|
+
* editor is the one exception: that is `null` on purpose — the call that passes nothing, which
|
|
10
|
+
* a component has to survive, and which publishing checks when the sample says so.
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
modelValue?: unknown;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** The shape's name (`recipes.card`): the help under the template describes it. */
|
|
16
|
+
shape?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: unknown) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
shape: string;
|
|
24
|
+
modelValue: undefined;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DeclaredComponent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A place a module declared and the site has not customised: the module draws its own view
|
|
4
|
+
* there. It stands among the components rather than in a settings page, because otherwise nobody
|
|
5
|
+
* learns the place can be changed at all (§3.9).
|
|
6
|
+
*
|
|
7
|
+
* No picture: there is no type to draw yet, and the module's view is drawn with data only the
|
|
8
|
+
* module has. The card says whose view it is and offers the one thing to do with it.
|
|
9
|
+
*/
|
|
10
|
+
type __VLS_Props = {
|
|
11
|
+
declared: DeclaredComponent;
|
|
12
|
+
/** The module's name as the panel shows it. */
|
|
13
|
+
module: string;
|
|
14
|
+
canManage?: boolean;
|
|
15
|
+
busy?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
18
|
+
customise: (declared: DeclaredComponent) => any;
|
|
19
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
onCustomise?: ((declared: DeclaredComponent) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
canManage: boolean;
|
|
23
|
+
busy: boolean;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
25
|
+
export default _default;
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* The loop is closed all the same: edit the schema and the form rebuilds, edit the values and
|
|
9
9
|
* the stage redraws, edit the template or the styles and so does it.
|
|
10
|
+
*
|
|
11
|
+
* A component is edited on the same screen (§3.9 of the components spec). What differs is what
|
|
12
|
+
* its schema means — the input a caller hands it, not a form — so the settings lose what only a
|
|
13
|
+
* block on a page needs, "Fields" become "Input data", and under the template stands the tag that
|
|
14
|
+
* calls it. Where it is used is the blocks that call it rather than pages.
|
|
10
15
|
*/
|
|
11
16
|
type __VLS_Props = {
|
|
12
17
|
base?: string;
|
package/dist/BlockPicker.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ type __VLS_Props = {
|
|
|
18
18
|
blocksPath?: string | null;
|
|
19
19
|
};
|
|
20
20
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
-
parent: BlockType | null;
|
|
22
21
|
allow: string[] | null;
|
|
23
22
|
groups: string[];
|
|
23
|
+
parent: BlockType | null;
|
|
24
24
|
tree: BlockNode[];
|
|
25
25
|
blocksPath: string | null;
|
|
26
26
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
package/dist/BlocksField.d.ts
CHANGED
|
@@ -27,10 +27,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
27
27
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
28
28
|
"onUpdate:modelValue"?: ((value: BlockNode[]) => any) | undefined;
|
|
29
29
|
}>, {
|
|
30
|
-
|
|
30
|
+
allow: string[] | null;
|
|
31
31
|
disabled: boolean;
|
|
32
|
+
name: string;
|
|
32
33
|
node: ScreenNode;
|
|
33
|
-
allow: string[] | null;
|
|
34
34
|
localized: boolean;
|
|
35
35
|
max: number | null;
|
|
36
36
|
context: RenderContext;
|
package/dist/BlocksPage.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* The section: every type as a card with a live thumbnail, grouped the way the picker groups
|
|
3
3
|
* them. Cards rather than a table because a block is recognised by its picture — "Section"
|
|
4
4
|
* says nothing about whether it is a full-width band or a container with columns.
|
|
5
|
+
*
|
|
6
|
+
* Two kinds, two groups (§3.9 of the components spec): the blocks editors put on pages, then
|
|
7
|
+
* the components templates call. The places modules declared and the site has not customised
|
|
8
|
+
* stand among the components — a place nobody sees is a possibility nobody learns about.
|
|
5
9
|
*/
|
|
6
10
|
type __VLS_Props = {
|
|
7
11
|
base?: string;
|
package/dist/BlocksTree.d.ts
CHANGED
|
@@ -16,22 +16,22 @@ type __VLS_Props = {
|
|
|
16
16
|
depth?: number;
|
|
17
17
|
};
|
|
18
18
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
|
-
select: (key: string) => any;
|
|
20
19
|
add: (parentKey: string | null, field: string | null, node: ScreenNode | null) => any;
|
|
21
20
|
remove: (key: string) => any;
|
|
22
21
|
duplicate: (key: string) => any;
|
|
22
|
+
select: (key: string) => any;
|
|
23
23
|
visibility: (key: string, hidden: boolean) => any;
|
|
24
24
|
reorder: (parentKey: string | null, field: string | null, list: BlockNode[]) => any;
|
|
25
25
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
-
onSelect?: ((key: string) => any) | undefined;
|
|
27
26
|
onAdd?: ((parentKey: string | null, field: string | null, node: ScreenNode | null) => any) | undefined;
|
|
28
27
|
onRemove?: ((key: string) => any) | undefined;
|
|
29
28
|
onDuplicate?: ((key: string) => any) | undefined;
|
|
29
|
+
onSelect?: ((key: string) => any) | undefined;
|
|
30
30
|
onVisibility?: ((key: string, hidden: boolean) => any) | undefined;
|
|
31
31
|
onReorder?: ((parentKey: string | null, field: string | null, list: BlockNode[]) => any) | undefined;
|
|
32
32
|
}>, {
|
|
33
|
-
disabled: boolean;
|
|
34
33
|
field: string | null;
|
|
34
|
+
disabled: boolean;
|
|
35
35
|
depth: number;
|
|
36
36
|
selected: string | null;
|
|
37
37
|
parentKey: string | null;
|
package/dist/api.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { AdminContext } from '@webx-ui/module-admin';
|
|
2
|
-
import { BlockInput, BlockType, BlockUsage, BlockVersion, BlockVersionMeta, RenderInput, RenderResult } from './types';
|
|
2
|
+
import { BlockInput, BlockList, BlockType, BlockUsage, BlockVersion, BlockVersionMeta, RenderInput, RenderResult } from './types';
|
|
3
3
|
export interface BlocksApi {
|
|
4
4
|
/** Every type, without content: the section's list. */
|
|
5
5
|
list(): Promise<BlockType[]>;
|
|
6
|
+
/** The same list with the places modules declared for components beside it. */
|
|
7
|
+
index(): Promise<BlockList>;
|
|
6
8
|
/** The published types with their content: what the constructor and the picker read. */
|
|
7
9
|
catalog(): Promise<BlockType[]>;
|
|
8
10
|
get(id: number): Promise<BlockType>;
|
|
9
11
|
create(input: BlockInput): Promise<BlockType>;
|
|
10
12
|
update(id: number, input: BlockInput): Promise<BlockType>;
|
|
11
13
|
remove(id: number): Promise<void>;
|
|
14
|
+
/** A declared place made into the site's own type: an unpublished draft of the module's view. */
|
|
15
|
+
customise(slug: string): Promise<BlockType>;
|
|
12
16
|
publish(id: number): Promise<BlockType>;
|
|
13
17
|
render(id: number, input?: RenderInput): Promise<RenderResult>;
|
|
14
18
|
usage(id: number): Promise<BlockUsage[]>;
|
package/dist/completions.d.ts
CHANGED
|
@@ -14,8 +14,36 @@ export declare function completions(source: CompletionSource): Extension;
|
|
|
14
14
|
export interface TemplateSources {
|
|
15
15
|
schema: () => ScreenNode[];
|
|
16
16
|
styles: () => string;
|
|
17
|
+
/** The types a tag can call, components among them: what `type="` offers. */
|
|
18
|
+
types?: () => TagTarget[];
|
|
19
|
+
/**
|
|
20
|
+
* The schema of a type, for the attributes and slots of a tag that calls it. May answer later:
|
|
21
|
+
* the list of types comes without content, and the one schema is asked for when it is needed.
|
|
22
|
+
*/
|
|
23
|
+
schemaOf?: (slug: string) => ScreenNode[] | null | Promise<ScreenNode[] | null>;
|
|
17
24
|
}
|
|
18
|
-
|
|
25
|
+
/** A type as a tag names it. */
|
|
26
|
+
export interface TagTarget {
|
|
27
|
+
slug: string;
|
|
28
|
+
title: string;
|
|
29
|
+
kind: 'block' | 'component';
|
|
30
|
+
/** The module's view, for a declared place: the tag that calls it should carry it. */
|
|
31
|
+
fallback?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function templateCompletions({ schema, styles, types, schemaOf, }: TemplateSources): CompletionSource;
|
|
34
|
+
interface OpenTag {
|
|
35
|
+
/** The attributes written so far. */
|
|
36
|
+
attributes: string;
|
|
37
|
+
/** The type, once it is written among them. */
|
|
38
|
+
type: string | null;
|
|
39
|
+
/** `:` typed before the name. */
|
|
40
|
+
bound: boolean;
|
|
41
|
+
word: string;
|
|
42
|
+
}
|
|
43
|
+
/** The caret stands between the attributes of an `<x-webx-block` that is still open. */
|
|
44
|
+
export declare function openTag(before: string): OpenTag | null;
|
|
45
|
+
/** The type of the `<x-webx-block>` whose body the end of the text stands in, if any. */
|
|
46
|
+
export declare function enclosingType(text: string): string | null;
|
|
19
47
|
export interface StylesSources {
|
|
20
48
|
slug: () => string;
|
|
21
49
|
template: () => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ export { blocksPreviewKey, provideBlocksPreview, useBlocksPreview, type BlocksPr
|
|
|
5
5
|
export { cloneNode, countType, insertNode, isNode, isNodeList, locate, makeNode, newKey, removeNode, replaceList, typesIn, updateValues, walk, type Located, } from './content';
|
|
6
6
|
export { lintBlock, undeclared } from './lint';
|
|
7
7
|
export { findRange, highlightBlock, replaceBlock, stageDocument } from './frame';
|
|
8
|
-
export { formSchema } from './schema';
|
|
8
|
+
export { callTag, formSchema, kindOf } from './schema';
|
|
9
9
|
export { default as WxBlocks } from './BlocksField';
|
|
10
10
|
export { default as WxBlocksPage } from './BlocksPage';
|
|
11
11
|
export { default as WxBlockEditorPage } from './BlockEditorPage';
|
|
12
12
|
export { default as WxBlockPicker } from './BlockPicker';
|
|
13
13
|
export { default as WxBlockThumb } from './BlockThumb';
|
|
14
14
|
export { default as WxBlockStage } from './BlockStage';
|
|
15
|
-
export type { BlockContent, BlockInput, BlockNode, BlockSource, BlocksMeta, BlockThumbnail, BlockType, BlockUsage, BlockVersion, BlockVersionMeta, Lint, PublishRefusal, RenderInput, RenderResult, } from './types';
|
|
15
|
+
export type { BlockContent, BlockInput, BlockKind, BlockList, BlockNode, BlockParent, BlockSource, BlocksMeta, BlockThumbnail, BlockType, BlockUsage, BlockVersion, BlockVersionMeta, DeclaredComponent, Lint, PublishRefusal, RenderInput, RenderResult, ShapeField, } from './types';
|