@webx-ui/module-blocks 0.16.2 → 0.16.3

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.
@@ -19,77 +19,10 @@ type __VLS_Props = {
19
19
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
20
20
  base: string;
21
21
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
22
- templateEditor: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
23
- modelValue?: string;
24
- } & import('@webx-ui/core').CodeEditorProps> & Readonly<{
25
- onChange?: ((value: string) => any) | undefined;
26
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
27
- onBlur?: (() => any) | undefined;
28
- onFocus?: (() => any) | undefined;
29
- onLint?: ((diagnostics: import('@webx-ui/core').CodeEditorDiagnostic[]) => any) | undefined;
30
- }>, {
31
- view: import('vue').ShallowRef<import('@codemirror/view').EditorView | null, import('@codemirror/view').EditorView | null>;
22
+ templateEditor: {
23
+ view: import('@codemirror/view').EditorView | null;
32
24
  focus: () => void | undefined;
33
25
  format: () => boolean;
34
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
35
- change: (value: string) => any;
36
- "update:modelValue": (value: string) => any;
37
- blur: () => any;
38
- focus: () => any;
39
- lint: (diagnostics: import('@webx-ui/core').CodeEditorDiagnostic[]) => any;
40
- }, import('vue').PublicProps, {
41
- size: import('@webx-ui/core').ControlSize;
42
- disabled: boolean;
43
- placeholder: string;
44
- ariaLabel: string;
45
- status: import('@webx-ui/core').ControlStatus;
46
- id: string;
47
- language: import('@webx-ui/core').CodeEditorLanguage;
48
- readonly: boolean;
49
- minHeight: string;
50
- maxHeight: string;
51
- lineNumbers: boolean;
52
- lineWrapping: boolean;
53
- tabSize: number;
54
- lint: boolean;
55
- extensions: import('@codemirror/state').Extension[];
56
- }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
57
- host: HTMLDivElement;
58
- }, any, import('vue').ComponentProvideOptions, {
59
- P: {};
60
- B: {};
61
- D: {};
62
- C: {};
63
- M: {};
64
- Defaults: {};
65
- }, Readonly<{
66
- modelValue?: string;
67
- } & import('@webx-ui/core').CodeEditorProps> & Readonly<{
68
- onChange?: ((value: string) => any) | undefined;
69
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
70
- onBlur?: (() => any) | undefined;
71
- onFocus?: (() => any) | undefined;
72
- onLint?: ((diagnostics: import('@webx-ui/core').CodeEditorDiagnostic[]) => any) | undefined;
73
- }>, {
74
- view: import('vue').ShallowRef<import('@codemirror/view').EditorView | null, import('@codemirror/view').EditorView | null>;
75
- focus: () => void | undefined;
76
- format: () => boolean;
77
- }, {}, {}, {}, {
78
- size: import('@webx-ui/core').ControlSize;
79
- disabled: boolean;
80
- placeholder: string;
81
- ariaLabel: string;
82
- status: import('@webx-ui/core').ControlStatus;
83
- id: string;
84
- language: import('@webx-ui/core').CodeEditorLanguage;
85
- readonly: boolean;
86
- minHeight: string;
87
- maxHeight: string;
88
- lineNumbers: boolean;
89
- lineWrapping: boolean;
90
- tabSize: number;
91
- lint: boolean;
92
- extensions: import('@codemirror/state').Extension[];
93
- }> | null;
26
+ } | null;
94
27
  }, HTMLDivElement>;
95
28
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { BlockAssets } from './frame';
1
2
  /**
2
3
  * The block as it will stand on the site, at a chosen width: a desktop scaled down to fit the
3
4
  * column, a tablet or a phone at one to one.
@@ -12,6 +13,8 @@ type __VLS_Props = {
12
13
  styles: string;
13
14
  script?: string | null;
14
15
  runtime?: string | null;
16
+ /** What the widgets in the block load: a map's stylesheet and script. */
17
+ assets?: BlockAssets | null;
15
18
  /** The address of the stage page; null draws the block on a bare document. */
16
19
  stage?: string | null;
17
20
  loading?: boolean;
@@ -20,6 +23,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
20
23
  script: string | null;
21
24
  loading: boolean;
22
25
  runtime: string | null;
26
+ assets: BlockAssets | null;
23
27
  stage: string | null;
24
28
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
25
29
  box: HTMLDivElement;
@@ -36,8 +36,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
36
36
  allow: string[] | null;
37
37
  shortcodes: ShortcodeToken[] | null;
38
38
  disabled: boolean;
39
- name: string;
40
39
  localized: boolean;
40
+ name: string;
41
41
  node: ScreenNode;
