@dmitryvim/form-builder 0.2.23 → 0.2.24

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.
@@ -171,6 +171,13 @@ export interface TableElement extends BaseElement {
171
171
  /** File extensions accepted for import (e.g. ["csv", "xlsx"]) */
172
172
  importAccept?: string[];
173
173
  }
174
+ /**
175
+ * Legacy hidden field type — use `hidden: true` on any field instead.
176
+ * Kept for backward compatibility with schemas that use `type: "hidden"`.
177
+ */
178
+ export interface HiddenElement extends BaseElement {
179
+ type: "hidden";
180
+ }
174
181
  export interface RichInputElement extends BaseElement {
175
182
  type: "richinput";
176
183
  placeholder?: string;
@@ -185,7 +192,7 @@ export interface RichInputElement extends BaseElement {
185
192
  filesKey?: string;
186
193
  flatOutput?: boolean;
187
194
  }
188
- export type Element = TextElement | TextareaElement | NumberElement | SelectElement | SwitcherElement | FileElement | FilesElement | ColourElement | SliderElement | ContainerElement | GroupElement | TableElement | RichInputElement;
195
+ export type Element = TextElement | TextareaElement | NumberElement | SelectElement | SwitcherElement | FileElement | FilesElement | HiddenElement | ColourElement | SliderElement | ContainerElement | GroupElement | TableElement | RichInputElement;
189
196
  export interface Schema {
190
197
  version?: string;
191
198
  elements: Element[];
@@ -8,4 +8,5 @@ export interface State {
8
8
  version: string;
9
9
  config: Config;
10
10
  debounceTimer: number | null;
11
+ prefill: Record<string, any>;
11
12
  }
@@ -12,3 +12,17 @@ export declare function clear(node: HTMLElement): void;
12
12
  * e.g. 2400000 -> "2.3 MB", 512 -> "512 B"
13
13
  */
14
14
  export declare function formatFileSize(bytes: number): string;
15
+ /**
16
+ * Serialize a value for storage in a hidden input's value attribute.
17
+ * Objects/arrays → JSON string, null/undefined → "", primitives → String().
18
+ */
19
+ export declare function serializeHiddenValue(value: any): string;
20
+ /**
21
+ * Deserialize a hidden input's value attribute back to its original type.
22
+ * Empty string → null, JSON-parseable → parsed value, otherwise → raw string.
23
+ */
24
+ export declare function deserializeHiddenValue(raw: string): any;
25
+ /**
26
+ * Create a hidden input element for a hidden form field.
27
+ */
28
+ export declare function createHiddenInput(name: string, value: any): HTMLInputElement;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.23",
6
+ "version": "0.2.24",
7
7
  "description": "A reusable JSON schema form builder library",
8
8
  "main": "./dist/cjs/index.cjs",
9
9
  "module": "./dist/esm/index.js",