@prolibu-suite/cobalt-form-builder 0.2.1 → 1.0.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.
@@ -11,22 +11,38 @@ import { createSchemaStore, type SchemaEvent } from './stores/schema';
11
11
  * - `actions` — right side of the topbar (default: undo/redo buttons)
12
12
  * - `before` — content above the topbar (custom banner / breadcrumb)
13
13
  * - `after` — content below the editor (custom footer / save bar)
14
+ * - `[custom]` — any custom tab slot. Pass `{ id, label }` objects in the
15
+ * `tabs` prop and provide a matching `#<id>` slot.
16
+ * Each custom slot receives `{ store }` as slot props.
14
17
  *
15
18
  * Granular `SchemaEvent`s are re-emitted as Vue events the host can
16
19
  * listen for analytics, autosave, etc.
17
20
  */
18
- type TabId = 'designer' | 'preview' | 'json';
21
+ type BuiltinTabId = 'designer' | 'preview' | 'json';
22
+ export interface CustomTab {
23
+ id: string;
24
+ label: string;
25
+ }
26
+ type TabEntry = BuiltinTabId | CustomTab;
19
27
  type __VLS_Props = {
20
28
  /** The schema being edited (paged shape preferred — `{title,pages,theme}`). */
21
29
  modelValue?: Record<string, any>;
22
- /** Which top-level tabs to expose. Defaults to all three. */
23
- tabs?: TabId[];
30
+ /** Which top-level tabs to expose. Strings for built-in tabs, objects for custom ones. */
31
+ tabs?: TabEntry[];
24
32
  /** Hide the builder's brand mark (when the host has its own chrome). */
25
33
  hideBrand?: boolean;
26
34
  /** Brand label text (defaults to "Cobalt Form Builder"). */
27
35
  brandLabel?: string;
28
36
  /** Skip auto-registering Cobalt custom elements (host already did it). */
29
37
  skipCobaltRegister?: boolean;
38
+ /**
39
+ * Force the schema mode. When set, the store's `data.mode` is synced
40
+ * to this value on mount and whenever it changes. This drives quiz-mode
41
+ * behavior (filtered toolbox, answer-key panel, etc.).
42
+ */
43
+ mode?: 'form' | 'quiz' | 'survey';
44
+ /** Show error state on the title field (e.g. after failed validation). */
45
+ titleError?: boolean;
30
46
  };
31
47
  type __VLS_Slots = {
32
48
  brand?: () => any;
@@ -37,6 +53,14 @@ type __VLS_Slots = {
37
53
  after?: (props: {
38
54
  store: ReturnType<typeof createSchemaStore>;
39
55
  }) => any;
56
+ 'field-layout-extra'?: (props: {
57
+ field: Record<string, any>;
58
+ fieldName: string;
59
+ patchField: (key: string, value: any) => void;
60
+ }) => any;
61
+ [key: string]: ((props: {
62
+ store: ReturnType<typeof createSchemaStore>;
63
+ }) => any) | ((props: any) => any) | undefined;
40
64
  };
41
65
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
42
66
  "field-added": (payload: {
@@ -183,8 +207,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
183
207
  "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
184
208
  onEvent?: ((payload: SchemaEvent) => any) | undefined;
185
209
  }>, {
210
+ mode: "form" | "quiz" | "survey";
186
211
  modelValue: Record<string, any>;
187
- tabs: TabId[];
212
+ titleError: boolean;
213
+ tabs: TabEntry[];
188
214
  hideBrand: boolean;
189
215
  brandLabel: string;
190
216
  skipCobaltRegister: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CobaltFormBuilder.vue.d.ts","sourceRoot":"","sources":["../src/CobaltFormBuilder.vue"],"names":[],"mappings":"AAuVA,OAAO,EAEL,iBAAiB,EACjB,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;;;;;;GAeG;AAEH,KAAK,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C,KAAK,WAAW,GAAG;IACf,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;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