@webx-ui/module-blocks 0.7.1 → 0.8.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.
@@ -32,8 +32,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
32
32
  }>, {
33
33
  disabled: boolean;
34
34
  field: string | null;
35
+ depth: number;
35
36
  selected: string | null;
36
37
  parentKey: string | null;
37
- depth: number;
38
38
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
39
39
  export default _default;
@@ -0,0 +1,58 @@
1
+ import { CompletionSource } from '@codemirror/autocomplete';
2
+ import { Extension } from '@codemirror/state';
3
+ import { ScreenNode, TypeRegistry } from '@webx-ui/schema';
4
+ /**
5
+ * What the editor of a block type offers as you type, one source per file. Each reads the
6
+ * other files of the same type — the template's fields come from the schema, its classes from
7
+ * the styles, the styles' classes from the template — so the sources take getters, not
8
+ * values: the editor is built once and the files change under it.
9
+ *
10
+ * Registered as language data rather than as an `override`, so that what the language
11
+ * already offers (CSS properties, HTML tags) stays in the list beside ours.
12
+ */
13
+ export declare function completions(source: CompletionSource): Extension;
14
+ export interface TemplateSources {
15
+ schema: () => ScreenNode[];
16
+ styles: () => string;
17
+ }
18
+ export declare function templateCompletions({ schema, styles }: TemplateSources): CompletionSource;
19
+ export interface StylesSources {
20
+ slug: () => string;
21
+ template: () => string;
22
+ }
23
+ export declare function stylesCompletions({ slug, template }: StylesSources): CompletionSource;
24
+ /** Classes a stylesheet declares, nested `&__part` resolved against its parent. */
25
+ export declare function styleClasses(styles: string): string[];
26
+ /** Classes the template writes literally; anything Blade computes is left out. */
27
+ export declare function templateClasses(template: string): string[];
28
+ export interface SchemaSources {
29
+ types: () => TypeRegistry;
30
+ }
31
+ export declare function schemaCompletions({ types }: SchemaSources): CompletionSource;
32
+ interface Frame {
33
+ kind: 'object' | 'array';
34
+ parent: Frame | null;
35
+ /** For an array: the key it is the value of. */
36
+ under: string | null;
37
+ keys: Set<string>;
38
+ phase: 'key' | 'colon' | 'value' | 'after';
39
+ key: string | null;
40
+ }
41
+ export interface JsonContext {
42
+ /** The caret stands in an object that is a screen node. */
43
+ node: boolean;
44
+ phase: Frame['phase'];
45
+ /** The key whose value is being written. */
46
+ key: string | null;
47
+ /** Every key the object has, before the caret and after it. */
48
+ keys: Set<string>;
49
+ /** Where the string under the caret starts, after its opening quote. */
50
+ string: number | null;
51
+ }
52
+ /**
53
+ * Where the caret stands in a schema, by one pass over the text — it has to work on a
54
+ * document that is broken right there, which is always the case while typing, and a parser
55
+ * gives up on exactly that.
56
+ */
57
+ export declare function jsonContext(doc: string, pos: number): JsonContext | null;
58
+ export {};