42
42
  max: number | null;
43
43
  context: RenderContext;
@@ -56,7 +56,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
56
56
  onEdit?: (() => any) | undefined;
57
57
  onSelect?: ((key: string | null) => any) | undefined;
58
58
  }>, {
59
- replace: (key: string, html: string) => boolean;
59
+ replace: (key: string, html: string, assets?: import('./frame').BlockAssets | null) => boolean;
60
60
  refresh: () => void;
61
61
  open: () => boolean;
62
62
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
@@ -90,7 +90,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
90
90
  onEdit?: (() => any) | undefined;
91
91
  onSelect?: ((key: string | null) => any) | undefined;
92
92
  }>, {
93
- replace: (key: string, html: string) => boolean;
93
+ replace: (key: string, html: string, assets?: import('./frame').BlockAssets | null) => boolean;
94
94
  refresh: () => void;
95
95
  open: () => boolean;
96
96
  }, {}, {}, {}, {
@@ -1,3 +1,4 @@
1
+ import { BlockAssets } from './frame';
1
2
  /**
2
3
  * The page in an iframe, the way it will be: the same handler, the same view, the draft
3
4
  * laid over the columns. The whole page at desktop width, unless the bar is asked for a
@@ -25,8 +26,11 @@ type __VLS_Props = {
25
26
  */
26
27
  region?: string | null;
27
28
  };
28
- /** Swap one block's markup in place; false when the page has to be reloaded instead. */
29
- declare function replace(key: string, html: string): boolean;
29
+ /**
30
+ * Swap one block's markup in place, with what its widgets load; false when the page has to be
31
+ * reloaded instead.
32
+ */
33
+ declare function replace(key: string, html: string, assets?: BlockAssets | null): boolean;
30
34
  declare function refresh(): void;
31
35
  declare const _default: import('vue').DefineComponent<__VLS_Props, {
32
36
  replace: typeof replace;
package/dist/frame.d.ts CHANGED
@@ -124,6 +124,22 @@ export declare function fillStage(doc: Document, input: {
124
124
  * there. Added as an element, since that is what makes a browser run it.
125
125
  */
126
126
  export declare function mountScript(doc: Document, script: string): void;
127
+ /** What the widgets of a drawn block load: tags for `<head>` and for the end of `<body>`. */
128
+ export interface BlockAssets {
129
+ head: string[];
130
+ body: string[];
131
+ }
132
+ /**
133
+ * Put what a block's widgets load into a page printed before the block was there — the
134
+ * stylesheet and the script of a map, the dialog of a form it opens. The server gathers them
135
+ * as it does for a whole page; a page gets each of them once, so what the page already has
136
+ * (the same address, the same id, the same inline style) is skipped.
137
+ *
138
+ * A stylesheet goes beside the widgets' stylesheets the page has, where the server puts them:
139
+ * under every theme layer, which restyles a widget by coming later. A script is made anew,
140
+ * since one parsed from markup never runs.
141
+ */
142
+ export declare function addAssets(doc: Document, assets: BlockAssets | null | undefined): void;
127
143
  export interface StageInput {
128
144
  html: string;
129
145
  styles: string;
@@ -135,6 +151,8 @@ export interface StageInput {
135
151
  base?: string | null;
136
152
  /** Styles the site's layout would give the page: fonts, the ground colour. */
137
153
  frame?: string | null;
154
+ /** What the block's widgets load. */
155
+ assets?: BlockAssets | null;
138
156
  }
139
157
  /**
140
158
  * A whole document for the editor's stage: the block on its own, with its styles, its script
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { blocksMessages } from './messages';
4
4
  export { blocksFragmentKey, blocksPreviewKey, blocksTopKey, provideBlocksPreview, provideBlocksTop, useBlocksPreview, type BlocksFragmentHost, type BlocksPreview, type BlocksTop, } from './preview';
5
5
  export { cloneNode, countType, insertNode, isNode, isNodeList, locate, makeNode, newKey, removeNode, replaceList, swapNode, typesIn, updateValues, walk, type Located, } from './content';
6
6
  export { lintBlock, undeclared } from './lint';
7
- export { findRange, findRegion, frameRegion, highlightBlock, regionRect, replaceBlock, stageDocument, } from './frame';
7
+ export { addAssets, findRange, findRegion, frameRegion, highlightBlock, regionRect, replaceBlock, stageDocument, } from './frame';
8
+ export type { BlockAssets } from './frame';
8
9
  export { callTag, formSchema, kindOf } from './schema';
9
10
  export { default as WxBlocks } from './BlocksField';
10
11
  export { default as WxBlocksSiteBarTab } from './BlocksSiteBarTab';