@webx-ui/module-blocks 0.13.1 → 0.15.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.
@@ -62,10 +62,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
62
62
  select: (key: string | null) => any;
63
63
  edit: () => any;
64
64
  }, import('vue').PublicProps, {
65
+ reload: number;
65
66
  hidden: string[];
66
67
  selected: string | null;
67
68
  compact: boolean;
68
- reload: number;
69
69
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
70
70
  bar: HTMLDivElement;
71
71
  box: HTMLDivElement;
@@ -91,10 +91,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
91
91
  refresh: () => void;
92
92
  open: () => boolean;
93
93
  }, {}, {}, {}, {
94
+ reload: number;
94
95
  hidden: string[];
95
96
  selected: string | null;
96
97
  compact: boolean;
97
- reload: number;
98
98
  }> | null;
99
99
  }, any>;
100
100
  export default _default;
@@ -34,10 +34,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
34
34
  onSelect?: ((key: string | null) => any) | undefined;
35
35
  onEdit?: (() => any) | undefined;
36
36
  }>, {
37
+ reload: number;
37
38
  hidden: string[];
38
39
  selected: string | null;
39
40
  compact: boolean;
40
- reload: number;
41
41
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
42
42
  bar: HTMLDivElement;
43
43
  box: HTMLDivElement;
@@ -0,0 +1,30 @@
1
+ import { SiteBarContext } from '@webx-ui/module-admin';
2
+ /**
3
+ * The «Blocks» tab of the panel on the site (WEBX_UI_SITE_BAR.md, §8–§9, SB4).
4
+ *
5
+ * Two states, like the constructor's narrow column: maps of the blocks, or one block's fields.
6
+ * The maps are the record's — the page behind the address — and the layout's regions', the
7
+ * header and the footer, each under its own name; a row under the pointer frames its block on the
8
+ * page. The pencil is the way from the page: with it on, a click on a block picks it there
9
+ * instead of following its link, whichever tree it belongs to.
10
+ *
11
+ * The form is the constructor's own — the block's schema through the same steps, drawn by the
12
+ * same renderer with the panel's field types — and its values are the draft's, never the
13
+ * site's: an edit goes into the draft of whatever holds the block, and a form that showed what
14
+ * is published would write over whatever a colleague prepared. «Save» writes the fields that
15
+ * changed and puts the block, drawn from the draft, in place of the old one on the page.
16
+ *
17
+ * The record's draft is published from the head of the bar; a region's — with its own buttons
18
+ * over its map and over the form of its block, since it is a draft of its own and goes on every
19
+ * page at once.
20
+ *
21
+ * The structure too (SB5): a block added — below another, at the end of a tree, inside a
22
+ * container — duplicated, moved up or down, hidden, shown or deleted, each one an operation of the
23
+ * agent's dictionary into the same draft. The picker is the constructor's, held to the same rules
24
+ * of the place; what cannot be done right now is greyed with the reason rather than missing.
25
+ */
26
+ type __VLS_Props = {
27
+ context: SiteBarContext;
28
+ };
29
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
30
+ export default _default;
@@ -25,21 +25,21 @@ type __VLS_Props = {
25
25
  };
26
26
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
27
27
  add: (parentKey: string | null, field: string | null, node: ScreenNode | null, index?: number | undefined) => any;
28
- remove: (key: string) => any;
28
+ move: (key: string) => any;
29
29
  duplicate: (key: string) => any;
30
+ remove: (key: string) => any;
30
31
  copy: (key: string) => any;
31
32
  paste: (parentKey: string | null, field: string | null, node: ScreenNode | null, index?: number | undefined) => any;
32
- move: (key: string) => any;
33
33
  select: (key: string) => any;
34
34
  visibility: (key: string, hidden: boolean) => any;
35
35
  reorder: (parentKey: string | null, field: string | null, list: BlockNode[]) => any;
36
36
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
37
37
  onAdd?: ((parentKey: string | null, field: string | null, node: ScreenNode | null, index?: number | undefined) => any) | undefined;
38
- onRemove?: ((key: string) => any) | undefined;
38
+ onMove?: ((key: string) => any) | undefined;
39
39
  onDuplicate?: ((key: string) => any) | undefined;
40
+ onRemove?: ((key: string) => any) | undefined;
40
41
  onCopy?: ((key: string) => any) | undefined;
41
42
  onPaste?: ((parentKey: string | null, field: string | null, node: ScreenNode | null, index?: number | undefined) => any) | undefined;
42
- onMove?: ((key: string) => any) | undefined;
43
43
  onSelect?: ((key: string) => any) | undefined;
44
44
  onVisibility?: ((key: string, hidden: boolean) => any) | undefined;
45
45
  onReorder?: ((parentKey: string | null, field: string | null, list: BlockNode[]) => any) | undefined;
@@ -0,0 +1,28 @@
1
+ import { SiteBarRegion } from './types';
2
+ /**
3
+ * A region's unpublished draft in the panel on the site, with the buttons that publish it or
4
+ * throw it away.
5
+ *
6
+ * Drawn over the region's map and over the form of one of its blocks alike: the head of the bar
7
+ * speaks for the record only, so the form is where an editor who has just saved a block of the
8
+ * footer is looking — and a notice that only the map carried was found after a reload.
9
+ */
10
+ type __VLS_Props = {
11
+ region: SiteBarRegion;
12
+ /** This region's publication or discard is under way. */
13
+ busy?: boolean;
14
+ /** Another region's is: one at a time, since each reloads the page. */
15
+ blocked?: boolean;
16
+ /** Why the publication was refused — the blocks of the draft that fail. */
17
+ refusals?: string[];
18
+ /** The region's draft drawn on this page: after a reload the page shows the site again. */
19
+ preview?: string | null;
20
+ };
21
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
+ publish: () => any;
23
+ discard: () => any;
24
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onPublish?: (() => any) | undefined;
26
+ onDiscard?: (() => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
package/dist/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AdminContext } from '@webx-ui/module-admin';
2
- import { BlockExport, BlockImportRow, BlockInput, BlockList, BlockType, BlockUsage, BlockVersion, BlockNode, BlockVersionMeta, RegionAdopted, RegionDetail, RegionRow, RegionVersion, RenderInput, RenderResult } from './types';
2
+ import { BlockExport, BlockImportRow, BlockInput, BlockList, BlockType, BlockUsage, BlockVersion, BlockNode, BlockVersionMeta, RegionAdopted, RegionDetail, RegionRow, RegionVersion, RenderInput, RenderResult, SiteBarBlockEdit, SiteBarBlockEdited, SiteBarBlocks } from './types';
3
3
  export interface BlocksApi {
4
4
  /** Every type, without content: the section's list. */
5
5
  list(): Promise<BlockType[]>;
@@ -40,6 +40,17 @@ export interface BlocksApi {
40
40
  }
41
41
  /** Everything under `/blocks`, below the panel's API path. */
42
42
  export declare function createBlocksApi(admin: AdminContext): BlocksApi;
43
+ export interface SiteBarBlocksApi {
44
+ /** A record's blocks: the draft's, or the site's when there is no draft. */
45
+ read(type: string, id: number | string): Promise<SiteBarBlocks>;
46
+ /**
47
+ * One block's fields into the record's draft. A revision that moved is answered 409 — the
48
+ * error's body names who moved it.
49
+ */
50
+ edit(type: string, id: number | string, input: SiteBarBlockEdit): Promise<SiteBarBlockEdited>;
51
+ }
52
+ /** The two addresses of the «Blocks» tab of the panel on the site, by the record's address type. */
53
+ export declare function createSiteBarBlocksApi(admin: AdminContext): SiteBarBlocksApi;
43
54
  export interface RegionsApi {
44
55
  /** Every region the site's config declares, saved or not. */
45
56
  list(): Promise<RegionRow[]>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * CSS knows only tokens (THEMES §8) — the theme engine's `Checks\CssCheck`, rule for rule, for
3
+ * the editor's live lints. Not a parser: a walk over braces and semicolons that knows strings,
4
+ * comments and parentheses.
5
+ *
6
+ * Unlike the engine it has no `media-width`: the editor's `media-query` says it of any `@media`.
7
+ */
8
+ export type CssProblem = 'literal-color' | 'literal-font' | 'unknown-token' | 'token-fallback';
9
+ export interface CssFinding {
10
+ problem: CssProblem;
11
+ line: number;
12
+ subject: string;
13
+ }
14
+ /**
15
+ * @param tokens The chain's vocabulary, names without `--site-`.
16
+ */
17
+ export declare function cssFindings(css: string, tokens: Iterable<string>): CssFinding[];
package/dist/i18n.d.ts CHANGED
@@ -1,2 +1,8 @@
1
+ import { I18n } from '@webx-ui/module-admin';
2
+ /**
3
+ * Puts this package's English under a panel's dictionary, once per panel. For what runs outside
4
+ * a component's setup — the label of a tab on the panel on the site is asked for by the frame.
5
+ */
6
+ export declare function seedBlocksMessages(i18n: I18n): void;
1
7
  /** Puts this package's English under the panel's dictionary, once per panel. */
2
8
  export declare function useBlocksMessages(): void;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { blocks, regions, type BlocksOptions, type RegionsOptions } from './module';
2
- export { createBlocksApi, createRegionsApi, type BlocksApi, type RegionsApi } from './api';
2
+ export { createBlocksApi, createRegionsApi, createSiteBarBlocksApi, type BlocksApi, type RegionsApi, type SiteBarBlocksApi, } from './api';
3
3
  export { blocksMessages } from './messages';
4
4
  export { blocksPreviewKey, blocksTopKey, provideBlocksPreview, provideBlocksTop, useBlocksPreview, type BlocksPreview, type BlocksTop, } from './preview';
5
5
  export { cloneNode, countType, insertNode, isNode, isNodeList, locate, makeNode, newKey, removeNode, replaceList, typesIn, updateValues, walk, type Located, } from './content';
@@ -7,6 +7,7 @@ export { lintBlock, undeclared } from './lint';
7
7
  export { findRange, highlightBlock, replaceBlock, stageDocument } from './frame';
8
8
  export { callTag, formSchema, kindOf } from './schema';
9
9
  export { default as WxBlocks } from './BlocksField';
10
+ export { default as WxBlocksSiteBarTab } from './BlocksSiteBarTab';
10
11
  export { default as WxBlocksPage } from './BlocksPage';
11
12
  export { default as WxBlockEditorPage } from './BlockEditorPage';
12
13
  export { default as WxBlockPicker } from './BlockPicker';